Skip to content
Permalink
Browse files

Fixture table should be dropped only if we can rebuild it later

If the fixture `_schema` property is not an instance of Table, it will not be possible to restore the table later on, so the table should not be dropped in that case.
  • Loading branch information...
HavokInspiration committed Feb 11, 2016
1 parent 8dee7c2 commit 813767314f8fa9b78de726004237c1b6bc604f8a
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/TestSuite/Fixture/FixtureManager.php
@@ -16,6 +16,7 @@
use Cake\Core\Configure;
use Cake\Core\Exception\Exception;
use Cake\Database\Schema\Table;
use Cake\Datasource\ConnectionManager;
use Cake\Utility\Inflector;
use PDOException;
@@ -235,7 +236,9 @@ protected function _setupTable($fixture, $db, array $sources, $drop = true)
$table = $fixture->sourceName();
$exists = in_array($table, $sources);
if (($drop && $exists) || ($exists && !$isFixtureSetup)) {
if (($drop && $exists) ||
($exists && !$isFixtureSetup && $fixture->schema() instanceof Table)
) {
$fixture->drop($db);
$fixture->create($db);
} elseif (!$exists) {

0 comments on commit 8137673

Please sign in to comment.
You can’t perform that action at this time.