Skip to content

Commit

Permalink
update of test cases
Browse files Browse the repository at this point in the history
use assertTrue|False instead of `assertEquals`
  • Loading branch information
quickapps authored and lorenzo committed Mar 29, 2014
1 parent e50538f commit 78bee17
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions tests/TestCase/Model/Behavior/TreeBehaviorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,23 +166,23 @@ public function testMoveUp() {
$table->addBehavior('Tree', ['scope' => ['menu' => 'main-menu']]);

// top level, wont move
$this->assertEquals(false, $this->table->moveUp(1, 10));
$this->assertFalse($this->table->moveUp(1, 10));

// edge cases
$this->assertEquals(false, $this->table->moveUp(1, 0));
$this->assertEquals(false, $this->table->moveUp(1, -10));
$this->assertFalse($this->table->moveUp(1, 0));
$this->assertFalse($this->table->moveUp(1, -10));

// move unexisting node
$this->assertEquals(false, $table->moveUp(500, 1));
$this->assertFalse($table->moveUp(500, 1));

// move inner node
$result = $table->moveUp(3, 1);
$nodes = $table->find('children', ['for' => 1])->all();
$this->assertEquals([3, 4, 5, 2], $nodes->extract('id')->toArray());
$this->assertEquals(true, $result);
$this->assertTrue($result);

// move leaf
$this->assertEquals(false, $table->moveUp(5, 1));
$this->assertFalse($table->moveUp(5, 1));

// move to first position
$table->moveUp(8, true);
Expand All @@ -204,24 +204,24 @@ public function testMoveDown() {
$table->addBehavior('Tree', ['scope' => ['menu' => 'main-menu']]);

// latest node, wont move
$this->assertEquals(false, $this->table->moveDown(8, 10));
$this->assertFalse($this->table->moveDown(8, 10));

// edge cases
$this->assertEquals(false, $this->table->moveDown(8, 0));
$this->assertEquals(false, $this->table->moveUp(8, -10));
$this->assertFalse($this->table->moveDown(8, 0));
$this->assertFalse($this->table->moveUp(8, -10));

// move inner node
$nodeIds = [];
$result = $table->moveDown(2, 1);
$nodes = $table->find('children', ['for' => 1])->all();
$this->assertEquals([3, 4, 5, 2], $nodes->extract('id')->toArray());
$this->assertEquals(true, $result);
$this->assertTrue($result);

// move unexisting node
$this->assertEquals(false, $table->moveDown(500, 1));
$this->assertFalse($table->moveDown(500, 1));

// move leaf
$this->assertEquals(false, $table->moveDown(5, 1));
$this->assertFalse( $table->moveDown(5, 1));

// move to last position
$table->moveDown(1, true);
Expand Down

0 comments on commit 78bee17

Please sign in to comment.