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.

ExceptionTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 73.68 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 4
dl 28
loc 38
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testArgumentException() 14 14 2
A testCommonException() 14 14 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
namespace Checkdomain\Comodo\Tests;
3
4
use Checkdomain\Comodo\Model\Exception\AccountException;
5
use Checkdomain\Comodo\Model\Exception\ArgumentException;
6
7
/**
8
 * Class ExceptionTest
9
 */
10
class ExceptionTest extends AbstractTest
11
{
12
    /**
13
     * tests if the argument-exception object is correctly filled
14
     */
15 View Code Duplication
    public function testArgumentException()
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...
16
    {
17
        $util = $this->createUtil($this->createGuzzleClient(http_build_query([
0 ignored issues
show
Bug introduced by
It seems like $this->createGuzzleClien... => 'InvalidRequest'))) targeting Checkdomain\Comodo\Tests...t::createGuzzleClient() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Checkdomain\Comodo\Tests...tractTest::createUtil() does only seem to accept null|object<GuzzleHttp\Client>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
18
            'errorCode'    => -2,
19
            'errorItem'    => 'field',
20
            'errorMessage' => 'InvalidRequest',
21
        ])));
22
23
        try {
24
            $util->autoApplySSL([]);
25
        } catch (ArgumentException $e) {
26
            $this->assertEquals('field', $e->getArgumentName());
27
        }
28
    }
29
30
    /**
31
     * tests, if the common exception fields are filled
32
     */
33 View Code Duplication
    public function testCommonException()
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...
34
    {
35
        $util = $this->createUtil($this->createGuzzleClient(http_build_query([
0 ignored issues
show
Bug introduced by
It seems like $this->createGuzzleClien...=> 'Invalid Request'))) targeting Checkdomain\Comodo\Tests...t::createGuzzleClient() can also be of type object<PHPUnit_Framework_MockObject_MockObject>; however, Checkdomain\Comodo\Tests...tractTest::createUtil() does only seem to accept null|object<GuzzleHttp\Client>, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
36
            'errorCode'    => -15,
37
            'errorMessage' => 'Invalid Request',
38
        ])));
39
40
        try {
41
            $util->autoApplySSL([]);
42
        } catch (AccountException $e) {
43
            $this->assertEquals($e->getMessage(), 'Invalid Request');
44
            $this->assertEquals(-15, $e->getCode());
45
        }
46
    }
47
}
48