Example #1
0
 /**
  * Test unit of test unit
  */
 public function testGetRelativePathFromTo()
 {
     $fileTable = new Media_Model_DbTable_File();
     $row = $fileTable->createRow();
     $os = 'linux';
     if (isset($_SERVER['OS']) && preg_match('`Window`i', $_SERVER['OS'])) {
         $os = 'windows';
     }
     if ('linux' == $os) {
         $this->assertEquals('../user', $row->getRelativePathFromTo('/home', '/user', false));
         $this->assertEquals('../../user', $row->getRelativePathFromTo('/home/lchenay', '/user', false));
         $this->assertEquals('../oo/test', $row->getRelativePathFromTo('/home/lchenay', '/home/oo/test', false));
     } else {
         $this->assertEquals('..\\user', $row->getRelativePathFromTo('c:\\home', 'c:\\user', false));
         $this->assertEquals('..\\..\\user', $row->getRelativePathFromTo('c:\\home\\lchenay', 'c:\\user', false));
         $this->assertEquals('..\\oo\\test', $row->getRelativePathFromTo('c:\\home\\lchenay', 'c:\\home\\oo\\test', false));
         $this->assertEquals('..\\library\\Centurion\\Contrib\\media\\tests\\Support\\images\\centurion.png', $row->getRelativePathFromTo('C:\\UwAmp\\www\\Centurion\\tests', 'C:\\UwAmp\\www\\Centurion/library/Centurion/Contrib/media/tests/Support/images/centurion.png', false));
     }
 }