From 1bb1939ab76cfbf1cdb5fa1dccbdd15ba17cdfb0 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Tue, 29 Dec 2015 15:04:46 +0100 Subject: [PATCH] Cleanup tests - WallabagRestController: remove the tag deletion from the API since we can't remove a tag now, we only remove reference to entries - RuleBasedTaggerTest: remove workaround for asserting tag are equal since problem was related to mock expects (_call instead of findOneByLabel which was removed from the tag repository) --- src/Wallabag/ApiBundle/Controller/WallabagRestController.php | 4 ---- src/Wallabag/CoreBundle/Tests/Helper/RuleBasedTaggerTest.php | 3 +-- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php index c5df1e03..459c4172 100644 --- a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php +++ b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php @@ -337,10 +337,6 @@ class WallabagRestController extends FOSRestController ->getRepository('WallabagCoreBundle:Entry') ->removeTag($this->getUser()->getId(), $tag); - $em = $this->getDoctrine()->getManager(); - $em->remove($tag); - $em->flush(); - $json = $this->get('serializer')->serialize($tag, 'json'); return $this->renderJsonResponse($json); diff --git a/src/Wallabag/CoreBundle/Tests/Helper/RuleBasedTaggerTest.php b/src/Wallabag/CoreBundle/Tests/Helper/RuleBasedTaggerTest.php index cddc8b08..dee17d65 100644 --- a/src/Wallabag/CoreBundle/Tests/Helper/RuleBasedTaggerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Helper/RuleBasedTaggerTest.php @@ -98,7 +98,6 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase $user = $this->getUser([$taggingRule]); $entry = new Entry($user); $tag = new Tag(); - $tag->setLabel('foo'); $this->rulerz ->expects($this->once()) @@ -118,7 +117,7 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase $this->assertFalse($entry->getTags()->isEmpty()); $tags = $entry->getTags(); - $this->assertSame($tag->getLabel(), $tags[0]->getLabel()); + $this->assertSame($tag, $tags[0]); } public function testSameTagWithDifferentfMatchingRules() -- 2.41.0