Completed
Pull Request — master (#20)
by Harry
11:39 queued 03:51
created

ManualGrantTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 64.29 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 3
dl 18
loc 28
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testInstanceOf() 0 5 1
A testConstructor() 9 9 1
A testSetter() 9 9 1

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
/**
3
 * This file is part of graze/gigya-client
4
 *
5
 * Copyright (c) 2016 Nature Delivered Ltd. <https://www.graze.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @license https://github.com/graze/gigya-client/blob/master/LICENSE.md
11
 * @link    https://github.com/graze/gigya-client
12
 */
13
14
namespace Graze\Gigya\Test\Unit\Auth\OAuth2;
15
16
use Graze\Gigya\Auth\OAuth2\AccessToken;
17
use Graze\Gigya\Auth\OAuth2\GrantInterface;
18
use Graze\Gigya\Auth\OAuth2\ManualGrant;
19
use Graze\Gigya\Test\TestCase;
20
21
class ManualGrantTest extends TestCase
22
{
23
    public function testInstanceOf()
24
    {
25
        $grant = new ManualGrant();
26
        static::assertInstanceOf(GrantInterface::class, $grant);
27
    }
28
29 View Code Duplication
    public function testConstructor()
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...
30
    {
31
        $grant = new ManualGrant();
32
        static::assertNull($grant->getToken());
33
34
        $token = new AccessToken('token');
35
        $grant = new ManualGrant($token);
36
        static::assertSame($token, $grant->getToken());
37
    }
38
39 View Code Duplication
    public function testSetter()
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...
40
    {
41
        $grant = new ManualGrant();
42
        static::assertNull($grant->getToken());
43
44
        $token = new AccessToken('token');
45
        static::assertSame($grant, $grant->setToken($token));
46
        static::assertSame($token, $grant->getToken());
47
    }
48
}
49