1 | <?php |
||
7 | class ValidatorTest extends \PHPUnit_Framework_TestCase |
||
8 | { |
||
9 | /** |
||
10 | * @dataProvider postcodeProvider |
||
11 | * @covers \VasilDakov\Postcode\Validator::isValid |
||
12 | */ |
||
13 | public function testCanValidatePostcodes($string, $expected) |
||
14 | { |
||
15 | self::assertEquals($expected, (new Validator)->isValid($string)); |
||
16 | } |
||
17 | |||
18 | /** |
||
19 | * Returns an array with valid and invalid postcodes |
||
20 | */ |
||
21 | public function postcodeProvider() |
||
22 | { |
||
23 | return [ |
||
24 | ['EC1V 9LB', true], |
||
25 | ['TW1 3QS', true], |
||
26 | ['TW8 8FB', true], |
||
27 | ['ABC 123', false], |
||
28 | ['XYZ 987', false], |
||
29 | ]; |
||
30 | } |
||
31 | } |
||
32 |