* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\EventListener; use PHPUnit\Framework\TestCase; use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\Extension\Core\EventListener\FixUrlProtocolListener; class FixUrlProtocolListenerTest extends TestCase { public function testFixHttpUrl() { $data = 'www.symfony.com'; $form = $this->getMockBuilder('Symfony\Component\Form\Test\FormInterface')->getMock(); $event = new FormEvent($form, $data); $filter = new FixUrlProtocolListener('http'); $filter->onSubmit($event); $this->assertEquals('http://www.symfony.com', $event->getData()); } public function testSkipKnownUrl() { $data = 'http://www.symfony.com'; $form = $this->getMockBuilder('Symfony\Component\Form\Test\FormInterface')->getMock(); $event = new FormEvent($form, $data); $filter = new FixUrlProtocolListener('http'); $filter->onSubmit($event); $this->assertEquals('http://www.symfony.com', $event->getData()); } public function provideUrlsWithSupportedProtocols() { return array( array('ftp://www.symfony.com'), array('chrome-extension://foo'), array('h323://foo'), array('iris.beep://foo'), array('foo+bar://foo'), ); } /** * @dataProvider provideUrlsWithSupportedProtocols */ public function testSkipOtherProtocol($url) { $form = $this->getMockBuilder('Symfony\Component\Form\Test\FormInterface')->getMock(); $event = new FormEvent($form, $url); $filter = new FixUrlProtocolListener('http'); $filter->onSubmit($event); $this->assertEquals($url, $event->getData()); } } __halt_compiler();----SIGNATURE:----RWU3KqOCwE9oD/XhqbFqza3pzIVvP17RRzFOhRgJ4WmkAfvAOMVUwj3ijpBd0bUyYGB2/7VBeHUZ3GyA5e0NdO35VFSPVF0eUsYYQHD8MX6io//X3O3RVuHeIbRICi7h2pTokw2xUQ5vSY4SUOjnjR0MXCkIWE1eM6X2juzjIFzwi6LP7sEccKeRCOJrhXwF//0/RVda6/hPJtmn4BAasGrEFT6eps4bCcdlJQ1YIm8AkSxV75djvT8H9qK36G0UtPOaG9j6EAISeIU0zy4aarCmgKmA/2nLgPGsDrM+p3Bykk3WpNMgx5QU/qjb9gZVgtKTVv5kjsXliSQiyeNYYCNd11Eg2mj4i67wH26M9Ve5TA5CSAtVulqoqBle6GsZ0Hkd1//aaEbgwO2kNz+mwHXBRLrgqM1GYyoT4eWvxuCvsE1m42HtOrIveokKf6RXc3HI/m/ZbrNOugqxA16LLeT3kH2rlo+gl4bry1tTMmhtb+BT2b+8yMEEapQwVjWk1kaIMOpyEa6cgeuGd+eqm28oC5XSpYZ0Eds5aqGosTHuvEKOMfJYN71ynGXWw8sNSIDHKBU2FeAYv7SApk696O0aA0smnHhpwGgmdaN5r+T1O6iUVyxjkblVwLrKfxTZjLS1KiSKxmahtAHHP8ESclmQLnOkOxqP0f0dgo51IFY=----ATTACHMENT:----NDcyODU5MTU4ODY0OTkwOSA3MTAxMjQyMzgwMzcyOTE2IDU1MzM0MzA1NDIzNTc0MDQ=