/** * @test */ public function gettersShouldReturnTheAttributeValue() { $this->assertAttributeEquals($this->address->getCountry(), 'country', $this->address); $this->assertAttributeEquals($this->address->getState(), 'state', $this->address); $this->assertAttributeEquals($this->address->getCity(), 'city', $this->address); $this->assertAttributeEquals($this->address->getPostalCode(), 'postalCode', $this->address); $this->assertAttributeEquals($this->address->getDistrict(), 'district', $this->address); $this->assertAttributeEquals($this->address->getStreet(), 'street', $this->address); $this->assertAttributeEquals($this->address->getNumber(), 'number', $this->address); $this->assertAttributeEquals($this->address->getComplement(), 'complement', $this->address); }
public function testValidaStreet() { $street = 'Nome da Rua'; $address = new Address(); $address->setStreet($street); $this->assertEquals($street, $address->getStreet()); }
public function update(Address $object) { $q = "UPDATE " . self::TABLE . " SET `street`='" . Singleton::create("NullConverter")->fromDOMtoDB($object->getStreet()) . "', `location`='" . Singleton::create("NullConverter")->fromDOMtoDB($object->getLocation()) . "' WHERE addressId='" . addslashes($object->getAddressId()) . "'"; $pk = $object->getAddressId(); if ($object->isNew()) { if (empty($pk)) { $q = "INSERT INTO " . self::TABLE . " (`street`, `location`) VALUES ('" . Singleton::create("NullConverter")->fromDOMtoDB($object->getStreet()) . "', '" . Singleton::create("NullConverter")->fromDOMtoDB($object->getLocation()) . "')"; } else { $q = "INSERT INTO " . self::TABLE . " (`street`, `location`) VALUES ('" . Singleton::create("NullConverter")->fromDOMtoDB($object->getAddressId()) . "', '" . Singleton::create("NullConverter")->fromDOMtoDB($object->getStreet()) . "', '" . Singleton::create("NullConverter")->fromDOMtoDB($object->getLocation()) . "')"; } } $this->db->updateQuery($q); if (empty($pk)) { $pk = $this->db->selectQuery("SELECT addressId from " . self::TABLE . " ORDER BY addressId DESC limit 1")->getSingleton(); } $result = $this->findByPrimaryKey($pk); parent::$dbCache->resetEntity("Address"); parent::$dbCache->setSingle("Address", $pk, $result); return $result; }
public function __construct($name, TaxIdNumber $taxIdNumber, Address $address, BankAccount $account) { $this->name = $name; $this->taxIdNumber = (string) $taxIdNumber; $this->postalCode = $address->getPostalCode(); $this->street = $address->getStreet(); $this->city = $address->getCity(); $this->country = $address->getCountry(); $this->bankName = $account->getBankName(); $this->bankNumber = $account->getBankNumber(); $this->bicCode = $account->getBicCode(); }
/** * Formats an address. * * @param \Libreworks\Microformats\Address $address * @return string The HTML markup */ public function format(Address $address) { $fields = ['p-street-address' => $address->getStreet(), 'p-extended-address' => $address->getExtended(), 'p-post-office-box' => $address->getPobox(), 'p-locality' => $address->getLocality(), 'p-region' => $address->getRegion(), 'p-postal-code' => $address->getPostal(), 'p-country' => $address->getCountry()]; $tags = []; foreach ($fields as $k => $v) { if (strlen($v) > 0) { $tags[] = '<span class="' . $k . '">' . htmlspecialchars($v) . '</span>'; } } $geo = $address->getGeo(); if ($geo !== null) { $tags[] = '<span class="p-geo">' . $this->geoFormatter->format($geo) . '</span>'; } return '<span class="h-adr">' . implode(' ', $tags) . '</span>'; }
public function __construct($name, TaxIdNumber $taxIdNumber, Address $address, BankAccount $account) { if (!$name) { throw new \InvalidArgumentException('Name is required'); } $this->name = $name; $this->taxIdNumber = (string) $taxIdNumber; $this->postalCode = $address->getPostalCode(); $this->street = $address->getStreet(); $this->city = $address->getCity(); $this->country = $address->getCountry(); $this->bankName = $account->getBankName(); $this->bankNumber = $account->getBankNumber(); $this->bicCode = $account->getBicCode(); }
private function getParams(Address $address) { $params = array(':id' => $address->getId(), ':street_no' => $address->getStreetNo(), ':street' => $address->getStreet(), ':suburb' => $address->getSuburb(), ':city' => $address->getCity(), ':post_code' => $address->getPostCode()); return $params; }
public function encodeAddress(Address $address) { return ['street' => $address->getStreet(), 'street2' => $address->getStreet2(), 'zip' => $address->getZip(), 'city' => $address->getCity(), 'country' => $address->getCountry(), 'state' => $address->getState(), 'email' => $address->getEmail(), 'tel' => $address->getTel(), 'fax' => $address->getZip()]; }
/** * @param Address $other * @return bool */ public function sameValueAs(Address $other) { return $this->getStreet() == $other->getStreet() && $this->getStreetNumber() == $other->getStreetNumber() && $this->getZip() == $other->getZip() && $this->getCity() == $other->getCity(); }
public function testSetStreetWorks() { $address = new Address(); $address->setStreet('Rua dos bobos'); $this->assertEquals('Rua dos bobos', $address->getStreet()); }