mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-29 07:12:15 +09:00
Update unit tests
This commit is contained in:
parent
139e11df13
commit
8773b15410
2 changed files with 10 additions and 5 deletions
|
|
@ -98,9 +98,10 @@ class URLTest extends \Codeception\TestCase\Test
|
|||
$protocol = \RX_SSL ? 'https://' : 'http://';
|
||||
$_SERVER['HTTP_HOST'] = 'www.rhymix.org';
|
||||
|
||||
$this->assertEquals($protocol . $_SERVER['HTTP_HOST'] . \RX_BASEURL, Rhymix\Framework\URL::fromServerPath(\RX_BASEDIR));
|
||||
$this->assertEquals($protocol . $_SERVER['HTTP_HOST'] . \RX_BASEURL . 'index.php', Rhymix\Framework\URL::fromServerPath(\RX_BASEDIR . 'index.php'));
|
||||
$this->assertEquals($protocol . $_SERVER['HTTP_HOST'] . \RX_BASEURL . 'foo/bar', Rhymix\Framework\URL::fromServerPath(\RX_BASEDIR . '/foo/bar'));
|
||||
$this->assertEquals($protocol . $_SERVER['HTTP_HOST'] . '/', Rhymix\Framework\URL::fromServerPath(\RX_BASEDIR));
|
||||
$this->assertEquals($protocol . $_SERVER['HTTP_HOST'] . '/index.php', Rhymix\Framework\URL::fromServerPath(\RX_BASEDIR . 'index.php'));
|
||||
$this->assertEquals($protocol . $_SERVER['HTTP_HOST'] . '/foo/bar', Rhymix\Framework\URL::fromServerPath(\RX_BASEDIR . '/foo/bar'));
|
||||
$this->assertEquals(false, Rhymix\Framework\URL::fromServerPath(dirname(dirname(\RX_BASEDIR))));
|
||||
$this->assertEquals(false, Rhymix\Framework\URL::fromServerPath('C:/Windows'));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,6 +50,10 @@ class FilenameFilterTest extends \Codeception\TestCase\Test
|
|||
$this->assertEquals('/usr/share', FilenameFilter::cleanPath('/usr/share/foo/..'));
|
||||
$this->assertEquals('/usr/share', FilenameFilter::cleanPath('/usr/share/foo/bar/../baz/../../'));
|
||||
|
||||
// Test internal paths.
|
||||
$this->assertEquals(\RX_BASEDIR . 'common/js/debug.js', FilenameFilter::cleanPath('common/js/debug.js'));
|
||||
$this->assertEquals(\RX_BASEDIR . 'common/js/debug.js', FilenameFilter::cleanPath('./common/js/debug.js'));
|
||||
|
||||
// Test Windows paths.
|
||||
$this->assertEquals('C:/Windows/Notepad.exe', FilenameFilter::cleanPath('C:\\Windows\\System32\\..\\Notepad.exe'));
|
||||
|
||||
|
|
@ -58,7 +62,7 @@ class FilenameFilterTest extends \Codeception\TestCase\Test
|
|||
$this->assertEquals('/../foobar', FilenameFilter::cleanPath('/../foobar/'));
|
||||
|
||||
// Remove query strings and URL fragments.
|
||||
$this->assertEquals('index.php', FilenameFilter::cleanPath('index.php?foo=bar'));
|
||||
$this->assertEquals('index.php', FilenameFilter::cleanPath('index.php#baz'));
|
||||
$this->assertEquals(\RX_BASEDIR . 'index.php', FilenameFilter::cleanPath('index.php?foo=bar'));
|
||||
$this->assertEquals(\RX_BASEDIR . 'index.php', FilenameFilter::cleanPath('index.php#baz'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue