for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* This file is part of the login-cidadao project or it's bundles.
*
* (c) Guilherme Donato <guilhermednt on github>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace LoginCidadao\OAuthBundle\Tests\Model;
use LoginCidadao\OAuthBundle\Entity\Client;
use LoginCidadao\OAuthBundle\Model\ClientUser;
class ClientUserTest extends \PHPUnit_Framework_TestCase
{
public function testClientUser()
$client = (new Client())
->setId('123');
$client->setRandomId('abc');
$clientUser = new ClientUser($client);
$clientUser->eraseCredentials();
$this->assertSame($client, $clientUser->getClient());
$this->assertNull($clientUser->getPassword());
$clientUser->getPassword()
LoginCidadao\OAuthBundle...ientUser::getPassword()
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.
getObject()
The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.
$this->assertNull($clientUser->getSalt());
$clientUser->getSalt()
LoginCidadao\OAuthBundle...l\ClientUser::getSalt()
$this->assertSame(['ROLE_API_CLIENT'], $clientUser->getRoles());
$this->assertSame('client:123_abc', $clientUser->getUsername());
}
This check looks for function or method calls that always return null and whose return value is used.
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.