/** * @param AreaModel $area * @depends testUpdatePostage * @return AreaModel */ public function testAddCountry(AreaModel $area) { $country = CountryQuery::create()->findOne(); $event = new AreaAddCountryEvent($area->getId(), [$country->getId()]); $areaAction = new Area(); $areaAction->addCountry($event); $updatedArea = $event->getArea(); $updatedCountry = CountryAreaQuery::create()->findOneByAreaId($updatedArea->getId()); $this->assertInstanceOf('Thelia\\Model\\Area', $updatedArea); $this->assertEquals($country->getId(), $updatedCountry->getCountryId()); return $updatedArea; }
/** * @param AreaModel $area * @depends testUpdatePostage */ public function testAddCountry(AreaModel $area) { $country = CountryQuery::create()->findOne(); $event = new AreaAddCountryEvent($area->getId(), [$country->getId()]); $event->setDispatcher($this->getMock("Symfony\\Component\\EventDispatcher\\EventDispatcherInterface")); $areaAction = new Area(); $areaAction->addCountry($event); $updatedArea = $event->getArea(); $updatedCountry = CountryQuery::create()->findOneByAreaId($updatedArea->getId()); $this->assertInstanceOf('Thelia\\Model\\Area', $updatedArea); $this->assertEquals($country->getId(), $updatedCountry->getId()); return $updatedArea; }