Browse Source

Correctly expressing IS NULL expressions

Jose Lorenzo Rodriguez 12 years ago
parent
commit
78ae99580c
1 changed files with 8 additions and 2 deletions
  1. 8 2
      tests/TestCase/Model/Behavior/TreeBehaviorTest.php

+ 8 - 2
tests/TestCase/Model/Behavior/TreeBehaviorTest.php

@@ -185,7 +185,10 @@ class TreeBehaviorTest extends TestCase {
 		$table->moveUp(8, true);
 		$table->moveUp(8, true);
 		$nodes = $table->find()
 		$nodes = $table->find()
 			->select(['id'])
 			->select(['id'])
-			->where(['parent_id IS' => null, 'menu' => 'main-menu'])
+			->where(function($exp) {
+				return $exp->isNull('parent_id');
+			})
+			->where(['menu' => 'main-menu'])
 			->order(['lft' => 'ASC'])
 			->order(['lft' => 'ASC'])
 			->all();
 			->all();
 		$this->assertEquals([8, 1, 6], $nodes->extract('id')->toArray());
 		$this->assertEquals([8, 1, 6], $nodes->extract('id')->toArray());
@@ -232,7 +235,10 @@ class TreeBehaviorTest extends TestCase {
 		$table->moveDown(1, true);
 		$table->moveDown(1, true);
 		$nodes = $table->find()
 		$nodes = $table->find()
 			->select(['id'])
 			->select(['id'])
-			->where(['parent_id IS' => null, 'menu' => 'main-menu'])
+			->where(function($exp) {
+				return $exp->isNull('parent_id');
+			})
+			->where(['menu' => 'main-menu'])
 			->order(['lft' => 'ASC'])
 			->order(['lft' => 'ASC'])
 			->all();
 			->all();
 		$this->assertEquals([6, 8, 1], $nodes->extract('id')->toArray());
 		$this->assertEquals([6, 8, 1], $nodes->extract('id')->toArray());