From 00cdec9ea2dee0a8b02ccd40d77af7ade584f33c Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 9 Feb 2018 19:31:25 +0100 Subject: [PATCH] [PropertyInfo] fix tests --- .../Tests/Extractors/PhpDocExtractorTest.php | 54 +++++++++---------- .../Extractors/ReflectionExtractorTest.php | 4 +- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractors/PhpDocExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractors/PhpDocExtractorTest.php index a888ab03fb..38a9ff9e63 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Extractors/PhpDocExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Extractors/PhpDocExtractorTest.php @@ -40,31 +40,6 @@ class PhpDocExtractorTest extends TestCase $this->assertSame($longDescription, $this->extractor->getLongDescription('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', $property)); } - public function testParamTagTypeIsOmitted() - { - $this->assertNull($this->extractor->getTypes(OmittedParamTagTypeDocBlock::class, 'omittedType')); - } - - /** - * @dataProvider typesWithCustomPrefixesProvider - */ - public function testExtractTypesWithCustomPrefixes($property, array $type = null) - { - $customExtractor = new PhpDocExtractor(null, array('add', 'remove'), array('is', 'can')); - - $this->assertEquals($type, $customExtractor->getTypes('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', $property)); - } - - /** - * @dataProvider typesWithNoPrefixesProvider - */ - public function testExtractTypesWithNoPrefixes($property, array $type = null) - { - $noPrefixExtractor = new PhpDocExtractor(null, array(), array(), array()); - - $this->assertEquals($type, $noPrefixExtractor->getTypes('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', $property)); - } - public function typesProvider() { return array( @@ -102,6 +77,21 @@ class PhpDocExtractorTest extends TestCase ); } + public function testParamTagTypeIsOmitted() + { + $this->assertNull($this->extractor->getTypes(OmittedParamTagTypeDocBlock::class, 'omittedType')); + } + + /** + * @dataProvider typesWithCustomPrefixesProvider + */ + public function testExtractTypesWithCustomPrefixes($property, array $type = null) + { + $customExtractor = new PhpDocExtractor(null, array('add', 'remove'), array('is', 'can')); + + $this->assertEquals($type, $customExtractor->getTypes('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', $property)); + } + public function typesWithCustomPrefixesProvider() { return array( @@ -130,13 +120,23 @@ class PhpDocExtractorTest extends TestCase array('d', array(new Type(Type::BUILTIN_TYPE_BOOL)), null, null), array('e', array(new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_RESOURCE))), null, null), array('f', array(new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_OBJECT, false, 'DateTime'))), null, null), - array('g', array(new Type(Type::BUILTIN_TYPE_ARRAY, true, null, true)), 'Nullable array.', null), + array('g', null), array('donotexist', null, null, null), array('staticGetter', null, null, null), array('staticSetter', null, null, null), ); } + /** + * @dataProvider typesWithNoPrefixesProvider + */ + public function testExtractTypesWithNoPrefixes($property, array $type = null) + { + $noPrefixExtractor = new PhpDocExtractor(null, array(), array(), array()); + + $this->assertEquals($type, $noPrefixExtractor->getTypes('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy', $property)); + } + public function typesWithNoPrefixesProvider() { return array( @@ -165,7 +165,7 @@ class PhpDocExtractorTest extends TestCase array('d', null, null, null), array('e', null, null, null), array('f', null, null, null), - array('g', array(new Type(Type::BUILTIN_TYPE_ARRAY, true, null, true)), 'Nullable array.', null), + array('g', null), array('donotexist', null, null, null), array('staticGetter', null, null, null), array('staticSetter', null, null, null), diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractors/ReflectionExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractors/ReflectionExtractorTest.php index db78dd7a4e..1acb48f355 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Extractors/ReflectionExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Extractors/ReflectionExtractorTest.php @@ -73,7 +73,7 @@ class ReflectionExtractorTest extends TestCase 'collection', 'B', 'Guid', - 'g', + 'array', 'emptyVar', 'foo', 'foo2', @@ -101,7 +101,7 @@ class ReflectionExtractorTest extends TestCase 'collection', 'B', 'Guid', - 'g', + 'array', 'emptyVar', 'foo', 'foo2',