Fix notice error for fixtures with imported tables.

Don't emit an error when a fixture has an imported table with no primary.

Fixes #3659
This commit is contained in:
mark_story 2013-03-03 20:59:09 -05:00
parent c1c9a9dfc4
commit e3b870dbf7

View file

@ -283,7 +283,11 @@ class CakeTestFixture {
$nested = $db->useNestedTransactions;
$db->useNestedTransactions = false;
$result = $db->insertMulti($this->table, $fields, $values);
if ($this->primaryKey && in_array($this->fields[$this->primaryKey]['type'], array('integer', 'biginteger'))) {
if (
$this->primaryKey &&
isset($this->fields[$this->primaryKey]['type']) &&
in_array($this->fields[$this->primaryKey]['type'], array('integer', 'biginteger'))
) {
$db->resetSequence($this->table, $this->primaryKey);
}
$db->useNestedTransactions = $nested;