N°3007 - Warn the user that installing a patch on a non conform install is not recommended

This commit is contained in:
Eric
2020-06-04 10:38:58 +02:00
parent 8064a20718
commit 9d8a7bf561
6 changed files with 99 additions and 12 deletions

View File

@@ -103,6 +103,48 @@ class UtilsTest extends \Combodo\iTop\Test\UnitTest\ItopTestCase
];
}
/**
* @dataProvider LocalPathProvider
*
* @param $sAbsolutePath
* @param $expected
*/
public function testLocalPath($sAbsolutePath, $expected)
{
$this->assertSame($expected, utils::LocalPath($sAbsolutePath));
}
public function LocalPathProvider()
{
return array(
'index.php' => array(
'sAbsolutePath' => APPROOT.'index.php',
'expected' => 'index.php',
),
'non existing' => array(
'sAbsolutePath' => APPROOT.'nonexisting/nonexisting',
'expected' => false,
),
'outside' => array(
'sAbsolutePath' => '/tmp',
'expected' => false,
),
'application/cmdbabstract.class.inc.php' => array(
'sAbsolutePath' => APPROOT.'application/cmdbabstract.class.inc.php',
'expected' => 'application/cmdbabstract.class.inc.php',
),
'dir' => array(
'sAbsolutePath' => APPROOT.'application/.',
'expected' => 'application',
),
'root' => array(
'sAbsolutePath' => APPROOT.'.',
'expected' => '',
),
);
}
/**
* @dataProvider appRootUrlProvider
* @covers utils::GetAppRootUrl