Test Setup Failed
Push — master ( 581479...69dd87 )
by Vasil
02:14
created

ParserTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 30
rs 10
c 2
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 5 1
A canReturnOutwardCode() 0 6 1
A canReturnInwardCode() 0 6 1
1
<?php
2
3
namespace VasilDakov\Tests;
4
5
use VasilDakov\Postcode\Postcode;
6
use VasilDakov\Postcode\Parser;
7
8
class ParserTest extends \PHPUnit_Framework_TestCase
9
{
10
    public function setUp()
11
    {
12
        $this->value    = 'AA9A 9AA';
0 ignored issues
show
Bug introduced by
The property value does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
13
        $this->postcode = new Postcode('AA9A 9AA');
0 ignored issues
show
Bug introduced by
The property postcode does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
14
    }
15
16
    /**
17
     * @test
18
     * @covers \VasilDakov\Postcode\Parser::outward
19
     */
20
    public function canReturnOutwardCode()
21
    {
22
        $parser = new Parser(new Postcode('AA9A 9AA'));
23
24
        self::assertEquals('AA9A', $parser->outward());
25
    }
26
27
    /**
28
     * @test
29
     * @covers \VasilDakov\Postcode\Parser::inward
30
     */
31
    public function canReturnInwardCode()
32
    {
33
        $parser = new Parser(new Postcode('AA9A 9AA'));
34
35
        self::assertEquals('9AA', $parser->inward());
36
    }
37
}
38