mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
parent
7c697eb9be
commit
83ceef045d
1 changed files with 15 additions and 28 deletions
|
@ -6080,7 +6080,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
}
|
||||
|
||||
public function testToggleBoolFields() {
|
||||
$this->loadFixtures('CounterCachePost');
|
||||
$this->loadFixtures('CounterCacheUser', 'CounterCachePost');
|
||||
$Post = new CounterCachePost();
|
||||
$Post->unbindModel(array('belongsTo' => array('User')), true);
|
||||
|
||||
|
@ -6094,36 +6094,23 @@ class ModelWriteTest extends BaseModelTest {
|
|||
$this->assertEqual($result, $true);
|
||||
|
||||
// Testing without the alias
|
||||
$this->assertTrue($Post->updateAll(array('published' => '1 - published'), $updateConditions));
|
||||
$this->assertTrue($Post->updateAll(array('published' => 'NOT published'), $updateConditions));
|
||||
$result = $Post->find('first', array('conditions' => $updateConditions, 'fields' => $fields));
|
||||
$this->assertEqual($result, $false);
|
||||
|
||||
$this->assertTrue($Post->updateAll(array('published' => '1 - published'), $updateConditions));
|
||||
$this->assertTrue($Post->updateAll(array('published' => 'NOT published'), $updateConditions));
|
||||
$result = $Post->find('first', array('conditions' => $updateConditions, 'fields' => $fields));
|
||||
$this->assertEqual($result, $true);
|
||||
|
||||
$db = ConnectionManager::getDataSource('test');
|
||||
$alias = $db->name('Post.published');
|
||||
|
||||
// Testing with the alias
|
||||
$this->assertTrue($Post->updateAll(array('Post.published' => '1 - Post.published'), $updateConditions));
|
||||
$this->assertTrue($Post->updateAll(array('Post.published' => "NOT $alias"), $updateConditions));
|
||||
$result = $Post->find('first', array('conditions' => $updateConditions, 'fields' => $fields));
|
||||
$this->assertEqual($result, $false);
|
||||
|
||||
$this->assertTrue($Post->updateAll(array('Post.published' => '1 - Post.published'), $updateConditions));
|
||||
$result = $Post->find('first', array('conditions' => $updateConditions, 'fields' => $fields));
|
||||
$this->assertEqual($result, $true);
|
||||
|
||||
$this->assertTrue($Post->updateAll(array('Post.published = 1 - Post.published'), $updateConditions));
|
||||
$result = $Post->find('first', array('conditions' => $updateConditions, 'fields' => $fields));
|
||||
$this->assertEqual($result, $false);
|
||||
|
||||
$this->assertTrue($Post->updateAll(array('Post.published = 1 - Post.published'), $updateConditions));
|
||||
$result = $Post->find('first', array('conditions' => $updateConditions, 'fields' => $fields));
|
||||
$this->assertEqual($result, $true);
|
||||
|
||||
$this->assertTrue($Post->updateAll(array('Post.published' => '! Post.published'), $updateConditions));
|
||||
$result = $Post->find('first', array('conditions' => $updateConditions, 'fields' => $fields));
|
||||
$this->assertEqual($result, $false);
|
||||
|
||||
$this->assertTrue($Post->updateAll(array('Post.published' => 'NOT Post.published'), $updateConditions));
|
||||
$this->assertTrue($Post->updateAll(array('Post.published' => "NOT $alias"), $updateConditions));
|
||||
$result = $Post->find('first', array('conditions' => $updateConditions, 'fields' => $fields));
|
||||
$this->assertEqual($result, $true);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue