Esempio n. 1
0
 public function testCreate()
 {
     $event = new AreaCreateEvent();
     $event->setAreaName('foo')->setDispatcher($this->getMock("Symfony\\Component\\EventDispatcher\\EventDispatcherInterface"));
     $areaAction = new Area();
     $areaAction->create($event);
     $createdArea = $event->getArea();
     $this->assertInstanceOf('Thelia\\Model\\Area', $createdArea);
     $this->assertFalse($createdArea->isNew());
     $this->assertTrue($event->hasArea());
     $this->assertEquals('foo', $createdArea->getName());
     return $createdArea;
 }
Esempio n. 2
0
 public function testCreate()
 {
     $event = new AreaCreateEvent();
     $event->setAreaName('foo');
     $areaAction = new Area();
     $areaAction->create($event, null, $this->getMockEventDispatcher());
     $createdArea = $event->getArea();
     $this->assertInstanceOf('Thelia\\Model\\Area', $createdArea);
     $this->assertFalse($createdArea->isNew());
     $this->assertTrue($event->hasArea());
     $this->assertEquals('foo', $createdArea->getName());
     return $createdArea;
 }
Esempio n. 3
0
 /**
  * @param \Thelia\Core\Event\Area\AreaCreateEvent $event
  * @param array $formData
  * @return \Thelia\Core\Event\Area\AreaCreateEvent
  */
 private function hydrateEvent($event, $formData)
 {
     $event->setAreaName($formData['name']);
     return $event;
 }
Esempio n. 4
0
 public function create(AreaCreateEvent $event)
 {
     $area = new AreaModel();
     $area->setDispatcher($event->getDispatcher())->setName($event->getAreaName())->save();
     $event->setArea($area);
 }
Esempio n. 5
0
 public function create(AreaCreateEvent $event, $eventName, EventDispatcherInterface $dispatcher)
 {
     $area = new AreaModel();
     $area->setDispatcher($dispatcher)->setName($event->getAreaName())->save();
     $event->setArea($area);
 }