utils::GetDefaultUrlAppRoot : make comparison case insentitive, add a test

This commit is contained in:
Pierre Goiffon
2019-12-23 11:06:29 +01:00
parent 57ae29cf2f
commit 13d31ac211
2 changed files with 40 additions and 5 deletions

View File

@@ -102,4 +102,23 @@ class UtilsTest extends \Combodo\iTop\Test\UnitTest\ItopTestCase
],
];
}
/**
* @dataProvider appRootUrlProvider
* @covers utils::GetAppRootUrl
*/
public function testGetAppRootUrl($sReturnValue, $sCurrentScript, $sAppRoot, $sAbsoluteUrl)
{
$this->assertEquals($sReturnValue, utils::GetAppRootUrl($sCurrentScript, $sAppRoot, $sAbsoluteUrl));
}
public function appRootUrlProvider()
{
return array(
'Setup index (windows antislash)' => array('http://localhost/', 'C:\Dev\wamp64\www\itop-dev\setup\index.php', 'C:\Dev\wamp64\www\itop-dev', 'http://localhost/setup/'),
'Setup index (windows slash)' => array('http://127.0.0.1/', 'C:/web/setup/index.php', 'C:/web', 'http://127.0.0.1/setup/'),
'Setup index (windows slash, drive letter case difference)' => array('http://127.0.0.1/', 'c:/web/setup/index.php', 'C:/web', 'http://127.0.0.1/setup/'),
);
}
}