Example #1
0
 /**
  * test update creation
  * @covers Thelia\Action\Folder::update
  */
 public function testUpdateFolder()
 {
     $folder = $this->getRandomFolder();
     $visible = !$folder->getVisible();
     $event = new FolderUpdateEvent($folder->getId());
     $event->setDispatcher($this->dispatcher);
     $event->setLocale('en_US')->setTitle('test update folder')->setVisible($visible)->setChapo('test folder update chapo')->setDescription('update folder description')->setPostscriptum('update folder postscriptum')->setParent(0);
     $folderAction = new Folder();
     $folderAction->update($event);
     $updatedFolder = $event->getFolder();
     $this->assertInstanceOf('Thelia\\Model\\Folder', $updatedFolder);
     $this->assertEquals('test update folder', $updatedFolder->getTitle());
     $this->assertEquals('test folder update chapo', $updatedFolder->getChapo());
     $this->assertEquals('update folder description', $updatedFolder->getDescription());
     $this->assertEquals('update folder postscriptum', $updatedFolder->getPostscriptum());
     $this->assertEquals(0, $updatedFolder->getParent());
     $this->assertEquals($visible, $updatedFolder->getVisible());
 }
Example #2
0
 /**
  * Creates the update event with the provided form data
  *
  * @param unknown $formData
  */
 protected function getUpdateEvent($formData)
 {
     $updateEvent = new FolderUpdateEvent($formData['id']);
     $updateEvent->setLocale($formData['locale'])->setTitle($formData['title'])->setChapo($formData['chapo'])->setDescription($formData['description'])->setPostscriptum($formData['postscriptum'])->setVisible($formData['visible'])->setParent($formData['parent']);
     return $updateEvent;
 }