aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas.loeuillet@gmail.com>2013-08-03 19:26:54 +0200
committerNicolas LÅ“uillet <nicolas.loeuillet@gmail.com>2013-08-03 19:26:54 +0200
commit4f5b44bd3bd490309eb2ba7b44df4769816ba729 (patch)
tree6cefe170dfe0a5a361cb1e2d1fc4d580a3316d02 /vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php
parent2b840e0cfb63a453bea67a98541f3df9c273c5f5 (diff)
downloadwallabag-4f5b44bd3bd490309eb2ba7b44df4769816ba729.tar.gz
wallabag-4f5b44bd3bd490309eb2ba7b44df4769816ba729.tar.zst
wallabag-4f5b44bd3bd490309eb2ba7b44df4769816ba729.zip
twig implementation
Diffstat (limited to 'vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php')
-rw-r--r--vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php58
1 files changed, 58 insertions, 0 deletions
diff --git a/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php b/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php
new file mode 100644
index 00000000..2ad4fc87
--- /dev/null
+++ b/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php
@@ -0,0 +1,58 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Routing\Tests\Matcher;
13
14use Symfony\Component\Routing\Route;
15use Symfony\Component\Routing\RouteCollection;
16use Symfony\Component\Routing\RequestContext;
17
18class RedirectableUrlMatcherTest extends \PHPUnit_Framework_TestCase
19{
20 public function testRedirectWhenNoSlash()
21 {
22 $coll = new RouteCollection();
23 $coll->add('foo', new Route('/foo/'));
24
25 $matcher = $this->getMockForAbstractClass('Symfony\Component\Routing\Matcher\RedirectableUrlMatcher', array($coll, new RequestContext()));
26 $matcher->expects($this->once())->method('redirect');
27 $matcher->match('/foo');
28 }
29
30 /**
31 * @expectedException \Symfony\Component\Routing\Exception\ResourceNotFoundException
32 */
33 public function testRedirectWhenNoSlashForNonSafeMethod()
34 {
35 $coll = new RouteCollection();
36 $coll->add('foo', new Route('/foo/'));
37
38 $context = new RequestContext();
39 $context->setMethod('POST');
40 $matcher = $this->getMockForAbstractClass('Symfony\Component\Routing\Matcher\RedirectableUrlMatcher', array($coll, $context));
41 $matcher->match('/foo');
42 }
43
44 public function testSchemeRedirect()
45 {
46 $coll = new RouteCollection();
47 $coll->add('foo', new Route('/foo', array(), array('_scheme' => 'https')));
48
49 $matcher = $this->getMockForAbstractClass('Symfony\Component\Routing\Matcher\RedirectableUrlMatcher', array($coll, new RequestContext()));
50 $matcher
51 ->expects($this->once())
52 ->method('redirect')
53 ->with('/foo', 'foo', 'https')
54 ->will($this->returnValue(array('_route' => 'foo')))
55 ;
56 $matcher->match('/foo');
57 }
58}