public function testInit() { $col = new ItemCollection(); $it = new ItemFactory(); $col->setName("test"); $col->setItemFactory($it); $col->addItem("foo", "bar", "foo"); $col->foo2 = $it->make('foo2', 'bar', 'Foo2'); $this->assertEquals($col->foo->value, $col['foo2']['value']); return $col; }
/** * creates a new instance of the ItemCollection * @return RicAnthonyLee\Itemizer\ItemCollection **/ public function make($name, $value = false, $alias = false) { $collection = new ItemCollection(); $collection->setName($name); if ($value) { $collection->setItem($value); } if ($alias) { $collection->setAlias($alias); } return $collection; }