/** * @test */ public function it_should_remove_a_province() { $province = $this->getMock('\\LMammino\\EFoundation\\Address\\Model\\ProvinceInterface'); $this->country->addProvince($province); $this->assertTrue($this->country->hasProvince($province)); $this->country->removeProvince($province); $this->assertFalse($this->country->hasProvince($province)); }
/** * Returns a string representation of the address * * @return string */ public function __toString() { $data = array(); $data[] = implode(' ', array($this->firstName, $this->lastName)); $data[] = $this->companyName; $data[] = $this->companyIdentifier; $data[] = $this->street; $region = $this->city; if ($this->province) { $provinceName = $this->province->getShortName() ? $this->province->getShortName() : $this->province->getName(); $region .= sprintf(' (%s)', $provinceName); } $data[] = implode(' ', array($this->postCode, $region)); if ($this->country) { $data[] = $this->country->getName(); } for ($i = 0; $i < sizeof($data); $i++) { if (empty($data[$i])) { unset($data[$i]); } } return implode("\n", $data); }