mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 18:48:51 +02:00
N°4771 Fix lib test dir detection
Thanks to @Molkobain and @Hipska for their review in dfaa9733
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user