示例#1
0
 /**
  * @param AreaModel $area
  * @depends testAddCountry
  */
 public function testRemoveCountry(AreaModel $area)
 {
     $country = CountryQuery::create()->filterByArea($area)->find()->getFirst();
     $event = new AreaRemoveCountryEvent($area->getId(), $country->getId());
     $event->setDispatcher($this->getMock("Symfony\\Component\\EventDispatcher\\EventDispatcherInterface"));
     $areaAction = new Area();
     $areaAction->removeCountry($event);
     $updatedCountry = CountryQuery::create()->findPk($country->getId());
     $updatedArea = $event->getArea();
     $this->assertInstanceOf('Thelia\\Model\\Area', $updatedArea);
     $this->assertNull($updatedCountry->getAreaId());
     return $event->getArea();
 }
示例#2
0
 /**
  * @param AreaModel $area
  * @depends testAddCountry
  * @return AreaModel
  */
 public function testRemoveCountry(AreaModel $area)
 {
     $country = CountryQuery::create()->filterByArea($area)->find()->getFirst();
     $event = new AreaRemoveCountryEvent($area->getId(), $country->getId());
     $areaAction = new Area();
     $areaAction->removeCountry($event);
     $updatedCountry = CountryAreaQuery::create()->filterByCountryId($country->getId())->filterByStateId(null)->filterByAreaId($area->getId())->findOne();
     $updatedArea = $event->getArea();
     $this->assertInstanceOf('Thelia\\Model\\Area', $updatedArea);
     $this->assertNull($updatedCountry);
     return $event->getArea();
 }