/** * Store a new or existing tag * * @access public * @return boolean the result true if sucessful * @param QuickTag\Model\StoredTag $tag * @throws QuickTag\QuickTagException if database operation fails */ public function storeTag(StoredTag $tag) { $result = $this->mapper->save($tag); $this->event->dispatch(TagEventsMap::STORE, new TagStoreEvent($result, $tag)); return $result; }
/** * @expectedException QuickTag\QuickTagException * @expectedExceptionMessage SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'tag_title' cannot be null */ public function testSaveWithError() { $gateway = $this->getTableGateway(); $event = $this->getMock('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface'); $mapper = new TagMapper($event, $gateway); $tag = new StoredTag(); $tag->setUserContext(1); $tag->setWeight(1); $result = $mapper->save($tag); }