/** * @test * @dataProvider collectionTypes * @param string $type */ public function isMultiValuedPropertyReturnsTrueForCollectionTypes($type) { $classSchema = new \TYPO3\FLOW3\Reflection\ClassSchema('SomeClass'); $classSchema->addProperty('testProperty', $type); $this->assertTrue($classSchema->isMultiValuedProperty('testProperty')); }
/** * Builds class schemata from classes annotated as entities or value objects * * @param array $classNames * @return void */ protected function buildClassSchemata(array $classNames) { foreach ($classNames as $className) { $classSchema = new \TYPO3\FLOW3\Reflection\ClassSchema($className); if ($this->isClassAnnotatedWith($className, 'TYPO3\\FLOW3\\Annotations\\Entity') || $this->isClassAnnotatedWith($className, 'Doctrine\\ORM\\Mapping\\Entity')) { $classSchema->setModelType(\TYPO3\FLOW3\Reflection\ClassSchema::MODELTYPE_ENTITY); $classSchema->setLazyLoadableObject($this->isClassAnnotatedWith($className, 'TYPO3\\FLOW3\\Annotations\\Lazy')); $possibleRepositoryClassName = str_replace('\\Model\\', '\\Repository\\', $className) . 'Repository'; if ($this->isClassReflected($possibleRepositoryClassName) === TRUE) { $classSchema->setRepositoryClassName($possibleRepositoryClassName); } } elseif ($this->isClassAnnotatedWith($className, 'TYPO3\\FLOW3\\Annotations\\ValueObject')) { $this->checkValueObjectRequirements($className); $classSchema->setModelType(\TYPO3\FLOW3\Reflection\ClassSchema::MODELTYPE_VALUEOBJECT); } $this->addPropertiesToClassSchema($classSchema); $this->classSchemata[$className] = $classSchema; } $this->completeRepositoryAssignments(); $this->ensureAggregateRootInheritanceChainConsistency(); }
/** * @test */ public function mapSplObjectStorageCreatesSplObjectStorage() { $objectData = array(array('value' => array('mappedObject1')), array('value' => array('mappedObject2'))); $classSchema = new \TYPO3\FLOW3\Reflection\ClassSchema('TYPO3\\Post'); $classSchema->addProperty('firstProperty', 'SplObjectStorage'); $dataMapper = $this->getAccessibleMock('TYPO3\\FLOW3\\Persistence\\Generic\\DataMapper', array('mapToObject')); $dataMapper->expects($this->at(0))->method('mapToObject')->with($objectData[0]['value'])->will($this->returnValue(new \stdClass())); $dataMapper->expects($this->at(1))->method('mapToObject')->with($objectData[1]['value'])->will($this->returnValue(new \stdClass())); $dataMapper->_call('mapSplObjectStorage', $objectData); }