|
2 | 2 |
|
3 | 3 | class UrlTest extends TestCaseBase |
4 | 4 | { |
5 | | - public function testParser() |
| 5 | + public function urlsParserProvider() |
6 | 6 | { |
7 | | - $urls = [ |
8 | | - 'http://vimeo.com//69912181?' => 'http://vimeo.com/69912181', |
9 | | - 'http://vimeo.com//69912181' => 'http://vimeo.com/69912181', |
10 | | - 'http://vimeo.com/69912181' => 'http://vimeo.com/69912181', |
11 | | - 'http://vimeo.com/69912181/' => 'http://vimeo.com/69912181/', |
12 | | - 'https://www.tumblr.com/oembed/1.0' => 'https://www.tumblr.com/oembed/1.0', |
13 | | - 'https://www.tumblr.com/oembed/1.0/' => 'https://www.tumblr.com/oembed/1.0/', |
14 | | - 'https://www.tumblr.com/oembed//1.0//' => 'https://www.tumblr.com/oembed/1.0/', |
15 | | - 'https://animoto.com/oembeds/create.xml?automated=true&options=start_hq' => 'https://animoto.com/oembeds/create.xml?automated=true&options=start_hq', |
16 | | - 'http://static2.politico.com/dims4/default/28fb355/2147483647/resize/1160x%3E/quality/90/?url=http%3A%2F%2Fs3-origin-images.politico.com%2F2013%2F12%2F18%2F131218_george_w_bush_barack_obama_ap_60' => 'http://static2.politico.com/dims4/default/28fb355/2147483647/resize/1160x%3E/quality/90/?url=http%3A%2F%2Fs3-origin-images.politico.com%2F2013%2F12%2F18%2F131218_george_w_bush_barack_obama_ap_60', |
| 7 | + return [ |
| 8 | + ['http://vimeo.com//69912181?', 'http://vimeo.com/69912181'], |
| 9 | + ['http://vimeo.com//69912181', 'http://vimeo.com/69912181'], |
| 10 | + ['http://vimeo.com/69912181', 'http://vimeo.com/69912181'], |
| 11 | + ['http://vimeo.com/69912181/', 'http://vimeo.com/69912181/'], |
| 12 | + ['https://www.tumblr.com/oembed/1.0', 'https://www.tumblr.com/oembed/1.0'], |
| 13 | + ['https://www.tumblr.com/oembed/1.0/', 'https://www.tumblr.com/oembed/1.0/'], |
| 14 | + ['https://www.tumblr.com/oembed//1.0//', 'https://www.tumblr.com/oembed/1.0/'], |
| 15 | + ['https://animoto.com/oembeds/create.xml?automated=true&options=start_hq', 'https://animoto.com/oembeds/create.xml?automated=true&options=start_hq'], |
| 16 | + ['http://static2.politico.com/dims4/default/28fb355/2147483647/resize/1160x%3E/quality/90/?url=http%3A%2F%2Fs3-origin-images.politico.com%2F2013%2F12%2F18%2F131218_george_w_bush_barack_obama_ap_60', 'http://static2.politico.com/dims4/default/28fb355/2147483647/resize/1160x%3E/quality/90/?url=http%3A%2F%2Fs3-origin-images.politico.com%2F2013%2F12%2F18%2F131218_george_w_bush_barack_obama_ap_60'], |
17 | 17 | ]; |
| 18 | + } |
18 | 19 |
|
19 | | - foreach ($urls as $url => $expected_url) { |
20 | | - $parsed_url = new Embed\Url($url); |
| 20 | + /** |
| 21 | + * @dataProvider urlsParserProvider |
| 22 | + */ |
| 23 | + public function testParser($url, $expected_url) |
| 24 | + { |
| 25 | + $parsed_url = new Embed\Url($url); |
21 | 26 |
|
22 | | - $this->assertSame($expected_url, $parsed_url->getUrl()); |
23 | | - } |
| 27 | + $this->assertSame($expected_url, $parsed_url->getUrl()); |
24 | 28 | } |
25 | 29 |
|
26 | 30 | public function testDirectoryPosition() |
|
0 commit comments