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.

testUpsLocatorGetRequestMethodIsCalled()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 10

Duplication

Lines 13
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 13
loc 13
rs 9.4285
cc 1
eloc 10
nc 1
nop 0
1
<?php
2
3
namespace Octante\UpsAPIBundle\Tests\Unit\Library;
4
5
/*
6
 * This file is part of the UpsAPIBundle package.
7
 *
8
 * (c) Issel Guberna <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
use Octante\UpsAPIBundle\Library\LocatorWrapper;
15
use Ups\Locator;
16
17
class LocatorTest extends \PHPUnit_Framework_TestCase
18
{
19
    private $locatorMock;
20
21
    public function setUp()
22
    {
23
        $this->locatorMock = $this->getMock('Ups\Locator');
24
    }
25
26
    /**
27
     * when: getLocationsIsCalled
28
     * should: callUpsLocatorGetLocationsMethod.
29
     */
30
    public function testUpsLocatorGetLocationMethodIsCalled()
31
    {
32
        $locatorRequestMock = $this->getMock('Ups\Entity\LocatorRequest');
33
        $locatorOption = Locator::OPTION_UPS_ACCESS_POINT_LOCATIONS;
34
        $this->locatorMock
35
            ->expects($this->once())
36
            ->method('getLocations')
37
            ->with(
38
                $locatorRequestMock,
39
                $locatorOption
40
            );
41
42
        $sut = new LocatorWrapper($this->locatorMock);
43
44
        $sut->getLocations(
45
            $locatorRequestMock,
46
            $locatorOption
47
        );
48
    }
49
50
    /**
51
     * when: getRequestIsCalled
52
     * should: callUpsLocatorGetRequestMethod.
53
     */
54 View Code Duplication
    public function testUpsLocatorGetRequestMethodIsCalled()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
55
    {
56
        $requestMock = $this->getMock('Ups\Request');
57
        $this
58
            ->locatorMock
59
            ->method('getRequest')
60
            ->willReturn($requestMock);
61
62
        $sut = new LocatorWrapper($this->locatorMock);
63
        $sut->setRequest($requestMock);
64
        $request = $sut->getRequest();
65
        $this->assertInstanceOf('Ups\Request', $request);
66
    }
67
68
    /**
69
     * when: getResponseIsCalled
70
     * should: callUpsLocatorGetResponseMethod.
71
     */
72 View Code Duplication
    public function testUpsLocatorGetResponseMethodIsCalled()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
73
    {
74
        $responseMock = $this->getMock('Ups\Response');
75
        $this
76
            ->locatorMock
77
            ->method('getResponse')
78
            ->willReturn($responseMock);
79
80
        $sut = new LocatorWrapper($this->locatorMock);
81
        $sut->setResponse($responseMock);
82
        $response = $sut->getResponse();
83
        $this->assertInstanceOf('Ups\Response', $response);
84
    }
85
}
86