Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

DevKit updates #314

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
DevKit updates
ElectricMaxxx committed Mar 1, 2019
commit 2e7dd5fd70e88baaab083e22f432254d297280d0
64 changes: 64 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php

/**
* DO NOT EDIT THIS FILE!
*
* It's auto-generated by sonata-project/dev-kit package.
*/

$header = <<<'HEADER'
This file is part of the Symfony CMF package.

(c) Symfony CMF

For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
HEADER;

$rules = [
'@Symfony' => true,
'@Symfony:risky' => true,
'array_syntax' => [
'syntax' => 'short',
],
'combine_consecutive_issets' => true,
'combine_consecutive_unsets' => true,
'header_comment' => [
'header' => $header,
],
'no_extra_blank_lines' => true,
'no_php4_constructor' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_class_elements' => true,
'ordered_imports' => true,
'phpdoc_order' => true,
'@PHP56Migration' => true,
'@PHP56Migration:risky' => true,
'@PHPUnit57Migration:risky' => true,
'@PHP70Migration' => true,
'@PHP70Migration:risky' => true,
'@PHPUnit60Migration:risky' => true,
'@PHP71Migration' => true,
'@PHP71Migration:risky' => true,
'compact_nullable_typehint' => true,
'void_return' => null,
'strict_comparison' => true,
'strict_param' => true,
];


$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
->exclude('Tests/Fixtures')
->exclude('tests/Fixtures')
->exclude('Resources/skeleton')
->exclude('Resources/public/vendor')
;

return PhpCsFixer\Config::create()
->setFinder($finder)
->setRiskyAllowed(true)
->setRules($rules)
->setUsingCache(true)
;
2 changes: 1 addition & 1 deletion .styleci.yml
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
############################################################################
# This file is part of the Symfony CMF package. #
# #
# (c) 2011-2017 Symfony CMF #
# (c) Symfony CMF #
# #
# For the full copyright and license information, please view the LICENSE #
# file that was distributed with this source code. #
25 changes: 15 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
############################################################################
# This file is part of the Symfony CMF package. #
# #
# (c) 2011-2017 Symfony CMF #
# (c) Symfony CMF #
# #
# For the full copyright and license information, please view the LICENSE #
# file that was distributed with this source code. #
@@ -29,21 +29,22 @@ cache:
env:
matrix: SYMFONY_VERSION=4.2.*
global:
- SYMFONY_DEPRECATIONS_HELPER=weak
- SYMFONY_DEPRECATIONS_HELPER="/.*each.*/"
- SYMFONY_PHPUNIT_DIR=.phpunit SYMFONY_PHPUNIT_REMOVE="symfony/yaml"
- SYMFONY_PHPUNIT_VERSION=6
- TEST_INSTALLATION=false
- SYMFONY_PHPUNIT_VERSION=7
- PHPUNIT_VERSION=7
- TARGET=test

matrix:
include:
- env: TARGET=lint
- php: 7.3
env: STABILITY="dev" SYMFONY_VERSION=4.3.*
- php: 7.3
env: SYMFONY_VERSION=4.2.*
- php: 7.1
env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_VERSION=3.4.* SYMFONY_DEPRECATIONS_HELPER=weak
- php: 7.2
env: SYMFONY_VERSION=4.0.*
env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_VERSION=3.4.* SYMFONY_DEPRECATIONS_HELPER="/.*each.*/"

- php: 7.2
env: SYMFONY_VERSION=4.1.*
fast_finish: true
@@ -59,9 +60,13 @@ before_install:
- if [ "$SYMFONY_VERSION" != "" ]; then composer require symfony/symfony:${SYMFONY_VERSION} --no-update; fi
- export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi)

install: travis_wait composer update --prefer-dist $COMPOSER_FLAGS
script:
- if [ "${TEST_INSTALLATION}" == true ]; then make test_installation; else make test; fi
install:
- if [ -x .travis/install_${TARGET}.sh ]; then .travis/install_${TARGET}.sh; fi;

script: make $TARGET

after_success:
- if [ -x .travis/after_success_${TARGET}.sh ]; then .travis/after_success_${TARGET}.sh; fi;

notifications:
irc: "irc.freenode.org#symfony-cmf"
5 changes: 5 additions & 0 deletions .travis/after_success_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

#!/usr/bin/env sh
set -ev

coveralls -v
11 changes: 11 additions & 0 deletions .travis/install_lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env sh
set -ev

mkdir --parents "${HOME}/bin"

wget "http://cs.sensiolabs.org/download/php-cs-fixer-v2.phar" --output-document="${HOME}/bin/php-cs-fixer"
chmod u+x "${HOME}/bin/php-cs-fixer"

composer global require sllh/composer-lint:@stable --prefer-dist --no-interaction

gem install yaml-lint
19 changes: 19 additions & 0 deletions .travis/install_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env sh
set -ev

mkdir --parents "${HOME}/bin"

wget "https://phar.phpunit.de/phpunit-${PHPUNIT_VERSION}.phar" --output-document="${HOME}/bin/phpunit"
chmod u+x "${HOME}/bin/phpunit"

# Coveralls client install
wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar --output-document="${HOME}/bin/coveralls"
chmod u+x "${HOME}/bin/coveralls"

# To be removed when these issues are resolved:
# https://github.com/composer/composer/issues/5355
if [ "${COMPOSER_FLAGS}" = '--prefer-lowest' ]; then
composer update --prefer-dist --no-interaction --prefer-stable --quiet
fi

composer update --prefer-dist --no-interaction --prefer-stable ${COMPOSER_FLAGS}
58 changes: 48 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -7,33 +7,71 @@
############################################################################
# This file is part of the Symfony CMF package. #
# #
# (c) 2011-2017 Symfony CMF #
# (c) Symfony CMF #
# #
# For the full copyright and license information, please view the LICENSE #
# file that was distributed with this source code. #
############################################################################

TESTING_SCRIPTS_DIR=vendor/symfony-cmf/testing/bin

SYMFONY_PHPUNIT_VERSION=6
SYMFONY_DEPRECATIONS_HELPER==weak
CONSOLE=${TESTING_SCRIPTS_DIR}/console
SYMFONY_PHPUNIT_DIR=.phpunit
SYMFONY_PHPUNIT_REMOVE="symfony/yaml"
VERSION=dev-master
ifdef BRANCH
VERSION=dev-${BRANCH}
endif
PACKAGE=symfony-cmf/menu-bundle
HAS_XDEBUG=$(shell php --modules|grep --quiet xdebug;echo $$?)

list:
@echo 'test: will run all tests'
@echo 'unit_tests: will run unit tests only'
@echo 'functional_tests_phpcr: will run functional tests with PHPCR'


include ${TESTING_SCRIPTS_DIR}/make/unit_tests.mk
include ${TESTING_SCRIPTS_DIR}/make/functional_tests_phpcr.mk
TEST_DEPENDENCIES := ""
EXTRA_INCLUDES:=$(wildcard ${TESTING_SCRIPTS_DIR}/make/unit_tests.mk)
ifneq ($(strip $(EXTRA_INCLUDES)),)
contents := $(shell echo including extra rules $(EXTRA_INCLUDES))
include $(EXTRA_INCLUDES)
TEST_DEPENDENCIES := $(TEST_DEPENDENCIES)" unit_tests"
endif
EXTRA_INCLUDES:=$(wildcard ${TESTING_SCRIPTS_DIR}/make/functional_tests_phpcr.mk)
ifneq ($(strip $(EXTRA_INCLUDES)),)
contents := $(shell echo including extra rules $(EXTRA_INCLUDES))
include $(EXTRA_INCLUDES)
TEST_DEPENDENCIES := $(TEST_DEPENDENCIES)" functional_tests_phpcr"
endif

.PHONY: test
test: unit_tests functional_tests_phpcr
test: build/xdebug-filter.php$
ifneq ($(strip $(wildcard ${TESTING_SCRIPTS_DIR}/make/unit_tests.mk)),)
@make unit_tests
endif
ifneq ($(strip $(wildcard ${TESTING_SCRIPTS_DIR}/make/functional_tests_phpcr.mk)),)
@make functional_tests_phpcr
endif

lint-php:
php-cs-fixer fix --ansi --verbose --diff --dry-run
.PHONY: lint-php

lint: lint-composer lint-php
.PHONY: lint

lint-composer:
composer validate
.PHONY: lint-composer

cs-fix: cs-fix-php
.PHONY: cs-fix

cs-fix-php:
php-cs-fixer fix --verbose
.PHONY: cs-fix-php

build:
mkdir $@

build/xdebug-filter.php: phpunit.xml.dist build
ifeq ($(HAS_XDEBUG), 0)
phpunit --dump-xdebug-filter $@
endif
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ The MenuBundle provides menus from a doctrine object manager with the help of Kn
## Requirements

* PHP 7.1 / 7.2 / 7.3
* Symfony 3.4 / 4.0 / 4.1 / 4.2
* Symfony 3.4 / 4.1 / 4.2
* See also the `require` section of [composer.json](composer.json)

## Documentation
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -16,8 +16,8 @@
],
"require": {
"php": "^7.1",
"symfony/framework-bundle": "^3.4 || ^4.0",
"symfony/validator": "^3.4 || ^4.0",
"symfony/framework-bundle": "^3.4 || ^4.1",
"symfony/validator": "^3.4 || ^4.1",
"knplabs/knp-menu-bundle": "^2.2.0",
"knplabs/knp-menu": "^2.0.0"
},
40 changes: 24 additions & 16 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -2,27 +2,35 @@

<!-- http://www.phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit
colors="true"
bootstrap="vendor/symfony-cmf/testing/bootstrap/bootstrap.php"
>
colors="true"
bootstrap="vendor/symfony-cmf/testing/bootstrap/bootstrap.php"
>

<testsuites>
<testsuite name="unit tests">
<testsuites>


<testsuite name="unit tests">
<directory>./tests/Unit</directory>
</testsuite>

<testsuite name="functional tests with phpcr">
<directory>./tests/Functional</directory>
<exclude>./tests/Functional/Doctrine/Orm</exclude>
</testsuite>
</testsuites>

</testsuites>

<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory>src/</directory>
<exclude>
<directory>Resources/</directory>
</exclude>
</whitelist>
</filter>

<php>

<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory>src</directory>
<exclude>
<file>*Bundle.php</file>
<directory>Resources/</directory>
</exclude>
</whitelist>
</filter>
<env name="KERNEL_CLASS" value="\Symfony\Cmf\Bundle\MenuBundle\Tests\Fixtures\App\Kernel" />
</php>
</phpunit>
2 changes: 1 addition & 1 deletion src/Resources/meta/LICENSE
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ Symfony CMF Menu Bundle

The MIT License

Copyright (c) 2011-2017 Symfony CMF
Copyright (c) Symfony CMF

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal