Completed
Push — master ( 3f7868...fe95db )
by Дмитрий
03:54
created

AccessTokenTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 57.14%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 19
ccs 4
cts 7
cp 0.5714
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testExceptionNotString() 0 4 1
A testConstructSuccess() 0 7 1
1
<?php
2
/**
3
 * SocialConnect project
4
 * @author: Patsura Dmitry https://github.com/ovr <[email protected]>
5
 */
6
7
namespace Test\Provider\OAuth2;
8
9
use SocialConnect\OAuth2\AccessToken;
10
11
class AccessTokenTest extends \Test\TestCase
12
{
13 1
    public function testConstructSuccess()
14
    {
15 1
        $token = new AccessToken('accessToken');
0 ignored issues
show
Documentation introduced by
'accessToken' is of type string, but the function expects a array.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
16
        $this->assertSame('accessToken', $token->getToken());
17
18
        return $token;
19
    }
20
21
    /**
22
     * @expectedException \InvalidArgumentException
23
     * @expectedExceptionMessage $token must be a string, passed: integer
24
     */
25 1
    public function testExceptionNotString()
26
    {
27 1
        new AccessToken(12345);
0 ignored issues
show
Documentation introduced by
12345 is of type integer, but the function expects a array.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
28
    }
29
}
30