public function add($item) { $this->validateItem($item, $this->type); $items = $this->items; $items[] = $item; $col = new static($this->type); $col->setItemsFromTrustedSource($items); return $col; }
/** * @expectedException Collections\Exceptions\InvalidArgumentException */ public function test_adding_wrong_class_triggers_error() { $col = new Collection('TestClassA'); $col->add(new TestClassB()); }