protected function setUp()
 {
     $this->containerName = 'PdTests_MakeTests_BuilderTest';
     $this->className = 'PdTests_stubs_Dummy';
     $container = Pd_Container::get($this->containerName);
     // the map
     $map = new Pd_Map();
     $item = new Pd_Map_Item();
     $item->setDependencyName('Apple');
     $item->setInjectAs('setApple');
     $item->setInjectWith('method');
     $map->add($item);
     $item = new Pd_Map_Item();
     $item->setDependencyName('Banana');
     $item->setInjectWith('constructor');
     $map->add($item);
     $container->maps()->set($this->className, $map);
     // the dependencies
     $container->dependencies()->set('Apple', 'red');
     $container->dependencies()->set('Banana', 'it was built!');
     // construct it
     $this->builder = new Pd_Make_Constructor();
     $this->builder->setContainer($container);
     $this->builder->setClassName($this->className);
 }
Beispiel #2
0
 public function testItemsFor()
 {
     $item = new Pd_Map_Item();
     $item->setDependencyName('abc');
     $item->setInjectAs('abc');
     $item->setInjectWith('test');
     $this->map->add($item);
     $items = $this->map->itemsFor('test');
     $this->assertEquals($items[0]->dependencyName(), 'abc');
 }