Skip to content

Commit

Permalink
Remove conditionals in tests.
Browse files Browse the repository at this point in the history
These conditionals were required before because the table was left
behind between test runs. When test order was modified tests could fail.
  • Loading branch information
markstory committed Mar 25, 2016
1 parent e400bc1 commit db6869d
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions tests/TestCase/TestSuite/TestFixtureTest.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -281,18 +281,15 @@ public function testInitNoImportNoFieldsException()
public function testInitNoImportNoFields() public function testInitNoImportNoFields()
{ {
$db = ConnectionManager::get('test'); $db = ConnectionManager::get('test');
$collection = $db->schemaCollection(); $table = new Table('letters', [
if (!in_array('letters', $collection->listTables())) { 'id' => ['type' => 'integer'],
$table = new Table('letters', [ 'letter' => ['type' => 'string', 'length' => 1]
'id' => ['type' => 'integer'], ]);
'letter' => ['type' => 'string', 'length' => 1] $table->addConstraint('primary', ['type' => 'primary', 'columns' => ['id']]);
]); $sql = $table->createSql($db);
$table->addConstraint('primary', ['type' => 'primary', 'columns' => ['id']]);
$sql = $table->createSql($db); foreach ($sql as $stmt) {

$db->execute($stmt);
foreach ($sql as $stmt) {
$db->execute($stmt);
}
} }


$fixture = new LettersFixture(); $fixture = new LettersFixture();
Expand All @@ -306,6 +303,10 @@ public function testInitNoImportNoFields()
->method('execute'); ->method('execute');
$this->assertTrue($fixture->create($db)); $this->assertTrue($fixture->create($db));
$this->assertTrue($fixture->drop($db)); $this->assertTrue($fixture->drop($db));

// Cleanup.
$db = ConnectionManager::get('test');
$db->execute('DROP TABLE letters');
} }


/** /**
Expand Down

0 comments on commit db6869d

Please sign in to comment.