Example #1
0
 public function testUpdatePositionWithSpecificPosition()
 {
     $folder = FolderQuery::create()->filterByParent($this->getFolderIdForPositionTest())->filterByPosition(1, Criteria::GREATER_THAN)->findOne();
     if (null === $folder) {
         $this->fail('use fixtures before launching test, there is no folder in database');
     }
     $event = new UpdatePositionEvent($folder->getId(), UpdatePositionEvent::POSITION_ABSOLUTE, 1);
     $event->setDispatcher($this->dispatcher);
     $folderAction = new Folder();
     $folderAction->updatePosition($event);
     $updatedFolder = FolderQuery::create()->findPk($folder->getId());
     $this->assertEquals(1, $updatedFolder->getPosition(), sprintf("new position is 1, new position expected is %d for folder %d", $updatedFolder->getPosition(), $updatedFolder->getId()));
 }