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

AccessTokenTest::testConstructSuccess()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1.125

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 7
ccs 2
cts 4
cp 0.5
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
crap 1.125
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