Permalink
Browse files

Soft drop require the database `'sources'` 'hint'.

  • Loading branch information...
1 parent 1fa90fe commit 32e1e56bbe8ab5f997bc3181443c5608fd170ace @jails jails committed Mar 27, 2013
Showing with 5 additions and 11 deletions.
  1. +2 −2 test/Fixture.php
  2. +3 −9 tests/cases/test/FixtureTest.php
View
4 test/Fixture.php
@@ -244,7 +244,7 @@ public function drop($soft = true) {
if (!$db::enabled('schema')) {
return $this->truncate();
}
- if ($soft) {
+ if ($soft && $db::enabled('sources')) {
$sources = $db->sources();
if(!in_array($this->_source, $sources)) {
return true;
@@ -286,7 +286,7 @@ public function populate(array $record = array(), $alter = true) {
public function truncate($soft = true) {
$connections = $this->_classes['connections'];
$db = $connections::get($this->_connection);
- if ($soft) {
+ if ($soft && $db::enabled('sources')) {
$sources = $db->sources();
if(!in_array($this->_source, $sources)) {
return true;
View
12 tests/cases/test/FixtureTest.php
@@ -314,29 +314,23 @@ public function testSchemaLess() {
$fixture->drop();
$call = $this->_callable->call[0];
- $this->assertEqual('sources', $call['method']);
- $call = $this->_callable->call[1];
$this->assertEqual('delete', $call['method']);
$this->_callable->__clear();
$this->_callable->return = array('sources' => array('contacts'));
$fixture->create();
$call = $this->_callable->call[0];
- $this->assertEqual('sources', $call['method']);
- $call = $this->_callable->call[1];
- $this->assertEqual(2, count($this->_callable->call));
+ $this->assertEqual(1, count($this->_callable->call));
$this->assertEqual('delete', $call['method']);
$this->_callable->__clear();
$this->_callable->return = array('sources' => array('contacts'));
$fixture->save();
- $this->assertEqual(3, count($this->_callable->call));
+ $this->assertEqual(2, count($this->_callable->call));
$call = $this->_callable->call[0];
- $this->assertEqual('sources', $call['method']);
- $call = $this->_callable->call[1];
$this->assertEqual('delete', $call['method']);
- $call = $this->_callable->call[2];
+ $call = $this->_callable->call[1];
$this->assertEqual('create', $call['method']);
$this->assertEqual(array('data' => $record), $call['params'][0]->data());
}

0 comments on commit 32e1e56

Please sign in to comment.