mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 11:08:45 +02:00
Merge remote-tracking branch 'origin/support/2.7' into support/3.0
# Conflicts: # lib/composer/installed.php # setup/licenses/community-licenses.xml # setup/setuputils.class.inc.php # sources/application/TwigBase/Controller/Controller.php
This commit is contained in:
@@ -415,7 +415,7 @@ class ItopDataTestCase extends ItopTestCase
|
||||
* @return \DBObject
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function CreateUser($sLogin, $iProfileId, $sPassword=null)
|
||||
protected function CreateUser($sLogin, $iProfileId, $sPassword=null, $iContactid=2)
|
||||
{
|
||||
if (empty($sPassword)){
|
||||
$sPassword = $sLogin;
|
||||
@@ -426,7 +426,7 @@ class ItopDataTestCase extends ItopTestCase
|
||||
$oUserProfile->Set('reason', 'UNIT Tests');
|
||||
$oSet = DBObjectSet::FromObject($oUserProfile);
|
||||
$oUser = $this->createObject('UserLocal', array(
|
||||
'contactid' => 2,
|
||||
'contactid' => $iContactid,
|
||||
'login' => $sLogin,
|
||||
'password' => $sPassword,
|
||||
'language' => 'EN US',
|
||||
|
||||
@@ -33,6 +33,35 @@ class iTopComposerTest extends ItopTestCase
|
||||
clearstatcache();
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider IsTestDirProvider
|
||||
* @return void
|
||||
*/
|
||||
public function testIsTestDir($sDirName, $bIsTest)
|
||||
{
|
||||
$isTestDir = iTopComposer::IsTestDir($sDirName);
|
||||
$this->assertInternalType('int', $isTestDir);
|
||||
if (true === $bIsTest) {
|
||||
$this->assertTrue(($isTestDir > 0));
|
||||
} else {
|
||||
$this->assertSame(0, $isTestDir);
|
||||
}
|
||||
}
|
||||
|
||||
public function IsTestDirProvider()
|
||||
{
|
||||
return [
|
||||
'test' => ['test', true],
|
||||
'Test' => ['Test', true],
|
||||
'tests' => ['tests', true],
|
||||
'Tests' => ['Tests', true],
|
||||
'testaa' => ['testaa', false],
|
||||
'Testaa' => ['Testaa', false],
|
||||
'testsaa' => ['testsaa', false],
|
||||
'Testsaa' => ['Testsaa', false],
|
||||
];
|
||||
}
|
||||
|
||||
public function testListAllTestDir()
|
||||
{
|
||||
$oiTopComposer = new iTopComposer();
|
||||
@@ -40,9 +69,9 @@ class iTopComposerTest extends ItopTestCase
|
||||
|
||||
$this->assertTrue(is_array($aDirs));
|
||||
|
||||
foreach ($aDirs as $sDir)
|
||||
{
|
||||
$this->assertRegExp('#[tT]ests?/?$#', $sDir);
|
||||
foreach ($aDirs as $sDir) {
|
||||
$sDirName = basename($sDir);
|
||||
$this->assertRegExp(iTopComposer::TEST_DIR_REGEXP, $sDirName, "Directory not matching test dir : $sDir");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -54,10 +83,16 @@ class iTopComposerTest extends ItopTestCase
|
||||
|
||||
$this->assertTrue(is_array($aDirs));
|
||||
|
||||
$aDeniedDirWrongFormat = [];
|
||||
foreach ($aDirs as $sDir)
|
||||
{
|
||||
$this->assertRegExp('#[tT]ests?/?$#', $sDir);
|
||||
if (false === iTopComposer::IsTestDir($sDir)) {
|
||||
$aDeniedDirWrongFormat[] = $sDir;
|
||||
}
|
||||
}
|
||||
|
||||
$this->assertEmpty($aDeniedDirWrongFormat,
|
||||
'There are elements in \Combodo\iTop\Composer\iTopComposer::ListDeniedTestDir that are not test dirs :'.var_export($aDeniedDirWrongFormat, true));
|
||||
}
|
||||
|
||||
public function testListAllowedTestDir()
|
||||
@@ -100,9 +135,11 @@ class iTopComposerTest extends ItopTestCase
|
||||
$aMissing = array_diff($aExistingDirs, $aAllowedAndDeniedDirs);
|
||||
$aExtra = array_diff($aAllowedAndDeniedDirs, $aExistingDirs);
|
||||
|
||||
$this->assertEmpty($aMissing, "The iTop instance running this test has matching directories That must be either in the allowed or in the denied list:".var_export($aMissing, true));
|
||||
|
||||
$this->assertEmpty(
|
||||
$aMissing,
|
||||
'Test dirs exists in /lib !'."\n"
|
||||
.' They must be declared either in the allowed or denied list in '.iTopComposer::class." (see N°2651).\n"
|
||||
.' List of dirs:'."\n".var_export($aMissing, true)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ class iTopModulesPhpVersionIntegrationTest extends ItopTestCase {
|
||||
*/
|
||||
public function testItopWikiVersion($sItopVersion, $sExpectedWikiVersion) {
|
||||
try {
|
||||
$sActualWikiVersion = utils::GetCoreVersionWikiSyntax($sItopVersion);
|
||||
$sActualWikiVersion = utils::GetItopVersionWikiSyntax($sItopVersion);
|
||||
}
|
||||
catch (ApplicationException $e) {
|
||||
self::fail('Cannot get wiki version : '.$e->getMessage());
|
||||
|
||||
Reference in New Issue
Block a user