コード例 #1
0
 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());
 }
コード例 #2
0
 /**
  * @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;
 }
コード例 #3
0
 /**
  * @param Authority $updateAuthority
  * @param Authority $baseAuthority
  */
 protected function updateElectoralWard(Authority $updateAuthority, Authority &$baseAuthority)
 {
     if ($updateAuthority->getElectoralWard() instanceof ElectoralWard) {
         $baseAuthority->setElectoralWard($updateAuthority->getElectoralWard());
     }
 }
コード例 #4
0
 /**
  * @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;
 }