Ejemplo n.º 1
0
 public function testZonePlanFunctions()
 {
     $addressAesch = $this->init->createTestAddressAesch();
     $zone = Zone::createUnclassifiedZone('Fernfahrt');
     $this->init->zoneRepo->store($zone);
     $zone = Zone::registerZone('kantonal123456', 2);
     $this->init->zoneRepo->store($zone);
     $zonePlan = ZonePlan::registerZonePlan('habakuck', '3231');
     $zonePlan->setZone($zone);
     $this->init->zonePlanRepo->store($zonePlan);
     $this->init->em->flush();
     $this->assertTrue($this->init->zoneRepo->checkIfNameAlreadyExist('kantonal123456'));
     $zoneAdd = $this->init->zonePlanManagement->getZoneForAddress($addressAesch);
     $this->assertNotNull($zoneAdd);
     $zoneCity = $this->init->zonePlanManagement->getZoneForCity('habakuck');
     $this->assertNotNull($zoneCity);
 }
Ejemplo n.º 2
0
 public function testZonePlanCRUD()
 {
     $zone = $this->createZone('Kantonal', 1);
     $city = 'Baar';
     $zonePlan = ZonePlan::registerZonePlan($city, '4664', 'memo');
     if (!$this->init->zonePlanRepo->checkIfCityAlreadyExist($city)) {
         $this->init->zonePlanRepo->store($zonePlan);
         $zone->assignZonePlan($zonePlan);
     } else {
         $zonePlan = $this->init->zonePlanRepo->findOneBy(array('city' => $city));
         $zone->assignZonePlan($zonePlan);
     }
     $this->init->em->flush();
     $zonePlanFind = $this->init->zonePlanRepo->find($zonePlan->getId());
     $this->assertEquals($zonePlan, $zonePlanFind);
     $city2 = 'Baar1234567890123789123';
     $zonePlan->updateZonePlan($city2, '2372');
     $this->init->em->flush();
     $find = $this->init->zonePlanRepo->findOneBy(array('city' => $city2));
     $this->assertEquals($zonePlan, $find);
 }
Ejemplo n.º 3
0
 /**
  * @param ZonePlanRegisterDTO $dto
  * @return ZonePlan
  */
 public function registerDTOtoNewZonePlan(ZonePlanRegisterDTO $dto)
 {
     $zonePlan = ZonePlan::registerZonePlan($dto->city, $dto->postalCode, $dto->memo, $dto->abbreviation);
     $zonePlan->setZone($dto->zone);
     return $zonePlan;
 }