-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7956178
commit 1c45603
Showing
4 changed files
with
144 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -558,6 +558,91 @@ public function getTests() | |
array('ipv6', array(array()), false), | ||
array('ipv6', array(null), false), | ||
array('ipv6', array(false), false), | ||
array('url', array('example.com'), false), | ||
array('url', array('://example.com'), false), | ||
array('url', array('http ://example.com'), false), | ||
array('url', array('http:/example.com'), false), | ||
array('url', array('http://example.com::aa'), false), | ||
array('url', array('http://example.com:aa'), false), | ||
array('url', array('ftp://example.fr'), false), | ||
array('url', array('faked://example.fr'), false), | ||
array('url', array('http://127.0.0.1:aa/'), false), | ||
array('url', array('ftp://[::1]/'), false), | ||
array('url', array('http://[::1'), false), | ||
array('url', array('http://hello.☎/'), false), | ||
array('url', array('http://:[email protected]'), false), | ||
array('url', array('http://:password@@symfony.com'), false), | ||
array('url', array('http://username:passwordsymfony.com'), false), | ||
array('url', array('http://usern@me:[email protected]'), false), | ||
array('url', array('http://nota%hex:[email protected]'), false), | ||
array('url', array('http://username:nota%[email protected]'), false), | ||
array('url', array('http://example.com/exploit.html?<script>alert(1);</script>'), false), | ||
array('url', array('http://example.com/exploit.html?hel lo'), false), | ||
array('url', array('http://example.com/exploit.html?not_a%hex'), false), | ||
array('url', array('http://'), false), | ||
array('url', array('http://a.pl'), true), | ||
array('url', array('http://www.example.com'), true), | ||
array('url', array('http://www.example.com.'), true), | ||
array('url', array('http://www.example.museum'), true), | ||
array('url', array('https://example.com/'), true), | ||
array('url', array('https://example.com:80/'), true), | ||
array('url', array('http://examp_le.com'), true), | ||
array('url', array('http://www.sub_domain.examp_le.com'), true), | ||
array('url', array('http://www.example.coop/'), true), | ||
array('url', array('http://www.test-example.com/'), true), | ||
array('url', array('http://www.symfony.com/'), true), | ||
array('url', array('http://symfony.fake/blog/'), true), | ||
array('url', array('http://symfony.com/?'), true), | ||
array('url', array('http://symfony.com/search?type=&q=url+validator'), true), | ||
array('url', array('http://symfony.com/#'), true), | ||
array('url', array('http://symfony.com/#?'), true), | ||
array('url', array('http://www.symfony.com/doc/current/book/validation.html#supported-constraints'), true), | ||
array('url', array('http://very.long.domain.name.com/'), true), | ||
array('url', array('http://localhost/'), true), | ||
array('url', array('http://myhost123/'), true), | ||
array('url', array('http://127.0.0.1/'), true), | ||
array('url', array('http://127.0.0.1:80/'), true), | ||
array('url', array('http://[::1]/'), true), | ||
array('url', array('http://[::1]:80/'), true), | ||
array('url', array('http://[1:2:3::4:5:6:7]/'), true), | ||
array('url', array('http://sãopaulo.com/'), true), | ||
array('url', array('http://xn--sopaulo-xwa.com/'), true), | ||
array('url', array('http://sãopaulo.com.br/'), true), | ||
array('url', array('http://xn--sopaulo-xwa.com.br/'), true), | ||
array('url', array('http://пример.испытание/'), true), | ||
array('url', array('http://xn--e1afmkfd.xn--80akhbyknj4f/'), true), | ||
array('url', array('http://مثال.إختبار/'), true), | ||
array('url', array('http://xn--mgbh0fb.xn--kgbechtv/'), true), | ||
array('url', array('http://例子.测试/'), true), | ||
array('url', array('http://xn--fsqu00a.xn--0zwm56d/'), true), | ||
array('url', array('http://例子.測試/'), true), | ||
array('url', array('http://xn--fsqu00a.xn--g6w251d/'), true), | ||
array('url', array('http://例え.テスト/'), true), | ||
array('url', array('http://xn--r8jz45g.xn--zckzah/'), true), | ||
array('url', array('http://مثال.آزمایشی/'), true), | ||
array('url', array('http://xn--mgbh0fb.xn--hgbk6aj7f53bba/'), true), | ||
array('url', array('http://실례.테스트/'), true), | ||
array('url', array('http://xn--9n2bp8q.xn--9t4b11yi5a/'), true), | ||
array('url', array('http://العربية.idn.icann.org/'), true), | ||
array('url', array('http://xn--ogb.idn.icann.org/'), true), | ||
array('url', array('http://xn--e1afmkfd.xn--80akhbyknj4f.xn--e1afmkfd/'), true), | ||
array('url', array('http://xn--espaa-rta.xn--ca-ol-fsay5a/'), true), | ||
array('url', array('http://xn--d1abbgf6aiiy.xn--p1ai/'), true), | ||
array('url', array('http://☎.com/'), true), | ||
array('url', array('http://username:[email protected]'), true), | ||
array('url', array('http://user.name:[email protected]'), true), | ||
array('url', array('http://user_name:[email protected]'), true), | ||
array('url', array('http://username:[email protected]'), true), | ||
array('url', array('http://user.name:[email protected]'), true), | ||
array('url', array('http://[email protected]'), true), | ||
array('url', array('http://[email protected]'), true), | ||
array('url', array('http://symfony.com?'), true), | ||
array('url', array('http://symfony.com?query=1'), true), | ||
array('url', array('http://symfony.com/?query=1'), true), | ||
array('url', array('http://symfony.com#'), true), | ||
array('url', array('http://symfony.com#fragment'), true), | ||
array('url', array('http://symfony.com/#fragment'), true), | ||
array('url', array('http://example.com/exploit.html?hello[0]=test'), true), | ||
array('email', array('foo'), false), | ||
array('email', array(123), false), | ||
array('email', array('foo.com'), false), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace Webmozart\Assert\Tests\StaticAnalysis; | ||
|
||
use Webmozart\Assert\Assert; | ||
|
||
/** | ||
* @psalm-pure | ||
* @psalm-param non-empty-string $value | ||
* | ||
* @psalm-return non-empty-string | ||
*/ | ||
function consume(string $value): string | ||
{ | ||
Assert::url($value); | ||
|
||
return $value; | ||
} |