public function testGetSetElectoralWard() { $expected = new ElectoralWard('CODE', 'NAME'); $this->assertEmpty($this->instance->getElectoralWard()); $this->assertEmpty($this->instance->getElectoralWardName()); $this->assertInstanceOf(Authority::class, $this->instance->setElectoralWard($expected)); $this->assertEquals($expected, $this->instance->getElectoralWard()); $this->assertEquals($expected->getElectoralWardName(), $this->instance->getElectoralWardName()); }
/** * @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 $updateAuthority * @param Authority $baseAuthority */ protected function updateElectoralWard(Authority $updateAuthority, Authority &$baseAuthority) { if ($updateAuthority->getElectoralWard() instanceof ElectoralWard) { $baseAuthority->setElectoralWard($updateAuthority->getElectoralWard()); } }
/** * @param string $wardCode * @param Authority $authority * @return Authority */ protected function addElectoralWardToAuthority($wardCode, Authority $authority) { $ward = $this->getElectoralWardService()->findByEntityCode(new ElectoralWard($wardCode, '')); if ($ward instanceof ElectoralWard) { $authority->setElectoralWard($ward); } return $authority; }