From 5e1ffb8d7ff3c043fa4e32e94dcf82338b2c78bf Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 7 Jun 2019 19:50:04 +0200 Subject: [PATCH 1/3] [travis] increase concurrency --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 405eb68e90..3a02215951 100644 --- a/.travis.yml +++ b/.travis.yml @@ -260,12 +260,12 @@ install: tfold 'phpunit install' ./phpunit install fi if [[ $deps = high ]]; then - echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && $COMPOSER_UP && $PHPUNIT_X$LEGACY'" + echo "$COMPONENTS" | parallel --gnu "tfold {} 'cd {} && $COMPOSER_UP && $PHPUNIT_X$LEGACY'" elif [[ $deps = low ]]; then [[ -e ~/php-ext/composer-lowest.lock.tar ]] && tar -xf ~/php-ext/composer-lowest.lock.tar tar -cf ~/php-ext/composer-lowest.lock.tar --files-from /dev/null php .github/rm-invalid-lowest-lock-files.php $COMPONENTS - echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && ([ -e composer.lock ] && ${COMPOSER_UP/update/install} || $COMPOSER_UP --prefer-lowest --prefer-stable) && $PHPUNIT_X'" + echo "$COMPONENTS" | parallel --gnu "tfold {} 'cd {} && ([ -e composer.lock ] && ${COMPOSER_UP/update/install} || $COMPOSER_UP --prefer-lowest --prefer-stable) && $PHPUNIT_X'" echo "$COMPONENTS" | xargs -n1 -I{} tar --append -f ~/php-ext/composer-lowest.lock.tar {}/composer.lock elif [[ $PHP = hhvm* ]]; then rm src/Symfony/Bridge/PhpUnit -Rf From 5b2991804372d7f54829128d902dd04241c8df69 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 7 Jun 2019 20:09:56 +0200 Subject: [PATCH 2/3] [TwigBundle] fix tests --- .../TwigBundle/Tests/Loader/FilesystemLoaderTest.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Bundle/TwigBundle/Tests/Loader/FilesystemLoaderTest.php b/src/Symfony/Bundle/TwigBundle/Tests/Loader/FilesystemLoaderTest.php index 697e6ceb66..b19a1180fc 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/Loader/FilesystemLoaderTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/Loader/FilesystemLoaderTest.php @@ -11,10 +11,13 @@ namespace Symfony\Bundle\TwigBundle\Tests\Loader; -use Symfony\Bundle\FrameworkBundle\Templating\TemplateReference; use Symfony\Bundle\TwigBundle\Loader\FilesystemLoader; use Symfony\Bundle\TwigBundle\Tests\TestCase; +use Symfony\Component\Templating\TemplateReferenceInterface; +/** + * @group legacy + */ class FilesystemLoaderTest extends TestCase { public function testGetSourceContext() @@ -61,7 +64,7 @@ class FilesystemLoaderTest extends TestCase ->expects($this->once()) ->method('parse') ->with('name.format.engine') - ->willReturn(new TemplateReference('', '', 'name', 'format', 'engine')) + ->willReturn($this->getMockBuilder(TemplateReferenceInterface::class)->getMock()) ; $locator = $this->getMockBuilder('Symfony\Component\Config\FileLocatorInterface')->getMock(); @@ -85,7 +88,7 @@ class FilesystemLoaderTest extends TestCase ->expects($this->once()) ->method('parse') ->with('name.format.engine') - ->willReturn(new TemplateReference('', '', 'name', 'format', 'engine')) + ->willReturn($this->getMockBuilder(TemplateReferenceInterface::class)->getMock()) ; $locator = $this->getMockBuilder('Symfony\Component\Config\FileLocatorInterface')->getMock(); From b702598b0bb0d03b994b567156bb584003f23388 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Fri, 7 Jun 2019 11:25:07 -0400 Subject: [PATCH 3/3] Fixing bug where PropertyInfoLoader tried to add validation to non-existent properties --- .../Component/Validator/Mapping/Loader/PropertyInfoLoader.php | 4 ++++ .../Validator/Tests/Fixtures/PropertyInfoLoaderEntity.php | 4 ++++ .../Validator/Tests/Mapping/Loader/PropertyInfoLoaderTest.php | 1 + 3 files changed, 9 insertions(+) diff --git a/src/Symfony/Component/Validator/Mapping/Loader/PropertyInfoLoader.php b/src/Symfony/Component/Validator/Mapping/Loader/PropertyInfoLoader.php index df3878d6e2..7ddd534275 100644 --- a/src/Symfony/Component/Validator/Mapping/Loader/PropertyInfoLoader.php +++ b/src/Symfony/Component/Validator/Mapping/Loader/PropertyInfoLoader.php @@ -60,6 +60,10 @@ final class PropertyInfoLoader implements LoaderInterface continue; } + if (!property_exists($className, $property)) { + continue; + } + $types = $this->typeExtractor->getTypes($className, $property); if (null === $types) { continue; diff --git a/src/Symfony/Component/Validator/Tests/Fixtures/PropertyInfoLoaderEntity.php b/src/Symfony/Component/Validator/Tests/Fixtures/PropertyInfoLoaderEntity.php index 42f048c5d8..5f2a37179d 100644 --- a/src/Symfony/Component/Validator/Tests/Fixtures/PropertyInfoLoaderEntity.php +++ b/src/Symfony/Component/Validator/Tests/Fixtures/PropertyInfoLoaderEntity.php @@ -48,4 +48,8 @@ class PropertyInfoLoaderEntity public $alreadyPartiallyMappedCollection; public $readOnly; + + public function setNonExistentField() + { + } } diff --git a/src/Symfony/Component/Validator/Tests/Mapping/Loader/PropertyInfoLoaderTest.php b/src/Symfony/Component/Validator/Tests/Mapping/Loader/PropertyInfoLoaderTest.php index 71b2691ee5..f87b19f795 100644 --- a/src/Symfony/Component/Validator/Tests/Mapping/Loader/PropertyInfoLoaderTest.php +++ b/src/Symfony/Component/Validator/Tests/Mapping/Loader/PropertyInfoLoaderTest.php @@ -46,6 +46,7 @@ class PropertyInfoLoaderTest extends TestCase 'alreadyMappedNotBlank', 'alreadyPartiallyMappedCollection', 'readOnly', + 'nonExistentField', ]) ; $propertyInfoStub