From 2f5d91ac880c56eac4e84ff77d43f1713946cd73 Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Tue, 1 Oct 2013 14:49:30 +0200 Subject: [PATCH] test folder UpdatePosition with specific position --- core/lib/Thelia/Tests/Action/FolderTest.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/core/lib/Thelia/Tests/Action/FolderTest.php b/core/lib/Thelia/Tests/Action/FolderTest.php index 3c622a18a..903e1b77b 100644 --- a/core/lib/Thelia/Tests/Action/FolderTest.php +++ b/core/lib/Thelia/Tests/Action/FolderTest.php @@ -185,6 +185,27 @@ class FolderTest extends BaseAction $this->assertEquals($newPosition, $updatedFolder->getPosition(),sprintf("new position is %d, new position expected is %d for folder %d", $newPosition, $updatedFolder->getPosition(), $updatedFolder->getId())); } + public function testUpdatePositionWithSpecificPosition() + { + $folder = FolderQuery::create() + ->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); + + $folderAction = new Folder($this->getContainer()); + $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())); + + } + /** * @return \Thelia\Model\Folder */