|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace Alchemy\Zippy\Tests\Resource; |
| 4 | + |
| 5 | +use Alchemy\Zippy\Tests\TestCase; |
| 6 | +use Alchemy\Zippy\Resource\PathUtil; |
| 7 | + |
| 8 | +class PathUtilTest extends TestCase |
| 9 | +{ |
| 10 | + /** |
| 11 | + * @dataProvider providePathData |
| 12 | + */ |
| 13 | + public function testBasename($expected, $context) |
| 14 | + { |
| 15 | + $this->assertEquals($expected, PathUtil::basename($context)); |
| 16 | + } |
| 17 | + |
| 18 | + public function providePathData() |
| 19 | + { |
| 20 | + return array( |
| 21 | + array('file.ext', 'input/path/to/local/file.ext'), |
| 22 | + array('file.ext', 'input\path\to\local\file.ext'), |
| 23 | + array('file.ext', '\file.ext'), |
| 24 | + array('file.ext', 'file.ext'), |
| 25 | + array('Ängelholm.jpg', '/tmp/Ängelholm.jpg'), |
| 26 | + array('Ängelholm.jpg', '\tmp\Ängelholm.jpg'), |
| 27 | + array('Ängelholm.jpg', '\Ängelholm.jpg'), |
| 28 | + array('Ängelholm.jpg', 'Ängelholm.jpg'), |
| 29 | + array('я-utf8-name.jpg', '/tmp/я-utf8-name.jpg'), |
| 30 | + array('я-utf8-name.jpg', '\tmp\я-utf8-name.jpg'), |
| 31 | + array('я-utf8-name.jpg', 'я-utf8-name.jpg'), |
| 32 | + array('я-utf8-name.jpg', '/я-utf8-name.jpg'), |
| 33 | + array('logo.png', 'http://google.com/tmp/logo.png'), |
| 34 | + array('Ängelholm.png', 'http://google.com/city/Ängelholm.png'), |
| 35 | + array('Ängelholm.png', 'http://google.com/я/Ängelholm.png') |
| 36 | + ); |
| 37 | + } |
| 38 | +} |
0 commit comments