コード例 #1
0
ファイル: ContentTest.php プロジェクト: fachriza/thelia
 public function testUpdatePositionWithSpecificPosition()
 {
     $content = ContentQuery::create()->filterByFolder($this->getFolderForPositionTest())->filterByPosition(1, Criteria::GREATER_THAN)->findOne();
     if (null === $content) {
         $this->fail('use fixtures before launching test, there is no content in database');
     }
     $event = new UpdatePositionEvent($content->getId(), UpdatePositionEvent::POSITION_ABSOLUTE, 1);
     $event->setDispatcher($this->dispatcher);
     $contentAction = new Content($this->getContainer());
     $contentAction->updatePosition($event);
     $updatedContent = ContentQuery::create()->findPk($content->getId());
     $this->assertEquals(1, $updatedContent->getPosition(), sprintf("new position is 1, new position expected is %d for content %d", $updatedContent->getPosition(), $updatedContent->getId()));
 }
コード例 #2
0
ファイル: BrandTest.php プロジェクト: alex63530/thelia
 public function testUpdatePositionWithSpecificPosition()
 {
     $this->resetBrandPosition();
     $brand = BrandQuery::create()->filterByPosition(1, Criteria::GREATER_THAN)->findOne();
     if (null === $brand) {
         $this->fail('use fixtures before launching test, there is no brand in database');
     }
     $event = new UpdatePositionEvent($brand->getId(), UpdatePositionEvent::POSITION_ABSOLUTE, 1);
     $event->setDispatcher($this->dispatcher);
     $brandAction = new Brand($this->getContainer());
     $brandAction->updatePosition($event);
     $updatedBrand = BrandQuery::create()->findPk($brand->getId());
     $this->assertEquals(1, $updatedBrand->getPosition(), sprintf("new position is 1, new position expected is %d for brand %d", $updatedBrand->getPosition(), $updatedBrand->getId()));
 }