/** * @test */ public function allBasicOptionsAreSetCorrectly() { $factoryObjectName = 'ConfigurationBuilderTest' . md5(uniqid(mt_rand(), TRUE)); eval('class ' . $factoryObjectName . ' { public function manufacture() {} } '); $configurationArray = array(); $configurationArray['scope'] = 'prototype'; $configurationArray['className'] = __CLASS__; $configurationArray['factoryObjectName'] = $factoryObjectName; $configurationArray['factoryMethodName'] = 'manufacture'; $configurationArray['lifecycleInitializationMethodName'] = 'initializationMethod'; $configurationArray['lifecycleShutdownMethodName'] = 'shutdownMethod'; $configurationArray['autowiring'] = FALSE; $objectConfiguration = new \TYPO3\Flow\Object\Configuration\Configuration('TestObject', __CLASS__); $objectConfiguration->setScope(\TYPO3\Flow\Object\Configuration\Configuration::SCOPE_PROTOTYPE); $objectConfiguration->setClassName(__CLASS__); $objectConfiguration->setFactoryObjectName($factoryObjectName); $objectConfiguration->setFactoryMethodName('manufacture'); $objectConfiguration->setLifecycleInitializationMethodName('initializationMethod'); $objectConfiguration->setLifecycleShutdownMethodName('shutdownMethod'); $objectConfiguration->setAutowiring(\TYPO3\Flow\Object\Configuration\Configuration::AUTOWIRING_MODE_OFF); $configurationBuilder = $this->getAccessibleMock('TYPO3\\Flow\\Object\\Configuration\\ConfigurationBuilder', array('dummy')); $builtObjectConfiguration = $configurationBuilder->_call('parseConfigurationArray', 'TestObject', $configurationArray, __CLASS__); $this->assertEquals($objectConfiguration, $builtObjectConfiguration, 'The manually created and the built object configuration don\'t match.'); }
/** * @test */ public function setFactoryObjectNameAcceptsValidClassNames() { $this->objectConfiguration->setFactoryObjectName(__CLASS__); $this->assertSame(__CLASS__, $this->objectConfiguration->getFactoryObjectName()); }
/** * @test * @expectedException TYPO3\Flow\Object\Exception\InvalidClassException */ public function setFactoryObjectNameRejectsNamesOfNonExistingNlasses() { $this->objectConfiguration->setFactoryObjectName('TYPO3\\Virtual\\NonExistingClass'); }