aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/FixUrlProtocolListenerTest.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/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/FixUrlProtocolListenerTest.php
parent2b840e0cfb63a453bea67a98541f3df9c273c5f5 (diff)
downloadwallabag-4f5b44bd3bd490309eb2ba7b44df4769816ba729.tar.gz
wallabag-4f5b44bd3bd490309eb2ba7b44df4769816ba729.tar.zst
wallabag-4f5b44bd3bd490309eb2ba7b44df4769816ba729.zip
twig implementation
Diffstat (limited to 'vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/FixUrlProtocolListenerTest.php')
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/FixUrlProtocolListenerTest.php61
1 files changed, 61 insertions, 0 deletions
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/FixUrlProtocolListenerTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/FixUrlProtocolListenerTest.php
new file mode 100644
index 00000000..2b84e4fd
--- /dev/null
+++ b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/FixUrlProtocolListenerTest.php
@@ -0,0 +1,61 @@
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\Form\Tests\Extension\Core\EventListener;
13
14use Symfony\Component\Form\FormEvent;
15use Symfony\Component\Form\Extension\Core\EventListener\FixUrlProtocolListener;
16
17class FixUrlProtocolListenerTest extends \PHPUnit_Framework_TestCase
18{
19 protected function setUp()
20 {
21 if (!class_exists('Symfony\Component\EventDispatcher\EventDispatcher')) {
22 $this->markTestSkipped('The "EventDispatcher" component is not available');
23 }
24 }
25
26 public function testFixHttpUrl()
27 {
28 $data = "www.symfony.com";
29 $form = $this->getMock('Symfony\Component\Form\Test\FormInterface');
30 $event = new FormEvent($form, $data);
31
32 $filter = new FixUrlProtocolListener('http');
33 $filter->onSubmit($event);
34
35 $this->assertEquals('http://www.symfony.com', $event->getData());
36 }
37
38 public function testSkipKnownUrl()
39 {
40 $data = "http://www.symfony.com";
41 $form = $this->getMock('Symfony\Component\Form\Test\FormInterface');
42 $event = new FormEvent($form, $data);
43
44 $filter = new FixUrlProtocolListener('http');
45 $filter->onSubmit($event);
46
47 $this->assertEquals('http://www.symfony.com', $event->getData());
48 }
49
50 public function testSkipOtherProtocol()
51 {
52 $data = "ftp://www.symfony.com";
53 $form = $this->getMock('Symfony\Component\Form\Test\FormInterface');
54 $event = new FormEvent($form, $data);
55
56 $filter = new FixUrlProtocolListener('http');
57 $filter->onSubmit($event);
58
59 $this->assertEquals('ftp://www.symfony.com', $event->getData());
60 }
61}