Skip to content

Commit

Permalink
DB tests: truncate test table on test setup
Browse files Browse the repository at this point in the history
  • Loading branch information
godefroy-le-hardi committed Feb 22, 2019
1 parent 73a8e0b commit 0bb80cf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 21 deletions.
Expand Up @@ -101,6 +101,7 @@ public function setUp()
parent::setUp();

$this->initializeDatabase();
$this->truncateTestTable();
$this->assureTestTableIsEmpty();
}

Expand Down Expand Up @@ -264,16 +265,7 @@ protected function assertObjectHasAttributeWithValue($object, $attributeName, $a

protected function assureTestTableIsEmpty()
{
if (!$this->isEmptyTestTable()) {
$this->truncateTestTable();
}

$this->assertEmpty($this->fetchAllTestTableRows(), "Problem while truncating the table '" . self::TABLE_NAME . "'!");
}

protected function isEmptyTestTable()
{
return empty($this->fetchAllTestTableRows());
$this->assertEmpty($this->fetchAllTestTableRows(), "Table '" . self::TABLE_NAME . "' is empty");
}

protected function fetchAllTestTableRows()
Expand Down
Expand Up @@ -1413,17 +1413,6 @@ protected function isEmptyTestTable()
return empty($this->fetchAllTestTableRows());
}

/**
* Helper methods to be used in all tests extending this class
*/
/**
* Assure, that the table oxdoctrinetest is empty. If it is not empty, the test will fail.
*/
protected function assureTestTableIsEmpty()
{
$this->assertEmpty($this->fetchAllTestTableRows(), "Table '" . self::TABLE_NAME . "' is empty");
}

/**
* Get an instance of ConfigFile based on a empty file.
*
Expand Down

0 comments on commit 0bb80cf

Please sign in to comment.