aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2017-05-31 11:48:42 +0200
committerGitHub <noreply@github.com>2017-05-31 11:48:42 +0200
commitd61fd8be4ffdbba8d0fd02468075602a26dfde1a (patch)
tree6cd4aa0f3e236299d963c26fb3a17ba3b4dfc34e /tests
parent3f8578ded3d8f5d1a987abc50064c8e97bb96f2e (diff)
parent31485bddb98a2a1b434e62e02ffd79614eca9db8 (diff)
downloadwallabag-d61fd8be4ffdbba8d0fd02468075602a26dfde1a.tar.gz
wallabag-d61fd8be4ffdbba8d0fd02468075602a26dfde1a.tar.zst
wallabag-d61fd8be4ffdbba8d0fd02468075602a26dfde1a.zip
Merge pull request #3138 from Kdecherf/2835-tags
Ignore ActionMarkAsRead when removing tag from entry
Diffstat (limited to 'tests')
-rw-r--r--tests/Wallabag/CoreBundle/Controller/TagControllerTest.php10
-rw-r--r--tests/Wallabag/CoreBundle/Helper/RedirectTest.php18
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php b/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php
index c3b22dcd..80611a87 100644
--- a/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/TagControllerTest.php
@@ -126,9 +126,19 @@ class TagControllerTest extends WallabagCoreTestCase
126 ->getRepository('WallabagCoreBundle:Tag') 126 ->getRepository('WallabagCoreBundle:Tag')
127 ->findOneByEntryAndTagLabel($entry, $this->tagName); 127 ->findOneByEntryAndTagLabel($entry, $this->tagName);
128 128
129 // We make a first request to set an history and test redirection after tag deletion
130 $client->request('GET', '/view/'.$entry->getId());
131 $entryUri = $client->getRequest()->getUri();
129 $client->request('GET', '/remove-tag/'.$entry->getId().'/'.$tag->getId()); 132 $client->request('GET', '/remove-tag/'.$entry->getId().'/'.$tag->getId());
130 133
131 $this->assertEquals(302, $client->getResponse()->getStatusCode()); 134 $this->assertEquals(302, $client->getResponse()->getStatusCode());
135 $this->assertEquals($entryUri, $client->getResponse()->getTargetUrl());
136
137 // re-retrieve the entry to be sure to get fresh data from database (mostly for tags)
138 $entry = $client->getContainer()
139 ->get('doctrine.orm.entity_manager')
140 ->getRepository('WallabagCoreBundle:Entry')
141 ->findByUrlAndUserId('http://0.0.0.0/entry1', $this->getLoggedInUserId());
132 142
133 $this->assertNotContains($this->tagName, $entry->getTags()); 143 $this->assertNotContains($this->tagName, $entry->getTags());
134 144
diff --git a/tests/Wallabag/CoreBundle/Helper/RedirectTest.php b/tests/Wallabag/CoreBundle/Helper/RedirectTest.php
index 0539f20a..f420d06a 100644
--- a/tests/Wallabag/CoreBundle/Helper/RedirectTest.php
+++ b/tests/Wallabag/CoreBundle/Helper/RedirectTest.php
@@ -89,4 +89,22 @@ class RedirectTest extends \PHPUnit_Framework_TestCase
89 89
90 $this->assertEquals($this->routerMock->generate('homepage'), $redirectUrl); 90 $this->assertEquals($this->routerMock->generate('homepage'), $redirectUrl);
91 } 91 }
92
93 public function testUserForRedirectWithIgnoreActionMarkAsRead()
94 {
95 $this->token->getUser()->getConfig()->setActionMarkAsRead(Config::REDIRECT_TO_HOMEPAGE);
96
97 $redirectUrl = $this->redirect->to('/unread/list', '', true);
98
99 $this->assertEquals('/unread/list', $redirectUrl);
100 }
101
102 public function testUserForRedirectNullWithFallbackWithIgnoreActionMarkAsRead()
103 {
104 $this->token->getUser()->getConfig()->setActionMarkAsRead(Config::REDIRECT_TO_HOMEPAGE);
105
106 $redirectUrl = $this->redirect->to(null, 'fallback', true);
107
108 $this->assertEquals('fallback', $redirectUrl);
109 }
92} 110}