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

ClientUserTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testClientUser() 0 14 1
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