Failed Conditions
Push — issue#666 ( f415d0...521a08 )
by Guilherme
12:02
created

ClientUserTest::testClientUser()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 10
nc 1
nop 0
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of the login-cidadao project or it's bundles.
4
 *
5
 * (c) Guilherme Donato <guilhermednt on github>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace LoginCidadao\OAuthBundle\Tests\Model;
12
13
use LoginCidadao\OAuthBundle\Entity\Client;
14
use LoginCidadao\OAuthBundle\Model\ClientUser;
15
16
class ClientUserTest extends \PHPUnit_Framework_TestCase
17
{
18
19
    public function testClientUser()
20
    {
21
        $client = (new Client())
22
            ->setId('123');
23
        $client->setRandomId('abc');
24
25
        $clientUser = new ClientUser($client);
26
27
        $clientUser->eraseCredentials();
28
        $this->assertSame($client, $clientUser->getClient());
29
        $this->assertNull($clientUser->getPassword());
0 ignored issues
show
Bug introduced by
Are you sure the usage of $clientUser->getPassword() targeting LoginCidadao\OAuthBundle...ientUser::getPassword() 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...
30
        $this->assertNull($clientUser->getSalt());
0 ignored issues
show
Bug introduced by
Are you sure the usage of $clientUser->getSalt() targeting LoginCidadao\OAuthBundle...l\ClientUser::getSalt() 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...
31
        $this->assertSame(['ROLE_API_CLIENT'], $clientUser->getRoles());
32
        $this->assertSame('client:123_abc', $clientUser->getUsername());
33
    }
34
}
35