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.

testAddressValidationValidateMethodIsCalled()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 21
rs 9.3142
cc 1
eloc 14
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\AddressValidationWrapper;
15
16
class AddressValidationTest extends \PHPUnit_Framework_TestCase
17
{
18
    private $addressValidationMock;
19
20
    public function setUp()
21
    {
22
        $this->addressValidationMock = $this->getMock('Ups\AddressValidation');
23
    }
24
25
    /**
26
     * when: validateIsCalled
27
     * should: callUpsAddressValidationValidateMethod.
28
     */
29
    public function testAddressValidationValidateMethodIsCalled()
30
    {
31
        $addressMock = $this->getMock('Ups\Entity\Address');
32
33
        $this->addressValidationMock
34
            ->expects($this->once())
35
            ->method('validate')
36
            ->with(
37
                $addressMock,
38
                \Ups\AddressValidation::REQUEST_OPTION_ADDRESS_VALIDATION,
39
                15
40
            );
41
42
        $sut = new AddressValidationWrapper($this->addressValidationMock);
43
44
        $sut->validate(
45
            $addressMock,
46
            \Ups\AddressValidation::REQUEST_OPTION_ADDRESS_VALIDATION,
47
            15
48
        );
49
    }
50
51
    /**
52
     * when: getRequestIsCalled
53
     * should: callUpsAddressValidationGetRequestMethod.
54
     */
55
    public function testAddressValidationGetRequestMethodIsCalled()
56
    {
57
        $requestMock = $this->getMock('Ups\Request');
58
        $this
59
            ->addressValidationMock
60
            ->method('getRequest')
61
            ->willReturn($requestMock);
62
63
        $sut = new AddressValidationWrapper($this->addressValidationMock);
64
        $sut->setRequest($requestMock);
65
        $request = $sut->getRequest();
66
        $this->assertInstanceOf('Ups\Request', $request);
67
    }
68
69
    /**
70
     * when: getResponseIsCalled
71
     * should: callUpsAddressValidationGetResponseMethod.
72
     */
73 View Code Duplication
    public function testAddressValidationGetResponseMethodIsCalled()
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...
74
    {
75
        $responseMock = $this->getMock('Ups\Response');
76
        $this
77
            ->addressValidationMock
78
            ->method('getResponse')
79
            ->willReturn($responseMock);
80
81
        $sut = new AddressValidationWrapper($this->addressValidationMock);
82
        $sut->setResponse($responseMock);
83
        $response = $sut->getResponse();
84
        $this->assertInstanceOf('Ups\Response', $response);
85
    }
86
}
87