Example #1
0
 /**
  * @param CategoryModel $category
  * @depends testCreate
  */
 public function testUpdate(CategoryModel $category)
 {
     $event = new CategoryUpdateEvent($category->getId());
     $event->setLocale('en_US')->setTitle('bar')->setDescription('bar description')->setChapo('bar chapo')->setPostscriptum('bar postscriptum')->setVisible(0)->setParent(0)->setDispatcher($this->getDispatcher());
     $action = new Category();
     $action->update($event);
     $updatedCategory = $event->getCategory();
     $this->assertInstanceOf('Thelia\\Model\\Category', $updatedCategory);
     $this->assertEquals('en_US', $updatedCategory->getLocale());
     $this->assertEquals('bar', $updatedCategory->getTitle());
     $this->assertEquals('bar description', $updatedCategory->getDescription());
     $this->assertEquals('bar chapo', $updatedCategory->getChapo());
     $this->assertEquals('bar postscriptum', $updatedCategory->getPostscriptum());
     $this->assertEquals(0, $updatedCategory->getVisible());
     $this->assertEquals(0, $updatedCategory->getParent());
     return $updatedCategory;
 }
Example #2
0
 /**
  * @param CategoryModel $category
  * @depends testCreate
  * @return CategoryModel
  */
 public function testUpdate(CategoryModel $category)
 {
     $template = new Template();
     $template->setName('A sample template')->save();
     $event = new CategoryUpdateEvent($category->getId());
     $event->setLocale('en_US')->setTitle('bar')->setDescription('bar description')->setChapo('bar chapo')->setPostscriptum('bar postscriptum')->setVisible(0)->setParent(0)->setDefaultTemplateId($template->getId());
     $action = new Category();
     $action->update($event, null, $this->getMockEventDispatcher());
     $updatedCategory = $event->getCategory();
     $this->assertInstanceOf('Thelia\\Model\\Category', $updatedCategory);
     $this->assertEquals('en_US', $updatedCategory->getLocale());
     $this->assertEquals('bar', $updatedCategory->getTitle());
     $this->assertEquals('bar description', $updatedCategory->getDescription());
     $this->assertEquals('bar chapo', $updatedCategory->getChapo());
     $this->assertEquals('bar postscriptum', $updatedCategory->getPostscriptum());
     $this->assertEquals(0, $updatedCategory->getVisible());
     $this->assertEquals($template->getId(), $updatedCategory->getDefaultTemplateId());
     $this->assertEquals(0, $updatedCategory->getParent());
     return [$updatedCategory, $template];
 }