diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-06-23 09:18:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-23 09:18:18 +0200 |
commit | d37bb05c881bfdbeb1144b327edd4dcc2cbb163f (patch) | |
tree | 1b90f7e733a83af4741a8cb7f49edf3e303f8677 /src/Wallabag/CoreBundle/Tests/Helper/RedirectTest.php | |
parent | 891a026e31ad54ca90b70f6026f23260cfadb7fd (diff) | |
parent | 99451fe4b76051d61922a6beb7ee9e79cc6e7893 (diff) | |
download | wallabag-d37bb05c881bfdbeb1144b327edd4dcc2cbb163f.tar.gz wallabag-d37bb05c881bfdbeb1144b327edd4dcc2cbb163f.tar.zst wallabag-d37bb05c881bfdbeb1144b327edd4dcc2cbb163f.zip |
Merge pull request #2132 from wallabag/sf3.1
Jump to Symfony 3.1
Diffstat (limited to 'src/Wallabag/CoreBundle/Tests/Helper/RedirectTest.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Tests/Helper/RedirectTest.php | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/src/Wallabag/CoreBundle/Tests/Helper/RedirectTest.php b/src/Wallabag/CoreBundle/Tests/Helper/RedirectTest.php deleted file mode 100644 index f4aecc80..00000000 --- a/src/Wallabag/CoreBundle/Tests/Helper/RedirectTest.php +++ /dev/null | |||
@@ -1,55 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Tests\Helper; | ||
4 | |||
5 | use Wallabag\CoreBundle\Helper\Redirect; | ||
6 | |||
7 | class RedirectTest extends \PHPUnit_Framework_TestCase | ||
8 | { | ||
9 | /** @var \PHPUnit_Framework_MockObject_MockObject */ | ||
10 | private $routerMock; | ||
11 | |||
12 | /** @var Redirect */ | ||
13 | private $redirect; | ||
14 | |||
15 | public function setUp() | ||
16 | { | ||
17 | $this->routerMock = $this->getRouterMock(); | ||
18 | $this->redirect = new Redirect($this->routerMock); | ||
19 | } | ||
20 | |||
21 | public function testRedirectToNullWithFallback() | ||
22 | { | ||
23 | $redirectUrl = $this->redirect->to(null, 'fallback'); | ||
24 | |||
25 | $this->assertEquals('fallback', $redirectUrl); | ||
26 | } | ||
27 | |||
28 | public function testRedirectToNullWithoutFallback() | ||
29 | { | ||
30 | $redirectUrl = $this->redirect->to(null); | ||
31 | |||
32 | $this->assertEquals($this->routerMock->generate('homepage'), $redirectUrl); | ||
33 | } | ||
34 | |||
35 | public function testRedirectToValidUrl() | ||
36 | { | ||
37 | $redirectUrl = $this->redirect->to('/unread/list'); | ||
38 | |||
39 | $this->assertEquals('/unread/list', $redirectUrl); | ||
40 | } | ||
41 | |||
42 | private function getRouterMock() | ||
43 | { | ||
44 | $mock = $this->getMockBuilder('Symfony\Component\Routing\Router') | ||
45 | ->disableOriginalConstructor() | ||
46 | ->getMock(); | ||
47 | |||
48 | $mock->expects($this->any()) | ||
49 | ->method('generate') | ||
50 | ->with('homepage') | ||
51 | ->willReturn('homepage'); | ||
52 | |||
53 | return $mock; | ||
54 | } | ||
55 | } | ||