Skip to content

Commit

Permalink
Fix: lv_LV postcode format (#661)
Browse files Browse the repository at this point in the history
* fix lv_LV postcode format

* test added
  • Loading branch information
edgarsn authored Jun 14, 2023
1 parent 366d2ef commit c21a797
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Faker/Provider/lv_LV/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Address extends \Faker\Provider\Address
];

protected static $buildingNumber = ['%#'];
protected static $postcode = ['LV ####'];
protected static $postcode = ['LV-####'];

/**
* @see https://lv.wikipedia.org/wiki/Suver%C4%93no_valstu_uzskait%C4%ABjums
Expand Down
25 changes: 25 additions & 0 deletions test/Faker/Provider/lv_LV/AddressTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace Faker\Test\Provider\lv_LV;

use Faker\Provider\lv_LV\Address;
use Faker\Test\TestCase;

/**
* @group legacy
*/
final class AddressTest extends TestCase
{
public function testPostcode(): void
{
$postcode = $this->faker->postcode();
self::assertNotEmpty($postcode);
self::assertIsString($postcode);
self::assertMatchesRegularExpression('/LV-\d{4}/', $postcode);
}

protected function getProviders(): iterable
{
yield new Address($this->faker);
}
}

0 comments on commit c21a797

Please sign in to comment.