public function toEntity($data, $type) { if ('photon' == $type) { $data = $this->normalizePhotonData($data); } if (empty($data)) { return new Location(); } $entity = new Location(); $entity->setCity($data['city'])->setRegion($data['region'])->setPostalcode($data['postalcode'])->setCountry($data['country']); if (!empty($data['coordinates'])) { $entity->setCoordinates(new Point($data['coordinates'])); } return $entity; }
/** * @testdox Allows setting multi job locations * @covers Jobs\Entity\Job::getLocations * @covers Jobs\Entity\Job::setLocations */ public function testSetGetLocations() { $arrayCollection = new ArrayCollection(); $location = new Location(); $location->setCity("Frankfurt"); $arrayCollection->add($location); $this->target->setLocations($arrayCollection); $this->assertEquals($arrayCollection, $this->target->getLocations()); }
/** * @testdox Allows setting and getting the email address */ public function testSettingAndGettingTheCity() { $city = 'Frankfurt am Main'; $this->target->setCity($city); $this->assertEquals($city, $this->target->getCity()); }