public function testNormalisePostCode() { $original = '1AA 2BB'; $expected = strtolower(str_replace(' ', '', $original)); $this->assertEmpty($this->instance->getPostcode()); $this->assertEmpty($this->instance->getNormalisedPostcode()); $this->assertInstanceOf(Authority::class, $this->instance->setPostcode($original)); $this->assertEquals($original, $this->instance->getPostcode()); $this->assertEquals($expected, $this->instance->getNormalisedPostcode()); }
/** * @param ObjectManager $manager * @return LoadTestPostCodes */ protected function loadPostCodeInNewcastle(ObjectManager $manager) { $url = "newcastle.gov.uk"; $auth = new Authority(); $dc = new DistrictCouncil('E08000021', 'Newcastle upon Tyne'); $ew = new ElectoralWard('E05001111', 'Westgate'); $dc->setWebsite($url); $auth->setDistrictCouncil($dc); $auth->setCountry('England'); $auth->setCounty($this->englandGlobalCounty); $auth->setElectoralWard($ew); $auth->setPostcode("NE1 7RS"); $manager->persist($auth); $manager->flush(); return $this; }
/** * @param Authority $authority * @return array<Authority> */ public function findByPostCode(Authority $authority) { return $this->findBy(array('normalisedPostcode' => $authority->getPostcode())); }
/** * @param Authority $updateAuthority * @param Authority $baseAuthority */ protected function updateParishCouncil(Authority $updateAuthority, Authority &$baseAuthority) { if ($updateAuthority->getParishCouncil() instanceof ParishCouncil) { $baseAuthority->setParishCouncil($updateAuthority->getParishCouncil()); } }
/** * @param string $parishCode * @param Authority $authority * @return Authority */ protected function addParishCouncilToAuthority($parishCode, Authority $authority) { $council = $this->getParishCouncilService()->findByEntityCode(new ParishCouncil($parishCode, '')); if ($council instanceof ParishCouncil) { $authority->setParishCouncil($council); } return $authority; }