Skip to content

Commit

Permalink
No renamed (and not migrated) tests
Browse files Browse the repository at this point in the history
One of them cannot be migrated right now, put back to atoum suite.
  • Loading branch information
trasher authored and cedric-anne committed Jan 16, 2025
1 parent 19891b0 commit a4b0642
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@

namespace tests\units\Glpi\System\Diagnostic;

class DatabaseKeysChecker extends \GLPITestCase
use Glpi\System\Diagnostic\DatabaseKeysChecker;

class DatabaseKeysCheckerTest extends \GLPITestCase
{
protected function sqlProvider()
public static function sqlProvider()
{
return [
[
Expand Down Expand Up @@ -320,7 +322,6 @@ public function testMissingMisnamedUseless(
array $expected_useless,
$item_class = null
) {

global $DB;

$itemtype = sprintf('Test%s', uniqid());
Expand All @@ -332,15 +333,15 @@ public function testMissingMisnamedUseless(
}
class_alias(get_class($item_class), $itemtype);

$this->newTestedInstance($DB);
$instance = new DatabaseKeysChecker($DB);
$DB->doQuery(sprintf($create_table_sql, $table_name));
$missing_keys = $this->testedInstance->getMissingKeys($table_name);
$misnamed_keys = $this->testedInstance->getMisnamedKeys($table_name);
$useless_keys = $this->testedInstance->getUselessKeys($table_name);
$missing_keys = $instance->getMissingKeys($table_name);
$misnamed_keys = $instance->getMisnamedKeys($table_name);
$useless_keys = $instance->getUselessKeys($table_name);
$DB->doQuery(sprintf('DROP TABLE `%s`', $table_name));

$this->array($missing_keys)->isEqualTo($expected_missing);
$this->array($misnamed_keys)->isEqualTo($expected_misnamed);
$this->array($useless_keys)->isEqualTo($expected_useless);
$this->assertEquals($expected_missing, $missing_keys);
$this->assertEquals($expected_misnamed, $misnamed_keys);
$this->assertEquals($expected_useless, $useless_keys);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@

namespace tests\units\Glpi\System\Diagnostic;

class DatabaseSchemaConsistencyChecker extends \GLPITestCase
use Glpi\System\Diagnostic\DatabaseSchemaConsistencyChecker;

class DatabaseSchemaConsistencyCheckerTest extends \GLPITestCase
{
protected function sqlProvider(): iterable
public static function sqlProvider(): iterable
{
// `date_creation` should always be associated with `date_mod`
yield [
Expand Down Expand Up @@ -95,11 +97,11 @@ public function testGetMissingFields(

$table_name = sprintf('glpitests_%s', uniqid());

$this->newTestedInstance($DB);
$instance = new DatabaseSchemaConsistencyChecker($DB);
$DB->doQuery(sprintf($create_table_sql, $table_name));
$missing_fields = $this->testedInstance->getMissingFields($table_name);
$missing_fields = $instance->getMissingFields($table_name);
$DB->doQuery(sprintf('DROP TABLE `%s`', $table_name));

$this->array($missing_fields)->isEqualTo($expected_missing);
$this->assertEquals($expected_missing, $missing_fields);
}
}

0 comments on commit a4b0642

Please sign in to comment.