public function testIsAbsoluteRealPath_絶対パスに相対パスが混じっている場合_falseが返る() { if (strpos(PHP_OS, 'WIN')) { $input = 'C:/path/to/eccube/html/../data/hoge.txt'; } else { $input = '/path/to/eccube/html/../data/hoge.txt'; } $this->expected = false; $this->actual = SC_Utils::isAbsoluteRealPath($input); $this->verify(); }
public function testIsAbsoluteRealPath_相対パスの場合_trueが返る() { if (strpos(PHP_OS, 'WIN')) { $input = './system32/hoge/hoge.txt'; } else { $input = '../etc/php.ini'; } $this->expected = false; $this->actual = SC_Utils::isAbsoluteRealPath($input); $this->verify(); }
function testIsAbsoluteRealPath() { // for *NIX if (strpos(PHP_OS, 'WIN') === false) { $unix_absolute = '/usr/local'; $this->assertTrue(SC_Utils::isAbsoluteRealPath($unix_absolute)); $relative = '../foo/bar'; $this->assertFalse(SC_Utils::isAbsoluteRealPath($relative)); } else { $win_absolute = 'C:\\Windows\\system32'; $this->assertTrue(SC_Utils::isAbsoluteRealPath($win_absolute)); $win_absolute = 'C:/Windows/system32'; $this->assertTrue(SC_Utils::isAbsoluteRealPath($win_absolute)); $relative = '..\\foo\\bar'; $this->assertFalse(SC_Utils::isAbsoluteRealPath($relative)); } $empty = ''; $this->assertFalse(SC_Utils::isAbsoluteRealPath($empty)); }