/**
  * @test
  * @author Robert Lemke <*****@*****.**>
  */
 public function allBasicOptionsAreSetCorrectly()
 {
     $factoryClassName = uniqid('ConfigurationBuilderTest');
     eval('class ' . $factoryClassName . ' { public function manufacture() {} } ');
     $configurationArray = array();
     $configurationArray['scope'] = 'prototype';
     $configurationArray['className'] = __CLASS__;
     $configurationArray['factoryClassName'] = $factoryClassName;
     $configurationArray['factoryMethodName'] = 'manufacture';
     $configurationArray['lifecycleInitializationMethodName'] = 'initializationMethod';
     $configurationArray['lifecycleShutdownMethodName'] = 'shutdownMethod';
     $configurationArray['autowiring'] = FALSE;
     $objectConfiguration = new \F3\FLOW3\Object\Configuration\Configuration('TestObject', __CLASS__);
     $objectConfiguration->setScope(\F3\FLOW3\Object\Configuration\Configuration::SCOPE_PROTOTYPE);
     $objectConfiguration->setClassName(__CLASS__);
     $objectConfiguration->setFactoryClassName($factoryClassName);
     $objectConfiguration->setFactoryMethodName('manufacture');
     $objectConfiguration->setLifecycleInitializationMethodName('initializationMethod');
     $objectConfiguration->setLifecycleShutdownMethodName('shutdownMethod');
     $objectConfiguration->setAutowiring(FALSE);
     $builtObjectConfiguration = \F3\FLOW3\Object\Configuration\ConfigurationBuilder::buildFromConfigurationArray('TestObject', $configurationArray, __CLASS__);
     $this->assertEquals($objectConfiguration, $builtObjectConfiguration, 'The manually created and the built object configuration don\'t match.');
 }
 /**
  * @test
  * @author Robert Lemke <*****@*****.**>
  */
 public function createObjectUsesACustomFactoryForInstantiatingTheObjectIfOneWasSpecifiedInTheObjectConfiguration()
 {
     $className = uniqid('Foo');
     eval('namespace F3\\Virtual; class ' . $className . ' {}');
     $fullClassName = 'F3\\Virtual\\' . $className;
     $expectedObject = new \ArrayObject();
     $mockFactory = $this->getMock('MockFactory', array('createTheThing'));
     $mockFactory->expects($this->once())->method('createTheThing')->with('Argument No. 1', 'Argument No. 2')->will($this->returnValue($expectedObject));
     $this->mockObjectManager->expects($this->once())->method('getObject')->with(get_class($mockFactory))->will($this->returnValue($mockFactory));
     $objectConfiguration = new \F3\FLOW3\Object\Configuration\Configuration($fullClassName);
     $objectConfiguration->setFactoryClassName(get_class($mockFactory));
     $objectConfiguration->setFactoryMethodName('createTheThing');
     $objectConfiguration->setArguments(array(new \F3\FLOW3\Object\Configuration\ConfigurationArgument(1, 'Argument No. 1', \F3\FLOW3\Object\Configuration\ConfigurationArgument::ARGUMENT_TYPES_STRAIGHTVALUE), new \F3\FLOW3\Object\Configuration\ConfigurationArgument(2, 'Argument No. 2', \F3\FLOW3\Object\Configuration\ConfigurationArgument::ARGUMENT_TYPES_STRAIGHTVALUE)));
     $actualObject = $this->objectBuilder->createObject($fullClassName, $objectConfiguration);
     $this->assertSame($expectedObject, $actualObject);
 }