コード例 #1
0
 public function testGetSetCountry()
 {
     $expected = "COUNTRY";
     $this->assertEmpty($this->instance->getCountry());
     $this->assertTrue($this->instance->setCountry($expected) instanceof Address);
     $this->assertEquals($expected, $this->instance->getCountry());
 }
 /**
  * @param Address &$address
  * @return bool
  */
 protected function loadAuthorityForPostCode(Address &$address)
 {
     /** @var array<Authority> $lha */
     $lha = $this->lhaService->findByPostCode(strtolower(str_replace(' ', '', $address->getPostcode())));
     if (count($lha)) {
         $address->setCountry($lha[0]->getCountry())->setCounty($lha[0]->getCountyName())->setDistrict($lha[0]->getDistrictCouncilName());
         return true;
     }
     return false;
 }