/**
  * @dataProvider extractorsDataProvider
  *
  * @param $class
  * @param $extractor
  * @param $properties
  */
 public function testExtractors($class, $extractor, $properties)
 {
     /** @var TypeExtractorInterface|DescriptionExtractorInterface $extractor */
     $extractor = new $extractor();
     $propertyInfo = new PropertyInfo([$extractor], [$extractor]);
     foreach ($properties as $property) {
         $reflectionProperty = new \ReflectionProperty($class, $property['name']);
         $expectedType = $property['type'];
         /** @var Type[] $actualTypes */
         $actualTypes = $propertyInfo->getTypes($reflectionProperty);
         $actualType = $actualTypes[0];
         if (isset($property['short_description'])) {
             $this->assertEquals($property['short_description'], $propertyInfo->getShortDescription($reflectionProperty));
         }
         if (isset($property['long_description'])) {
             $this->assertEquals($property['long_description'], $propertyInfo->getLongDescription($reflectionProperty));
         }
         if ($expectedType !== null) {
             $this->assertEquals($expectedType, $actualType->getType());
             $this->assertEquals($property['class'], $actualType->getClass());
             $this->assertEquals($property['collection'], $actualType->isCollection());
             if (isset($property['collectionType'])) {
                 $actualCollectionType = $actualType->getCollectionType();
                 $this->assertEquals($property['collectionType']['type'], $actualCollectionType->getType());
                 $this->assertEquals($property['collectionType']['class'], $actualCollectionType->getClass());
                 $this->assertEquals($property['collectionType']['collection'], $actualCollectionType->isCollection());
             }
         } else {
             $this->assertNull($actualType);
         }
     }
 }
 /**
  * @dataProvider extractorsDataProvider
  *
  * @param $class
  * @param $extractor
  * @param $properties
  */
 public function testExtractors($class, $extractor, $properties)
 {
     $config = Setup::createAnnotationMetadataConfiguration([__DIR__], true);
     $entityManager = EntityManager::create(['driver' => 'pdo_sqlite'], $config);
     /** @var TypeExtractorInterface $extractor */
     $extractor = new $extractor($entityManager->getMetadataFactory());
     $propertyInfo = new PropertyInfo([$extractor], []);
     foreach ($properties as $property) {
         $reflectionProperty = new \ReflectionProperty($class, $property['name']);
         $expectedType = $property['type'];
         /** @var Type[] $actualTypes */
         $actualTypes = $propertyInfo->getTypes($reflectionProperty);
         $actualType = $actualTypes[0];
         if ($expectedType !== null) {
             $this->assertEquals($expectedType, $actualType->getType());
             $this->assertEquals($property['class'], $actualType->getClass());
             $this->assertEquals($property['collection'], $actualType->isCollection());
             if (isset($property['collectionType'])) {
                 $actualCollectionType = $actualType->getCollectionType();
                 $this->assertEquals($property['collectionType']['type'], $actualCollectionType->getType());
                 $this->assertEquals($property['collectionType']['class'], $actualCollectionType->getClass());
                 $this->assertEquals($property['collectionType']['collection'], $actualCollectionType->isCollection());
             }
         } else {
             $this->assertNull($actualType);
         }
     }
 }
 /**
  * @dataProvider extractorsDataProvider
  *
  * @param $class
  * @param $extractor
  * @param $properties
  */
 public function testExtractors($class, $extractor, $properties)
 {
     $extractor = new $extractor();
     $propertyInfo = new PropertyInfo([$extractor], []);
     foreach ($properties as $property) {
         $expectedType = $property['type'];
         $actualTypes = $propertyInfo->getTypes(new \ReflectionProperty($class, $property['name']));
         if (null !== $actualTypes) {
             $this->assertCount(1, $actualTypes);
             $actualType = $actualTypes[0];
             $this->assertEquals($expectedType, $actualType->getType());
             if (!empty($property['class'])) {
                 $this->assertEquals($property['class'], $actualType->getClass());
             }
         } else {
             $this->fail(vsprintf('Using "%1$s" type "%2$s" resulted in an empty type list', [get_class($extractor), $expectedType]));
         }
     }
 }
 public function testGetProperties()
 {
     $this->assertEquals(array('a', 'b'), $this->propertyInfo->getProperties('Foo'));
 }