1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* This file is part of the prooph/php-ddd-cargo-sample package. |
4
|
|
|
* (c) Alexander Miertsch <[email protected]> |
5
|
|
|
* |
6
|
|
|
* For the full copyright and license information, please view the LICENSE |
7
|
|
|
* file that was distributed with this source code. |
8
|
|
|
*/ |
9
|
|
|
namespace CodelinerTest\CargoBackend\Domain\Model\Cargo; |
10
|
|
|
|
11
|
|
|
use CodelinerTest\CargoBackend\TestCase; |
12
|
|
|
use Codeliner\CargoBackend\Model\Cargo\RouteSpecification; |
13
|
|
|
/** |
14
|
|
|
* RouteSpecificationTest |
15
|
|
|
* |
16
|
|
|
* @author Alexander Miertsch <[email protected]> |
17
|
|
|
*/ |
18
|
|
|
class RouteSpecificationTest extends TestCase |
19
|
|
|
{ |
20
|
|
|
/** |
21
|
|
|
* |
22
|
|
|
* @var RouteSpecification |
23
|
|
|
*/ |
24
|
|
|
protected $object; |
25
|
|
|
|
26
|
|
|
protected function setUp() |
27
|
|
|
{ |
28
|
|
|
$this->object = new RouteSpecification('Hongkong', 'Berlin'); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @test |
33
|
|
|
*/ |
34
|
|
|
public function it_has_an_origin() |
35
|
|
|
{ |
36
|
|
|
$this->assertEquals('Hongkong', $this->object->origin()); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @test |
41
|
|
|
*/ |
42
|
|
|
public function it_has_a_destination() |
43
|
|
|
{ |
44
|
|
|
$this->assertEquals('Berlin', $this->object->destination()); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @test |
49
|
|
|
*/ |
50
|
|
|
public function it_is_same_value_as_route_specification_with_same_properties() |
51
|
|
|
{ |
52
|
|
|
$validCheck = new RouteSpecification('Hongkong', 'Berlin'); |
53
|
|
|
|
54
|
|
|
$this->assertTrue($this->object->sameValueAs($validCheck)); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @test |
59
|
|
|
*/ |
60
|
|
|
public function it_is_not_same_value_as_route_specification_with_different_origin() |
61
|
|
|
{ |
62
|
|
|
$invalidCheck = new RouteSpecification('New York', 'Berlin'); |
63
|
|
|
|
64
|
|
|
$this->assertFalse($this->object->sameValueAs($invalidCheck)); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @test |
69
|
|
|
*/ |
70
|
|
|
public function it_is_not_same_value_as_route_specification_with_different_destination() |
71
|
|
|
{ |
72
|
|
|
$invalidCheck = new RouteSpecification('Hongkong', 'New York'); |
73
|
|
|
|
74
|
|
|
$this->assertFalse($this->object->sameValueAs($invalidCheck)); |
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
|