/** * @covers \Netgen\TagsBundle\Core\Persistence\Legacy\Tags\Handler::deleteTag */ public function testDeleteTag() { $handler = $this->getTagsHandler(array('loadTagInfo', 'updateSubtreeModificationTime')); $handler->expects($this->once())->method('loadTagInfo')->with(40)->will($this->returnValue(new TagInfo(array('id' => 40, 'parentTagId' => 21)))); $this->gateway->expects($this->once())->method('deleteTag')->with(40); $handler->deleteTag(40); }
/** * Updated subtree modification time for all tags in path. * * @throws \RuntimeException * * @param string $pathString * @param int $timestamp */ public function updateSubtreeModificationTime($pathString, $timestamp = null) { try { $this->innerGateway->updateSubtreeModificationTime($pathString, $timestamp); } catch (DBALException $e) { throw new RuntimeException('Database error', 0, $e); } catch (PDOException $e) { throw new RuntimeException('Database error', 0, $e); } }
/** * Updated subtree modification time for tag and all its parents. * * If tag is a synonym, subtree modification time of its main tag is updated * * @param mixed $tagId * @param int $timestamp */ protected function updateSubtreeModificationTime($tagId, $timestamp = null) { if ($tagId > 0) { $tagInfo = $this->loadTagInfo($tagId); $timestamp = $timestamp ?: time(); $this->gateway->updateSubtreeModificationTime($tagInfo->pathString, $timestamp); if ($tagInfo->mainTagId > 0) { $this->gateway->updateSubtreeModificationTime((string) $tagInfo->mainTagId, $timestamp); } } }