CommerceGuys\Addressing\Tests\Formatter\PostalLabelFormatterTest::testAddressLeadingPostPrefix PHP Метод

testAddressLeadingPostPrefix() публичный Метод

    public function testAddressLeadingPostPrefix()
    {
        $address = new Address();
        $address = $address->withCountryCode('CH')->withLocality('Herrliberg')->withPostalCode('8047');
        // Domestic mail shouldn't have the postal code prefix added.
        $expectedLines = ['8047 Herrliberg'];
        $this->formatter->setOriginCountryCode('CH');
        $formattedAddress = $this->formatter->format($address);
        $this->assertFormattedAddress($expectedLines, $formattedAddress);
        // International mail should have the postal code prefix added.
        $expectedLines = ['CH-8047 Herrliberg', 'SWITZERLAND'];
        $this->formatter->setOriginCountryCode('FR');
        $formattedAddress = $this->formatter->format($address);
        $this->assertFormattedAddress($expectedLines, $formattedAddress);
    }