From 53ad49b4ef13f11a1af7877b5aa024f8782958b4 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 12 Apr 2017 21:18:21 +0200 Subject: [PATCH 01/11] unify PHPUnit config files * add XML namespace attributes * remove attributes using default values * remove unknown `syntaxCheck` option --- .../Component/ExpressionLanguage/phpunit.xml.dist | 11 +++-------- src/Symfony/Component/Security/Acl/phpunit.xml.dist | 11 +++-------- src/Symfony/Component/Security/Core/phpunit.xml.dist | 11 +++-------- src/Symfony/Component/Security/Csrf/phpunit.xml.dist | 11 +++-------- src/Symfony/Component/Security/Http/phpunit.xml.dist | 11 +++-------- 5 files changed, 15 insertions(+), 40 deletions(-) diff --git a/src/Symfony/Component/ExpressionLanguage/phpunit.xml.dist b/src/Symfony/Component/ExpressionLanguage/phpunit.xml.dist index e7ecd6fb2b..517322fb4f 100644 --- a/src/Symfony/Component/ExpressionLanguage/phpunit.xml.dist +++ b/src/Symfony/Component/ExpressionLanguage/phpunit.xml.dist @@ -1,14 +1,9 @@ - - - - - Date: Thu, 13 Apr 2017 00:18:28 +0200 Subject: [PATCH 02/11] Add @throws phpdoc --- src/Symfony/Component/Console/Command/Command.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Symfony/Component/Console/Command/Command.php b/src/Symfony/Component/Console/Command/Command.php index ff4075962e..6b91e548e6 100644 --- a/src/Symfony/Component/Console/Command/Command.php +++ b/src/Symfony/Component/Console/Command/Command.php @@ -202,6 +202,8 @@ class Command * * @return int The command exit code * + * @throws \Exception When binding input fails. Bypass this by calling {@link ignoreValidationErrors()}. + * * @see setCode() * @see execute() */ From af3424fb959eef82e2bab3374041de6a90a78ffd Mon Sep 17 00:00:00 2001 From: Nikolay Labinskiy Date: Thu, 13 Apr 2017 14:19:24 +0300 Subject: [PATCH 03/11] [HttpFoundation] Fix getClientIp @return docblock --- src/Symfony/Component/HttpFoundation/Request.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index d84dbefa7c..f38560473a 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -850,7 +850,7 @@ class Request * ("Client-Ip" for instance), configure it via "setTrustedHeaderName()" with * the "client-ip" key. * - * @return string The client IP address + * @return string|null The client IP address * * @see getClientIps() * @see http://en.wikipedia.org/wiki/X-Forwarded-For From b190ec241e3a95a824487fee72617e01021e5cb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Thu, 13 Apr 2017 21:00:55 +0200 Subject: [PATCH 04/11] [PropertyInfo] Prevent returning int values in some cases. --- .../PropertyInfo/Extractor/ReflectionExtractor.php | 6 +++--- .../Tests/Extractors/ReflectionExtractorTest.php | 3 ++- src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php | 4 ++++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php b/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php index 8ba5db00d3..ecf0b287e2 100644 --- a/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php +++ b/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php @@ -64,7 +64,7 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp $properties = array(); foreach ($reflectionClass->getProperties(\ReflectionProperty::IS_PUBLIC) as $reflectionProperty) { - $properties[$reflectionProperty->name] = true; + $properties[$reflectionProperty->name] = $reflectionProperty->name; } foreach ($reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $reflectionMethod) { @@ -79,10 +79,10 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp if (!$reflectionClass->hasProperty($propertyName) && !preg_match('/^[A-Z]{2,}/', $propertyName)) { $propertyName = lcfirst($propertyName); } - $properties[$propertyName] = true; + $properties[$propertyName] = $propertyName; } - return array_keys($properties); + return array_values($properties); } /** diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractors/ReflectionExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractors/ReflectionExtractorTest.php index 55f75b9016..cc2ecbe6f5 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Extractors/ReflectionExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Extractors/ReflectionExtractorTest.php @@ -32,7 +32,7 @@ class ReflectionExtractorTest extends TestCase public function testGetProperties() { - $this->assertEquals( + $this->assertSame( array( 'bal', 'parent', @@ -49,6 +49,7 @@ class ReflectionExtractorTest extends TestCase 'a', 'DOB', 'Id', + '123', 'c', 'd', 'e', diff --git a/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php b/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php index 2f6fc11b0d..d358bae13a 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php @@ -116,4 +116,8 @@ class Dummy extends ParentDummy public function getId() { } + + public function get123() + { + } } From 7a8a72ddbf60747a90783961002f421356a192ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Thu, 13 Apr 2017 21:08:13 +0200 Subject: [PATCH 05/11] [PropertyInfo] Remove a useless call to count() in SerializerExtractor --- .../Component/PropertyInfo/Extractor/SerializerExtractor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/PropertyInfo/Extractor/SerializerExtractor.php b/src/Symfony/Component/PropertyInfo/Extractor/SerializerExtractor.php index b7edb8fa24..2c4699609e 100644 --- a/src/Symfony/Component/PropertyInfo/Extractor/SerializerExtractor.php +++ b/src/Symfony/Component/PropertyInfo/Extractor/SerializerExtractor.php @@ -48,7 +48,7 @@ class SerializerExtractor implements PropertyListExtractorInterface $serializerClassMetadata = $this->classMetadataFactory->getMetadataFor($class); foreach ($serializerClassMetadata->getAttributesMetadata() as $serializerAttributeMetadata) { - if (count(array_intersect($context['serializer_groups'], $serializerAttributeMetadata->getGroups())) > 0) { + if (array_intersect($context['serializer_groups'], $serializerAttributeMetadata->getGroups())) { $properties[] = $serializerAttributeMetadata->getName(); } } From 4d2c454fadd8e9d042d3355b73d527167cce8a13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Thu, 13 Apr 2017 21:16:53 +0200 Subject: [PATCH 06/11] [HttpFoundation] Store IANA's RNG files in the repository --- .../HttpFoundation/Tests/ResponseTest.php | 2 +- .../Tests/schema/http-status-codes.rng | 31 +++ .../Tests/schema/iana-registry.rng | 198 ++++++++++++++++++ 3 files changed, 230 insertions(+), 1 deletion(-) create mode 100644 src/Symfony/Component/HttpFoundation/Tests/schema/http-status-codes.rng create mode 100644 src/Symfony/Component/HttpFoundation/Tests/schema/iana-registry.rng diff --git a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php index 165e1fcf5f..8043ee45c1 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php @@ -906,7 +906,7 @@ class ResponseTest extends ResponseTestCase ))); $ianaHttpStatusCodes->load('https://www.iana.org/assignments/http-status-codes/http-status-codes.xml'); - if (!$ianaHttpStatusCodes->relaxNGValidate('https://www.iana.org/assignments/http-status-codes/http-status-codes.rng')) { + if (!$ianaHttpStatusCodes->relaxNGValidate(__DIR__.'/schema/http-status-codes.rng')) { self::fail('Invalid IANA\'s HTTP status code list.'); } diff --git a/src/Symfony/Component/HttpFoundation/Tests/schema/http-status-codes.rng b/src/Symfony/Component/HttpFoundation/Tests/schema/http-status-codes.rng new file mode 100644 index 0000000000..73708ca680 --- /dev/null +++ b/src/Symfony/Component/HttpFoundation/Tests/schema/http-status-codes.rng @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Symfony/Component/HttpFoundation/Tests/schema/iana-registry.rng b/src/Symfony/Component/HttpFoundation/Tests/schema/iana-registry.rng new file mode 100644 index 0000000000..b9c3ca9d94 --- /dev/null +++ b/src/Symfony/Component/HttpFoundation/Tests/schema/iana-registry.rng @@ -0,0 +1,198 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + uri + + + + rfc + + + (rfc|bcp|std)\d+ + + + + + rfc-errata + + + + draft + + + (draft|RFC)(-[a-zA-Z0-9]+)+ + + + + + registry + + + + person + + + + text + + + note + + + + unicode + + + ucd\d+\.\d+\.\d+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + (\d+|0x[\da-fA-F]+)(\s*-\s*(\d+|0x[\da-fA-F]+))? + + + + + + + + + + + + + 0x[0-9]{8} + + + + + + [0-1]+ + + + + + + + + + + + + + + + + + + + + + + legacy + mib + template + json + + + + + + + + + + From 67e249dc814042e3d3e2fe0497cf944de599df9b Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 13 Apr 2017 19:36:52 +0200 Subject: [PATCH 07/11] [Debug] Set exit status to 255 on error --- src/Symfony/Component/Debug/ErrorHandler.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/Debug/ErrorHandler.php b/src/Symfony/Component/Debug/ErrorHandler.php index 78dfba19b1..46bcc33f67 100644 --- a/src/Symfony/Component/Debug/ErrorHandler.php +++ b/src/Symfony/Component/Debug/ErrorHandler.php @@ -101,6 +101,7 @@ class ErrorHandler private static $reservedMemory; private static $stackedErrors = array(); private static $stackedErrorLevels = array(); + private static $exitCode = 0; /** * Same init value as thrownErrors. @@ -477,6 +478,9 @@ class ErrorHandler */ public function handleException($exception, array $error = null) { + if (null === $error) { + self::$exitCode = 255; + } if (!$exception instanceof \Exception) { $exception = new FatalThrowableError($exception); } @@ -562,7 +566,7 @@ class ErrorHandler return; } - if (null === $error) { + if ($exit = null === $error) { $error = error_get_last(); } @@ -586,15 +590,21 @@ class ErrorHandler } else { $exception = new FatalErrorException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, true, $trace); } - } elseif (!isset($exception)) { - return; } try { - $handler->handleException($exception, $error); + if (isset($exception)) { + self::$exitCode = 255; + $handler->handleException($exception, $error); + } } catch (FatalErrorException $e) { // Ignore this re-throw } + + if ($exit && self::$exitCode) { + $exitCode = self::$exitCode; + register_shutdown_function('register_shutdown_function', function () use ($exitCode) { exit($exitCode); }); + } } /** From 28332afb38a63d018295a602ad98d2284562a403 Mon Sep 17 00:00:00 2001 From: Dany Maillard Date: Thu, 13 Apr 2017 23:07:15 +0200 Subject: [PATCH 08/11] Add trhows PHPDoc in Application::run --- src/Symfony/Component/Console/Application.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index bc5e9ee66c..f9b90d56a3 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -103,6 +103,8 @@ class Application * @param OutputInterface $output An Output instance * * @return int 0 if everything went fine, or an error code + * + * @throws \Exception When running fails. Bypass this when {@link setCatchExceptions()}. */ public function run(InputInterface $input = null, OutputInterface $output = null) { From 3b83fe115b0f89d4028dce1afae76c43164fdf8c Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 17 Apr 2017 15:37:04 +0200 Subject: [PATCH 09/11] [VarDumper] Minor tweaks to html/css dumps --- .../Resources/views/Profiler/open.css.twig | 3 ++- src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php | 2 +- .../Component/VarDumper/Tests/Caster/StubCasterTest.php | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/open.css.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/open.css.twig index 144e86f062..02bc252f12 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/open.css.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/open.css.twig @@ -64,6 +64,7 @@ a.doc:hover { .anchor { position: relative; - top: -7em; + padding-top: 7em; + margin-top: -7em; visibility: hidden; } diff --git a/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php b/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php index 198ec106be..cc0b1ce179 100644 --- a/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php @@ -496,7 +496,7 @@ EOHTML $attr['href'] = $href; } if (isset($attr['href'])) { - $v = sprintf('%s', esc($this->utf8Encode($attr['href'])), $v); + $v = sprintf('%s', esc($this->utf8Encode($attr['href'])), $v); } if (isset($attr['lang'])) { $v = sprintf('%s', esc($attr['lang']), $v); diff --git a/src/Symfony/Component/VarDumper/Tests/Caster/StubCasterTest.php b/src/Symfony/Component/VarDumper/Tests/Caster/StubCasterTest.php index b1d1c85be6..c626b595f8 100644 --- a/src/Symfony/Component/VarDumper/Tests/Caster/StubCasterTest.php +++ b/src/Symfony/Component/VarDumper/Tests/Caster/StubCasterTest.php @@ -100,7 +100,7 @@ EODUMP; $expectedDump = <<<'EODUMP' array:1 [ - 0 => "Symfony\Component\VarDumper\Tests\Caster\StubCasterTest" + 0 => "Symfony\Component\VarDumper\Tests\Caster\StubCasterTest" ] EODUMP; @@ -120,7 +120,7 @@ EODUMP; $expectedDump = <<<'EODUMP' array:1 [ - 0 => "hello" + 0 => "hello" ] EODUMP; @@ -161,7 +161,7 @@ EODUMP; $expectedDump = <<<'EODUMP' array:1 [ - 0 => "hello" + 0 => "hello" ] EODUMP; From 7a9b086d569bf1a20940af887389e582aceb7c18 Mon Sep 17 00:00:00 2001 From: Dany Maillard Date: Mon, 3 Apr 2017 13:58:31 +0200 Subject: [PATCH 10/11] Fold Travis CI output by component --- .github/travis_fold.sh | 16 ++++++++++++++++ .travis.yml | 12 ++++++------ .../DataCollector/DoctrineDataCollectorTest.php | 1 + 3 files changed, 23 insertions(+), 6 deletions(-) create mode 100755 .github/travis_fold.sh diff --git a/.github/travis_fold.sh b/.github/travis_fold.sh new file mode 100755 index 0000000000..d0430aec58 --- /dev/null +++ b/.github/travis_fold.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +####################################### +# Fold Travis CI output +# Arguments: +# $1 fold name +# $2 command to execute +####################################### +tfold () { + FOLD=$(echo $1 | tr / .) + echo "travis_fold:start:$FOLD" + echo -e "\\e[34m$1\\e[0m" + sh -c "$2" && echo "travis_fold:end:$FOLD" +} + +export -f tfold diff --git a/.travis.yml b/.travis.yml index 7205200d85..fe6e2f8ce8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -82,13 +82,13 @@ install: - if [[ ! $skip ]]; then composer update --no-suggest; fi - if [[ ! $skip ]]; then ./phpunit install; fi - if [[ ! $skip && ! $PHP = hhvm* ]]; then php -i; else hhvm --php -r 'print_r($_SERVER);print_r(ini_get_all());'; fi + - . .github/travis_fold.sh script: - - REPORT=' && echo -e "\\e[32mOK\\e[0m {}\\n\\n" || (echo -e "\\e[41mKO\\e[0m {}\\n\\n" && $(exit 1))' - if [[ $skip ]]; then echo -e "\\n\\e[1;34mIntermediate PHP version $PHP is skipped for pull requests.\\e[0m"; fi - - if [[ ! $deps && ! $PHP = hhvm* ]]; then echo "$COMPONENTS" | parallel --gnu '$PHPUNIT --exclude-group tty,benchmark,intl-data {}'"$REPORT"; fi - - if [[ ! $deps && ! $PHP = hhvm* ]]; then echo -e "\\nRunning tests requiring tty"; $PHPUNIT --group tty; fi + - if [[ ! $deps && ! $PHP = hhvm* ]]; then echo "$COMPONENTS" | parallel --gnu -k 'tfold {}.PHPUnit "$PHPUNIT --exclude-group tty,benchmark,intl-data {}"'; fi + - if [[ ! $deps && ! $PHP = hhvm* ]]; then tfold PHPUnit.tty "$PHPUNIT --group tty"; fi - if [[ ! $deps && $PHP = hhvm* ]]; then $PHPUNIT --exclude-group benchmark,intl-data; fi - - if [[ ! $deps && $PHP = ${MIN_PHP%.*} ]]; then echo -e "1\\n0" | xargs -I{} sh -c 'echo "\\nPHP --enable-sigchild enhanced={}" && ENHANCE_SIGCHLD={} php-$MIN_PHP/sapi/cli/php .phpunit/phpunit-4.8/phpunit --colors=always src/Symfony/Component/Process/'; fi - - if [[ $deps = high ]]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer update --no-progress --no-suggest --ansi; $PHPUNIT --exclude-group tty,benchmark,intl-data'$LEGACY"$REPORT"; fi - - if [[ $deps = low ]]; then echo "$COMPONENTS" | parallel --gnu -j10% 'cd {}; composer update --no-progress --no-suggest --ansi --prefer-lowest --prefer-stable; $PHPUNIT --exclude-group tty,benchmark,intl-data'"$REPORT"; fi + - if [[ ! $deps && $PHP = ${MIN_PHP%.*} ]]; then echo -e "1\\n0" | xargs -I{} sh -c 'tfold PHPUnit.sigchild "ENHANCE_SIGCHLD={} php-$MIN_PHP/sapi/cli/php .phpunit/phpunit-4.8/phpunit --colors=always src/Symfony/Component/Process/"'; fi + - if [[ $deps = high ]]; then echo "$COMPONENTS" | parallel --gnu -k -j10% 'cd {}; tfold {}.composer "composer update --no-progress --no-suggest --ansi 2>&1"; tfold {}.PHPUnit "$PHPUNIT --exclude-group tty,benchmark,intl-data$LEGACY"'; fi + - if [[ $deps = low ]]; then echo "$COMPONENTS" | parallel --gnu -k -j10% 'cd {}; tfold {}.composer "composer update --no-progress --no-suggest --ansi --prefer-lowest --prefer-stable 2>&1"; tfold {}.PHPUnit "$PHPUNIT --exclude-group tty,benchmark,intl-data"'; fi diff --git a/src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php b/src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php index 3059f8aba0..cf5cee90dd 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php @@ -24,6 +24,7 @@ class DoctrineDataCollectorTest extends TestCase $c = $this->createCollector(array()); $c->collect(new Request(), new Response()); $this->assertEquals(array('default' => 'doctrine.dbal.default_connection'), $c->getConnections()); + $this->assertTrue(false); } public function testCollectManagers() From cf87678a2e6aa6249b2c8a38ef0ab151ae787e74 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 18 Apr 2017 17:01:04 +0200 Subject: [PATCH 11/11] Make .travis.yml more readable --- .github/travis_fold.sh | 16 -- .travis.yml | 166 +++++++++++++----- .../DoctrineDataCollectorTest.php | 1 - 3 files changed, 119 insertions(+), 64 deletions(-) delete mode 100755 .github/travis_fold.sh diff --git a/.github/travis_fold.sh b/.github/travis_fold.sh deleted file mode 100755 index d0430aec58..0000000000 --- a/.github/travis_fold.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -####################################### -# Fold Travis CI output -# Arguments: -# $1 fold name -# $2 command to execute -####################################### -tfold () { - FOLD=$(echo $1 | tr / .) - echo "travis_fold:start:$FOLD" - echo -e "\\e[34m$1\\e[0m" - sh -c "$2" && echo "travis_fold:end:$FOLD" -} - -export -f tfold diff --git a/.travis.yml b/.travis.yml index fe6e2f8ce8..e33ea4d876 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,55 +40,127 @@ cache: services: mongodb before_install: - - stty cols 120 - - PHP=$TRAVIS_PHP_VERSION - # Matrix lines for intermediate PHP versions are skipped for pull requests - - if [[ ! $deps && ! $PHP = ${MIN_PHP%.*} && ! $PHP = hhvm* && $TRAVIS_PULL_REQUEST != false ]]; then deps=skip; skip=1; fi - # A sigchild-enabled-PHP is used to test the Process component on the lowest PHP matrix line - - if [[ ! $deps && $PHP = ${MIN_PHP%.*} && ! -d php-$MIN_PHP/sapi ]]; then wget http://museum.php.net/php5/php-$MIN_PHP.tar.bz2 -O - | tar -xj; (cd php-$MIN_PHP; ./configure --enable-sigchild --enable-pcntl; make -j2); fi - - if [[ ! $PHP = hhvm* ]]; then INI_FILE=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; else INI_FILE=/etc/hhvm/php.ini; fi - - if [[ ! $skip ]]; then echo date.timezone = Europe/Paris >> $INI_FILE; fi - - if [[ ! $skip ]]; then echo memory_limit = -1 >> $INI_FILE; fi - - if [[ ! $skip ]]; then echo session.gc_probability = 0 >> $INI_FILE; fi - - if [[ ! $skip ]]; then echo opcache.enable_cli = 1 >> $INI_FILE; fi - - if [[ ! $skip ]]; then echo hhvm.jit = 0 >> $INI_FILE; fi - - if [[ ! $skip && $PHP = 5.* ]]; then echo extension = mongo.so >> $INI_FILE; fi - - if [[ ! $skip && $PHP = 5.* ]]; then echo extension = memcache.so >> $INI_FILE; fi - - if [[ ! $skip && $PHP = 5.* ]]; then (echo yes | pecl install -f apcu-4.0.11 && echo apc.enable_cli = 1 >> $INI_FILE); fi - - if [[ ! $skip && $PHP = 7.* ]]; then (echo yes | pecl install -f apcu-5.1.6 && echo apc.enable_cli = 1 >> $INI_FILE); fi - - if [[ ! $deps && $PHP = 5.* ]]; then (cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo extension = $(pwd)/modules/symfony_debug.so >> $INI_FILE); fi - - if [[ ! $skip && $PHP = 5.* ]]; then pecl install -f memcached-2.1.0; fi - - if [[ ! $skip && ! $PHP = hhvm* ]]; then echo extension = ldap.so >> $INI_FILE; fi - - if [[ ! $skip && ! $PHP = hhvm* ]]; then phpenv config-rm xdebug.ini || echo "xdebug not available"; fi - - if [[ ! $skip ]]; then [ -d ~/.composer ] || mkdir ~/.composer; cp .composer/* ~/.composer/; fi - - if [[ ! $skip ]]; then export PHPUNIT=$(readlink -f ./phpunit); fi + - | + # General configuration + stty cols 120 + PHP=$TRAVIS_PHP_VERSION + [ -d ~/.composer ] || mkdir ~/.composer + cp .composer/* ~/.composer/ + export PHPUNIT=$(readlink -f ./phpunit) + export PHPUNIT_X="$PHPUNIT --exclude-group tty,benchmark,intl-data" + export COMPOSER_UP='composer update --no-progress --no-suggest --ansi' + + # tfold is a helper to create folded reports + tfold () { + title=$1 + fold=$(echo $title | sed -r 's/[^-_A-Za-z\d]+/./g') + shift + echo -e "travis_fold:start:$fold\\n\\e[1;34m$title\\e[0m" + bash -xc "$*" 2>&1 && + echo -e "\\e[32mOK\\e[0m $title\\n\\ntravis_fold:end:$fold" || + ( echo -e "\\e[41mKO\\e[0m $title\\n" && exit 1 ) + } + export -f tfold + + # php.ini configuration + if [[ $PHP = hhvm* ]]; then + INI=/etc/hhvm/php.ini + else + INI=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini + phpenv config-rm xdebug.ini || echo "xdebug not available" + fi + echo date.timezone = Europe/Paris >> $INI + echo memory_limit = -1 >> $INI + echo session.gc_probability = 0 >> $INI + echo opcache.enable_cli = 1 >> $INI + echo hhvm.jit = 0 >> $INI + echo apc.enable_cli = 1 >> $INI + echo extension = ldap.so >> $INI + [[ $PHP = 5.* ]] && echo extension = mongo.so >> $INI + [[ $PHP = 5.* ]] && echo extension = memcache.so >> $INI + + # Matrix lines for intermediate PHP versions are skipped for pull requests + if [[ ! $deps && ! $PHP = ${MIN_PHP%.*} && ! $PHP = hhvm* && $TRAVIS_PULL_REQUEST != false ]]; then + deps=skip + skip=1 + else + COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n') + fi + + - | + # Install sigchild-enabled PHP to test the Process component on the lowest PHP matrix line + if [[ ! $deps && $PHP = ${MIN_PHP%.*} && ! -d php-$MIN_PHP/sapi ]]; then + wget http://museum.php.net/php5/php-$MIN_PHP.tar.bz2 -O - | tar -xj && + (cd php-$MIN_PHP && ./configure --enable-sigchild --enable-pcntl && make -j2) + fi + + - | + # Install extra PHP extensions + if [[ ! $skip && $PHP = 5.* ]]; then + ([[ $deps ]] || tfold ext.symfony_debug 'cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo extension = $(pwd)/modules/symfony_debug.so >> '"$INI") && + tfold ext.memcached pecl install -f memcached-2.1.0 && + tfold ext.apcu4 'echo yes | pecl install -f apcu-4.0.11' + elif [[ ! $skip && $PHP = 7.* ]]; then + tfold ext.apcu5 'echo yes | pecl install -f apcu-5.1.6' + fi install: - - if [[ ! $skip && $deps ]]; then cp composer.json composer.json.orig; fi - - if [[ ! $skip && $deps ]]; then echo -e '{\n"require":{'"$(grep phpunit-bridge composer.json)"'"php":"*"},"minimum-stability":"dev"}' > composer.json; fi - - if [[ ! $skip ]]; then COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n'); fi - # Create local composer packages for each patched components and reference them in composer.json files when cross-testing components - - if [[ ! $skip && $deps ]]; then php .github/build-packages.php HEAD^ $COMPONENTS; fi - - if [[ ! $skip && $deps ]]; then mv composer.json composer.json.phpunit; mv composer.json.orig composer.json; fi - - if [[ ! $skip && ! $deps ]]; then php .github/build-packages.php HEAD^ src/Symfony/Bridge/PhpUnit; fi - # For the master branch when deps=high, the version before master is checked out and tested with the locally patched components - - if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then SYMFONY_VERSION=$(git ls-remote --heads | grep -o '/[1-9].*' | tail -n 1 | sed s/.//); else SYMFONY_VERSION=$(cat composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9.]*'); fi - - if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then git fetch origin $SYMFONY_VERSION; git checkout -m FETCH_HEAD; COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n'); fi - # Legacy tests are skipped when deps=high and when the current branch version has not the same major version number than the next one - - if [[ $deps = high && ${SYMFONY_VERSION%.*} != $(git show $(git ls-remote --heads | grep -FA1 /$SYMFONY_VERSION | tail -n 1):composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9]*' | head -n 1) ]]; then LEGACY=,legacy; fi - - export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev - - if [[ ! $skip && $deps ]]; then export SYMFONY_DEPRECATIONS_HELPER=weak; fi - - if [[ ! $skip && $deps ]]; then mv composer.json.phpunit composer.json; fi - - if [[ ! $skip ]]; then composer update --no-suggest; fi + - | + # Create local composer packages for each patched components and reference them in composer.json files when cross-testing components + if [[ ! $deps ]]; then + php .github/build-packages.php HEAD^ src/Symfony/Bridge/PhpUnit + elif [[ ! $skip ]]; then + export SYMFONY_DEPRECATIONS_HELPER=weak && + cp composer.json composer.json.orig && + echo -e '{\n"require":{'"$(grep phpunit-bridge composer.json)"'"php":"*"},"minimum-stability":"dev"}' > composer.json && + php .github/build-packages.php HEAD^ $COMPONENTS && + mv composer.json composer.json.phpunit && + mv composer.json.orig composer.json + fi + + - | + # For the master branch, when deps=high, the version before master is checked out and tested with the locally patched components + if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then + SYMFONY_VERSION=$(git ls-remote --heads | grep -o '/[1-9].*' | tail -n 1 | sed s/.//) && + git fetch origin $SYMFONY_VERSION && + git checkout -m FETCH_HEAD && + COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n') + elif [[ ! $skip ]]; then + SYMFONY_VERSION=$(cat composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9.]*') + fi + + - | + # Legacy tests are skipped when deps=high and when the current branch version has not the same major version number than the next one + [[ $deps = high && ${SYMFONY_VERSION%.*} != $(git show $(git ls-remote --heads | grep -FA1 /$SYMFONY_VERSION | tail -n 1):composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9]*' | head -n 1) ]] && LEGACY=,legacy + + export COMPOSER_ROOT_VERSION=$SYMFONY_VERSION.x-dev + if [[ ! $skip && $deps ]]; then mv composer.json.phpunit composer.json; fi + + - if [[ ! $skip ]]; then $COMPOSER_UP; fi - if [[ ! $skip ]]; then ./phpunit install; fi - - if [[ ! $skip && ! $PHP = hhvm* ]]; then php -i; else hhvm --php -r 'print_r($_SERVER);print_r(ini_get_all());'; fi - - . .github/travis_fold.sh + - | + # phpinfo + if [[ ! $PHP = hhvm* ]]; then php -i; else hhvm --php -r 'print_r($_SERVER);print_r(ini_get_all());'; fi + + - | + run_tests () { + set -e + if [[ $skip ]]; then + echo -e "\\n\\e[1;34mIntermediate PHP version $PHP is skipped for pull requests.\\e[0m" + elif [[ $deps = high ]]; then + echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && $COMPOSER_UP && $PHPUNIT_X$LEGACY'" + elif [[ $deps = low ]]; then + echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && $COMPOSER_UP --prefer-lowest --prefer-stable && $PHPUNIT_X'" + elif [[ $PHP = hhvm* ]]; then + $PHPUNIT --exclude-group benchmark,intl-data + else + echo "$COMPONENTS" | parallel --gnu "tfold {} $PHPUNIT_X {}" + tfold tty-group $PHPUNIT --group tty + if [[ $PHP = ${MIN_PHP%.*} ]]; then + echo -e "1\\n0" | xargs -I{} bash -c "tfold src/Symfony/Component/Process.sigchild{} ENHANCE_SIGCHLD={} php-$MIN_PHP/sapi/cli/php .phpunit/phpunit-4.8/phpunit --colors=always src/Symfony/Component/Process/" + fi + fi + } script: - - if [[ $skip ]]; then echo -e "\\n\\e[1;34mIntermediate PHP version $PHP is skipped for pull requests.\\e[0m"; fi - - if [[ ! $deps && ! $PHP = hhvm* ]]; then echo "$COMPONENTS" | parallel --gnu -k 'tfold {}.PHPUnit "$PHPUNIT --exclude-group tty,benchmark,intl-data {}"'; fi - - if [[ ! $deps && ! $PHP = hhvm* ]]; then tfold PHPUnit.tty "$PHPUNIT --group tty"; fi - - if [[ ! $deps && $PHP = hhvm* ]]; then $PHPUNIT --exclude-group benchmark,intl-data; fi - - if [[ ! $deps && $PHP = ${MIN_PHP%.*} ]]; then echo -e "1\\n0" | xargs -I{} sh -c 'tfold PHPUnit.sigchild "ENHANCE_SIGCHLD={} php-$MIN_PHP/sapi/cli/php .phpunit/phpunit-4.8/phpunit --colors=always src/Symfony/Component/Process/"'; fi - - if [[ $deps = high ]]; then echo "$COMPONENTS" | parallel --gnu -k -j10% 'cd {}; tfold {}.composer "composer update --no-progress --no-suggest --ansi 2>&1"; tfold {}.PHPUnit "$PHPUNIT --exclude-group tty,benchmark,intl-data$LEGACY"'; fi - - if [[ $deps = low ]]; then echo "$COMPONENTS" | parallel --gnu -k -j10% 'cd {}; tfold {}.composer "composer update --no-progress --no-suggest --ansi --prefer-lowest --prefer-stable 2>&1"; tfold {}.PHPUnit "$PHPUNIT --exclude-group tty,benchmark,intl-data"'; fi + - (run_tests) diff --git a/src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php b/src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php index cf5cee90dd..3059f8aba0 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php @@ -24,7 +24,6 @@ class DoctrineDataCollectorTest extends TestCase $c = $this->createCollector(array()); $c->collect(new Request(), new Response()); $this->assertEquals(array('default' => 'doctrine.dbal.default_connection'), $c->getConnections()); - $this->assertTrue(false); } public function testCollectManagers()