Пример #1
0
 public function testCreateSale()
 {
     $event = new SaleCreateEvent();
     $event->setLocale('en_US')->setTitle('test create sale')->setSaleLabel('test create sale label');
     $saleAction = new Sale($this->getMockEventDispatcher());
     $saleAction->create($event);
     $createdSale = $event->getSale();
     $this->assertInstanceOf('Thelia\\Model\\Sale', $createdSale);
     $this->assertEquals('test create sale', $createdSale->getTitle());
     $this->assertEquals('test create sale label', $createdSale->getSaleLabel());
 }
Пример #2
0
 /**
  * Creates the creation event with the provided form data
  *
  * @param  array           $formData
  * @return SaleCreateEvent
  */
 protected function getCreationEvent($formData)
 {
     $saleCreateEvent = new SaleCreateEvent();
     $saleCreateEvent->setLocale($formData['locale'])->setTitle($formData['title'])->setSaleLabel($formData['label']);
     return $saleCreateEvent;
 }