aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag/CoreBundle/Helper/RedirectTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Wallabag/CoreBundle/Helper/RedirectTest.php')
-rw-r--r--tests/Wallabag/CoreBundle/Helper/RedirectTest.php34
1 files changed, 26 insertions, 8 deletions
diff --git a/tests/Wallabag/CoreBundle/Helper/RedirectTest.php b/tests/Wallabag/CoreBundle/Helper/RedirectTest.php
index 0539f20a..7fd2ea2b 100644
--- a/tests/Wallabag/CoreBundle/Helper/RedirectTest.php
+++ b/tests/Wallabag/CoreBundle/Helper/RedirectTest.php
@@ -2,11 +2,11 @@
2 2
3namespace Tests\Wallabag\CoreBundle\Helper; 3namespace Tests\Wallabag\CoreBundle\Helper;
4 4
5use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
6use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
5use Wallabag\CoreBundle\Entity\Config; 7use Wallabag\CoreBundle\Entity\Config;
6use Wallabag\UserBundle\Entity\User;
7use Wallabag\CoreBundle\Helper\Redirect; 8use Wallabag\CoreBundle\Helper\Redirect;
8use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; 9use Wallabag\UserBundle\Entity\User;
9use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
10 10
11class RedirectTest extends \PHPUnit_Framework_TestCase 11class RedirectTest extends \PHPUnit_Framework_TestCase
12{ 12{
@@ -56,21 +56,21 @@ class RedirectTest extends \PHPUnit_Framework_TestCase
56 { 56 {
57 $redirectUrl = $this->redirect->to(null, 'fallback'); 57 $redirectUrl = $this->redirect->to(null, 'fallback');
58 58
59 $this->assertEquals('fallback', $redirectUrl); 59 $this->assertSame('fallback', $redirectUrl);
60 } 60 }
61 61
62 public function testRedirectToNullWithoutFallback() 62 public function testRedirectToNullWithoutFallback()
63 { 63 {
64 $redirectUrl = $this->redirect->to(null); 64 $redirectUrl = $this->redirect->to(null);
65 65
66 $this->assertEquals($this->routerMock->generate('homepage'), $redirectUrl); 66 $this->assertSame($this->routerMock->generate('homepage'), $redirectUrl);
67 } 67 }
68 68
69 public function testRedirectToValidUrl() 69 public function testRedirectToValidUrl()
70 { 70 {
71 $redirectUrl = $this->redirect->to('/unread/list'); 71 $redirectUrl = $this->redirect->to('/unread/list');
72 72
73 $this->assertEquals('/unread/list', $redirectUrl); 73 $this->assertSame('/unread/list', $redirectUrl);
74 } 74 }
75 75
76 public function testWithNotLoggedUser() 76 public function testWithNotLoggedUser()
@@ -78,7 +78,7 @@ class RedirectTest extends \PHPUnit_Framework_TestCase
78 $redirect = new Redirect($this->routerMock, new TokenStorage()); 78 $redirect = new Redirect($this->routerMock, new TokenStorage());
79 $redirectUrl = $redirect->to('/unread/list'); 79 $redirectUrl = $redirect->to('/unread/list');
80 80
81 $this->assertEquals('/unread/list', $redirectUrl); 81 $this->assertSame('/unread/list', $redirectUrl);
82 } 82 }
83 83
84 public function testUserForRedirectToHomepage() 84 public function testUserForRedirectToHomepage()
@@ -87,6 +87,24 @@ class RedirectTest extends \PHPUnit_Framework_TestCase
87 87
88 $redirectUrl = $this->redirect->to('/unread/list'); 88 $redirectUrl = $this->redirect->to('/unread/list');
89 89
90 $this->assertEquals($this->routerMock->generate('homepage'), $redirectUrl); 90 $this->assertSame($this->routerMock->generate('homepage'), $redirectUrl);
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->assertSame('/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->assertSame('fallback', $redirectUrl);
91 } 109 }
92} 110}