mirror of
https://github.com/wallabag/wallabag.git
synced 2025-08-01 17:38:38 +00:00
parent
2984c0dfcc
commit
4feca1ccd5
3 changed files with 75 additions and 0 deletions
|
@ -141,6 +141,53 @@ class TagControllerTest extends WallabagCoreTestCase
|
|||
$this->assertNull($tag, $this->tagName . ' was removed because it begun an orphan tag');
|
||||
}
|
||||
|
||||
public function testRemoveTag()
|
||||
{
|
||||
$this->logInAs('admin');
|
||||
$client = $this->getClient();
|
||||
|
||||
$tag = new Tag();
|
||||
$tag->setLabel($this->tagName);
|
||||
|
||||
$entry = new Entry($this->getLoggedInUser());
|
||||
$entry->setUrl('http://0.0.0.0/foo');
|
||||
$entry->addTag($tag);
|
||||
$this->getEntityManager()->persist($entry);
|
||||
|
||||
$entry2 = new Entry($this->getLoggedInUser());
|
||||
$entry2->setUrl('http://0.0.0.0/bar');
|
||||
$entry2->addTag($tag);
|
||||
$this->getEntityManager()->persist($entry2);
|
||||
$this->getEntityManager()->flush();
|
||||
$this->getEntityManager()->clear();
|
||||
|
||||
$client->request('GET', '/tag/delete/' . $tag->getSlug());
|
||||
|
||||
$tag = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->getRepository('WallabagCoreBundle:Tag')
|
||||
->findOneByLabel($this->tagName);
|
||||
|
||||
$this->assertNull($tag, $this->tagName . ' was removed because it begun an orphan tag');
|
||||
|
||||
$user = $this->getEntityManager()
|
||||
->getRepository('WallabagUserBundle:User')
|
||||
->findOneByUserName('admin');
|
||||
|
||||
$entry = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->getRepository('WallabagCoreBundle:Entry')
|
||||
->findByUrlAndUserId('http://0.0.0.0/foo', $user->getId());
|
||||
|
||||
$entry2 = $client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->getRepository('WallabagCoreBundle:Entry')
|
||||
->findByUrlAndUserId('http://0.0.0.0/bar', $user->getId());
|
||||
|
||||
$this->assertEmpty($entry->getTagsLabel());
|
||||
$this->assertEmpty($entry2->getTagsLabel());
|
||||
}
|
||||
|
||||
public function testShowEntriesForTagAction()
|
||||
{
|
||||
$this->logInAs('admin');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue