StdOAuth1TokenTest   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 74
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 7
eloc 19
dl 0
loc 74
c 1
b 0
f 0
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A testSetAccessTokenSecret() 0 5 1
A testSetRequestTokenSecret() 0 5 1
A testSetRequestToken() 0 5 1
A testGetRequestToken() 0 6 1
A testGetRequestTokenSecret() 0 6 1
A testConstructCorrectInterfaces() 0 6 1
A testGetAccessTokenSecret() 0 6 1
1
<?php
2
3
namespace OAuthTest\Unit\OAuth1\Token;
4
5
use OAuth\OAuth1\Token\StdOAuth1Token;
6
use PHPUnit\Framework\TestCase;
7
8
class StdOAuth1TokenTest extends TestCase
9
{
10
    public function testConstructCorrectInterfaces(): void
11
    {
12
        $token = new StdOAuth1Token();
13
14
        self::assertInstanceOf('\\OAuth\\OAuth1\\Token\\TokenInterface', $token);
15
        self::assertInstanceOf('\\OAuth\\Common\\Token\\AbstractToken', $token);
16
    }
17
18
    /**
19
     * @covers \OAuth\OAuth1\Token\StdOAuth1Token::setRequestToken
20
     */
21
    public function testSetRequestToken(): void
22
    {
23
        $token = new StdOAuth1Token();
24
25
        self::assertNull($token->setRequestToken('foo'));
0 ignored issues
show
Bug introduced by
Are you sure the usage of $token->setRequestToken('foo') targeting OAuth\OAuth1\Token\StdOA...oken::setRequestToken() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
26
    }
27
28
    /**
29
     * @covers \OAuth\OAuth1\Token\StdOAuth1Token::getRequestToken
30
     * @covers \OAuth\OAuth1\Token\StdOAuth1Token::setRequestToken
31
     */
32
    public function testGetRequestToken(): void
33
    {
34
        $token = new StdOAuth1Token();
35
36
        self::assertNull($token->setRequestToken('foo'));
0 ignored issues
show
Bug introduced by
Are you sure the usage of $token->setRequestToken('foo') targeting OAuth\OAuth1\Token\StdOA...oken::setRequestToken() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
37
        self::assertSame('foo', $token->getRequestToken());
38
    }
39
40
    /**
41
     * @covers \OAuth\OAuth1\Token\StdOAuth1Token::setRequestTokenSecret
42
     */
43
    public function testSetRequestTokenSecret(): void
44
    {
45
        $token = new StdOAuth1Token();
46
47
        self::assertNull($token->setRequestTokenSecret('foo'));
0 ignored issues
show
Bug introduced by
Are you sure the usage of $token->setRequestTokenSecret('foo') targeting OAuth\OAuth1\Token\StdOA...setRequestTokenSecret() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
48
    }
49
50
    /**
51
     * @covers \OAuth\OAuth1\Token\StdOAuth1Token::getRequestTokenSecret
52
     * @covers \OAuth\OAuth1\Token\StdOAuth1Token::setRequestTokenSecret
53
     */
54
    public function testGetRequestTokenSecret(): void
55
    {
56
        $token = new StdOAuth1Token();
57
58
        self::assertNull($token->setRequestTokenSecret('foo'));
0 ignored issues
show
Bug introduced by
Are you sure the usage of $token->setRequestTokenSecret('foo') targeting OAuth\OAuth1\Token\StdOA...setRequestTokenSecret() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
59
        self::assertSame('foo', $token->getRequestTokenSecret());
60
    }
61
62
    /**
63
     * @covers \OAuth\OAuth1\Token\StdOAuth1Token::setAccessTokenSecret
64
     */
65
    public function testSetAccessTokenSecret(): void
66
    {
67
        $token = new StdOAuth1Token();
68
69
        self::assertNull($token->setAccessTokenSecret('foo'));
0 ignored issues
show
Bug introduced by
Are you sure the usage of $token->setAccessTokenSecret('foo') targeting OAuth\OAuth1\Token\StdOA...:setAccessTokenSecret() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
70
    }
71
72
    /**
73
     * @covers \OAuth\OAuth1\Token\StdOAuth1Token::getAccessTokenSecret
74
     * @covers \OAuth\OAuth1\Token\StdOAuth1Token::setAccessTokenSecret
75
     */
76
    public function testGetAccessTokenSecret(): void
77
    {
78
        $token = new StdOAuth1Token();
79
80
        self::assertNull($token->setAccessTokenSecret('foo'));
0 ignored issues
show
Bug introduced by
Are you sure the usage of $token->setAccessTokenSecret('foo') targeting OAuth\OAuth1\Token\StdOA...:setAccessTokenSecret() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
81
        self::assertSame('foo', $token->getAccessTokenSecret());
82
    }
83
}
84