GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

it_fetches_routes_for_specification()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 28
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 28
rs 8.8571
cc 1
eloc 16
nc 1
nop 0
1
<?php
2
/*
3
 * This file is part of the prooph/php-ddd-cargo-sample.
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
 * Date: 29.03.14 - 19:56
10
 */
11
12
namespace CodelinerTest\CargoBackend\Infrastructure\Routing;
13
14
use Codeliner\CargoBackend\Infrastructure\Routing\ExternalRoutingService;
15
use Codeliner\CargoBackend\Model\Cargo\RouteSpecification;
16
use CodelinerTest\CargoBackend\Mock\GraphTraversalServiceMock;
17
use CodelinerTest\CargoBackend\TestCase;
18
19
/**
20
 * Class ExternalRoutingServiceTest
21
 *
22
 * @package CodelinerTest\CargoBackend\Infrastructure\Routing
23
 * @author Alexander Miertsch <[email protected]>
24
 */
25
class ExternalRoutingServiceTest extends TestCase
26
{
27
    /**
28
     * @var ExternalRoutingService
29
     */
30
    private $externalRoutingService;
31
32
    protected function setUp()
33
    {
34
        $this->externalRoutingService = new ExternalRoutingService(new GraphTraversalServiceMock());
35
    }
36
37
    /**
38
     * @test
39
     */
40
    public function it_fetches_routes_for_specification()
41
    {
42
        $routeSpecification = new RouteSpecification('DEHAM', 'USNYC');
43
44
        $itineraries = $this->externalRoutingService->fetchRoutesForSpecification($routeSpecification);
45
46
        $this->assertEquals(1, count($itineraries));
47
48
        $itinerary = $itineraries[0];
49
50
        $this->assertInstanceOf('Codeliner\CargoBackend\Model\Cargo\Itinerary', $itinerary);
51
52
        $legs = $itinerary->legs();
53
54
        $this->assertEquals(1, count($legs));
55
56
        $leg = $legs[0];
57
58
        $this->assertInstanceOf('Codeliner\CargoBackend\Model\Cargo\Leg', $leg);
59
60
        $loadDate     = new \DateTime('2014-03-29 19:59:23');
61
        $unloadDate   = new \DateTime('2014-03-30 21:30:00');
62
63
        $this->assertEquals('DEHAM', $leg->loadLocation());
64
        $this->assertEquals('USNYC', $leg->unloadLocation());
65
        $this->assertEquals($loadDate->getTimestamp(), $leg->loadTime()->getTimestamp());
66
        $this->assertEquals($unloadDate->getTimestamp(), $leg->unloadTime()->getTimestamp());
67
    }
68
}
69