Esempio n. 1
0
 public function test()
 {
     foreach (array(array('path' => '', 'separator' => '', 'result' => ''), array('path' => '/var/lib/file.txt', 'separator' => '/', 'result' => '/var/lib/file.txt'), array('path' => 'C:\\Foo\\Bar', 'separator' => '/', 'result' => 'C:/Foo/Bar'), array('path' => '/home/user/file.txt', 'separator' => '/', 'result' => '/home/user/file.txt'), array('path' => 'C:\\Foo/Bar/mixed\\content', 'separator' => '/', 'result' => 'C:/Foo/Bar/mixed/content')) as $testValues) {
         self::assertEquals($testValues['result'], AbstractInstaller::getNativePath($testValues['path'], $testValues['separator']));
     }
     self::assertEquals(DIRECTORY_SEPARATOR . 'some' . DIRECTORY_SEPARATOR . 'file.txt', AbstractInstaller::getNativePath('/some/file.txt'));
     self::assertEquals(DIRECTORY_SEPARATOR . 'some' . DIRECTORY_SEPARATOR . 'file.txt', AbstractInstaller::getNativePath('\\some\\file.txt'));
 }
Esempio n. 2
0
 public function test()
 {
     foreach (array(array('prefix' => '', 'path' => '', 'result' => ''), array('prefix' => '/home/user', 'path' => '/var/lib/file.txt', 'result' => '/var/lib/file.txt'), array('prefix' => 'C:\\Foo\\Bar', 'path' => 'C:\\Foo\\Bar\\fooBar.txt', 'result' => '\\fooBar.txt'), array('prefix' => '/home/user', 'path' => '/home/user/file.txt', 'result' => '/file.txt')) as $testValues) {
         self::assertEquals($testValues['result'], AbstractInstaller::unprefixPath($testValues['prefix'], $testValues['path']));
     }
 }