Add some more tests, and enforce boolean return value of interface implementations.
This commit is contained in:
parent
9d3a49f065
commit
d7ffeb5844
@ -230,7 +230,7 @@ abstract class AbstractToken implements TokenInterface
|
||||
}
|
||||
|
||||
if ($this->user instanceof EquatableInterface) {
|
||||
return !$this->user->isEqualTo($user);
|
||||
return ! (Boolean) $this->user->isEqualTo($user);
|
||||
}
|
||||
|
||||
if ($this->user->getPassword() !== $user->getPassword()) {
|
||||
|
@ -144,8 +144,10 @@ class AbstractTokenTest extends \PHPUnit_Framework_TestCase
|
||||
public function getUsers()
|
||||
{
|
||||
$user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
|
||||
$advancedUser = $this->getMock('Symfony\Component\Security\Core\User\AdvancedUserInterface');
|
||||
|
||||
return array(
|
||||
array($advancedUser),
|
||||
array($user),
|
||||
array(new TestUser('foo')),
|
||||
array('foo'),
|
||||
@ -171,6 +173,7 @@ class AbstractTokenTest extends \PHPUnit_Framework_TestCase
|
||||
public function getUserChanges()
|
||||
{
|
||||
$user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
|
||||
$advancedUser = $this->getMock('Symfony\Component\Security\Core\User\AdvancedUserInterface');
|
||||
|
||||
return array(
|
||||
array(
|
||||
@ -182,12 +185,21 @@ class AbstractTokenTest extends \PHPUnit_Framework_TestCase
|
||||
array(
|
||||
'foo', $user,
|
||||
),
|
||||
array(
|
||||
'foo', $advancedUser
|
||||
),
|
||||
array(
|
||||
$user, 'foo'
|
||||
),
|
||||
array(
|
||||
$advancedUser, 'foo'
|
||||
),
|
||||
array(
|
||||
$user, new TestUser('foo'),
|
||||
),
|
||||
array(
|
||||
$advancedUser, new TestUser('foo'),
|
||||
),
|
||||
array(
|
||||
new TestUser('foo'), new TestUser('bar'),
|
||||
),
|
||||
@ -197,6 +209,15 @@ class AbstractTokenTest extends \PHPUnit_Framework_TestCase
|
||||
array(
|
||||
new TestUser('foo'), $user,
|
||||
),
|
||||
array(
|
||||
new TestUser('foo'), $advancedUser,
|
||||
),
|
||||
array(
|
||||
$user, $advancedUser
|
||||
),
|
||||
array(
|
||||
$advancedUser, $user
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user