コード例 #1
0
 public function testMoveUp()
 {
     $item1 = new SortableItem();
     $item1->save();
     $item2 = new SortableItem();
     $item2->save();
     $this->assertTrue($item1->position < $item2->position);
     $item2->moveUp();
     $this->assertTrue($item1->refresh()->position > $item2->position);
 }
コード例 #2
0
 public function testMoveUpFirstDoesNothing()
 {
     $item1 = new SortableItem();
     $item1->save();
     $item2 = new SortableItem();
     $item2->save();
     $this->assertTrue($item1->position < $item2->position);
     $item1->moveUp();
     $this->assertTrue($item1->position < $item2->position);
 }