Completed
Push — master ( 15246f...375dc4 )
by Vasil
26:35
created

ValidatorTest::testCanValidatePostcodes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
namespace VasilDakov\Tests;
3
4
use VasilDakov\Postcode\ValidatorInterface;
5
use VasilDakov\Postcode\Validator;
6
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