public function testUnsetAttribute() { $template = new template\tag(uniqid()); $template->setAttribute('id', $id = uniqid()); $this->assert->string($template->getId())->isEqualTo($id)->object($template->unsetAttribute('id'))->isIdenticalTo($template)->variable($template->getId())->isNull()->exception(function () use($template, &$attribute) { $template->unsetAttribute($attribute = uniqid()); })->isInstanceOf('mageekguy\\atoum\\exceptions\\logic')->hasMessage('Attribute \'' . $attribute . '\' is unknown'); }
public function testCurrent() { $iterator = new template\iterator(); $this->assert->boolean($iterator->valid())->isFalse()->variable($iterator->current())->isNull(); $template = new atoum\template(); $template->addChild($tag = new template\tag(uniqid())); $iterator->addTag($tag->getTag(), $template); $this->assert->boolean($iterator->valid())->isTrue()->object($iterator->current())->isIdenticalTo($tag); $iterator->next(); $this->assert->boolean($iterator->valid())->isFalse()->variable($iterator->current())->isNull(); }
public function testSetParent() { $data = new template\data(); $this->assert->object($data->setParent($tag = new template\tag(uniqid())))->isIdenticalTo($data)->object($data->getParent())->isIdenticalTo($tag)->object($tag->getChild(0))->isIdenticalTo($data); }
public function testGetById() { $template = new atoum\template(); $this->assert->variable($template->getById(uniqid()))->isNull(); $tag = new atoum\template\tag(uniqid()); $template->addChild($tag->setId($id = uniqid())); $this->assert->variable($template->getById(uniqid()))->isNull()->object($template->getById($id))->isIdenticalTo($tag); $childTag = new atoum\template\tag(uniqid()); $tag->addChild($childTag->setId($childId = uniqid())); $this->assert->variable($template->getById(uniqid()))->isNull()->object($template->getById($id))->isIdenticalTo($tag)->object($tag->getById($id))->isIdenticalTo($tag)->object($template->getById($childId))->isIdenticalTo($childTag)->object($tag->getById($childId))->isIdenticalTo($childTag)->object($childTag->getById($childId))->isIdenticalTo($childTag)->variable($childTag->getById($id, false))->isNull(); }
public function testGetById() { $this->if($this->newTestedInstance)->then->variable($this->testedInstance->getById(uniqid()))->isNull()->if($tag = new atoum\template\tag(uniqid()), $this->testedInstance->addChild($tag->setId($id = uniqid())))->then->variable($this->testedInstance->getById(uniqid()))->isNull()->object($this->testedInstance->getById($id))->isIdenticalTo($tag)->if($childTag = new atoum\template\tag(uniqid()), $tag->addChild($childTag->setId($childId = uniqid())))->then->variable($this->testedInstance->getById(uniqid()))->isNull()->object($this->testedInstance->getById($id))->isIdenticalTo($tag)->object($tag->getById($id))->isIdenticalTo($tag)->object($this->testedInstance->getById($childId))->isIdenticalTo($childTag)->object($tag->getById($childId))->isIdenticalTo($childTag)->object($childTag->getById($childId))->isIdenticalTo($childTag)->variable($childTag->getById($id, false))->isNull(); }