/** * @test * @covers \VasilDakov\Postcode\Postcode::split * @uses \VasilDakov\Postcode\Postcode::outward * @uses \VasilDakov\Postcode\Postcode::inward * @uses \VasilDakov\Postcode\Postcode::area * @uses \VasilDakov\Postcode\Postcode::district * @uses \VasilDakov\Postcode\Postcode::subdistrict * @uses \VasilDakov\Postcode\Postcode::sector * @uses \VasilDakov\Postcode\Postcode::unit */ public function testSplit() { $array = $this->postcode->split(); self::assertInternalType('array', $array); self::assertArrayHasKey('outward', $array); self::assertArrayHasKey('inward', $array); self::assertArrayHasKey('area', $array); self::assertArrayHasKey('district', $array); self::assertArrayHasKey('subdistrict', $array); self::assertArrayHasKey('sector', $array); self::assertArrayHasKey('unit', $array); self::assertEquals('AA9A', $array['outward']); self::assertEquals('9AA', $array['inward']); self::assertEquals('AA', $array['area']); self::assertEquals('AA9', $array['district']); self::assertEquals('AA9A 9', $array['sector']); self::assertEquals('AA', $array['unit']); }
/** * Compare two Postcode and tells whether they can be considered equal * * @todo Replace toNative with toString * @todo strcmp — Binary safe string comparison * * @param Postcode $object * @return bool */ public function compareTo(Postcode $other) { return strcmp($this->toNative(), $other->toNative()) !== 0; }