public function setup() { $this->container = new InjectorFactoryContainer(); $constructor = new Constructor('class1', 'NewConstructorTest_class1'); $this->container->addConstructor($constructor); $constructor = new Constructor('class2', 'NewConstructorTest_class2'); $constructor->addParameter(new Fixed('parameter1', 'value1')); $this->container->addConstructor($constructor); $constructor = new Constructor('class2b', 'NewConstructorTest_class2'); $constructor->addParameter(new Container('parameter1', 'NewConstructorTest_class2b-parameter1')); $this->container->addConstructor($constructor); $this->container->set('NewConstructorTest_class2b-parameter1', 'value2'); $constructor = new Constructor('class2c', 'NewConstructorTest_class2'); $constructor->addParameter(new Closure('parameter1', function () { return 'value3'; })); $this->container->addConstructor($constructor); $constructor = new Constructor('NewConstructorTest_prefix_'); $this->container->addConstructor($constructor); }
public function setup() { $this->container = new InjectorFactoryContainer(); $this->container->addConstructor(new Constructor('objectA', 'ConstructorTest_a', true)); $this->container->addConstructor(new Constructor('objectB', 'ConstructorTest_b', false)); #$this->container->registerConstructor('objectA', 'ConstructorTest_a', true); #$this->container->registerConstructor('objectB', 'ConstructorTest_b', false); $constructorC = new Constructor('objectC', 'ConstructorTest_c'); $constructorC->addParameter(new Fixed('testProperty', 'c')); $this->container->addConstructor($constructorC); $constructorC = new Constructor('objectD', 'ConstructorTest_d'); $constructorC->addParameter(new Container('testProperty', 'testPropertyForD')); $this->container->set('testPropertyForD', 'd'); $this->container->addConstructor($constructorC); $this->container->addConstructor(new Constructor('objectE', 'ConstructorTest_e')); $this->container->addConstructor(new Constructor('objectF', 'ConstructorTest_f')); $this->container->addConstructor(new Constructor('objectG', 'ConstructorTest_g')); $this->container->addConstructor(new Constructor('view/', 'View__')); $constructorI = new Constructor('objectI', 'ConstructorTest_i'); $constructorI->addPostInstantiationClosure(function ($object, $container) { $object->setPropertyA(1); $object->setPropertyB(2); }); $this->container->addConstructor($constructorI); }