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) {
|
if ($this->user instanceof EquatableInterface) {
|
||||||
return !$this->user->isEqualTo($user);
|
return ! (Boolean) $this->user->isEqualTo($user);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->user->getPassword() !== $user->getPassword()) {
|
if ($this->user->getPassword() !== $user->getPassword()) {
|
||||||
|
@ -144,8 +144,10 @@ class AbstractTokenTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function getUsers()
|
public function getUsers()
|
||||||
{
|
{
|
||||||
$user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
|
$user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
|
||||||
|
$advancedUser = $this->getMock('Symfony\Component\Security\Core\User\AdvancedUserInterface');
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
|
array($advancedUser),
|
||||||
array($user),
|
array($user),
|
||||||
array(new TestUser('foo')),
|
array(new TestUser('foo')),
|
||||||
array('foo'),
|
array('foo'),
|
||||||
@ -171,6 +173,7 @@ class AbstractTokenTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function getUserChanges()
|
public function getUserChanges()
|
||||||
{
|
{
|
||||||
$user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
|
$user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
|
||||||
|
$advancedUser = $this->getMock('Symfony\Component\Security\Core\User\AdvancedUserInterface');
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
array(
|
array(
|
||||||
@ -182,12 +185,21 @@ class AbstractTokenTest extends \PHPUnit_Framework_TestCase
|
|||||||
array(
|
array(
|
||||||
'foo', $user,
|
'foo', $user,
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
'foo', $advancedUser
|
||||||
|
),
|
||||||
array(
|
array(
|
||||||
$user, 'foo'
|
$user, 'foo'
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
$advancedUser, 'foo'
|
||||||
|
),
|
||||||
array(
|
array(
|
||||||
$user, new TestUser('foo'),
|
$user, new TestUser('foo'),
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
$advancedUser, new TestUser('foo'),
|
||||||
|
),
|
||||||
array(
|
array(
|
||||||
new TestUser('foo'), new TestUser('bar'),
|
new TestUser('foo'), new TestUser('bar'),
|
||||||
),
|
),
|
||||||
@ -197,6 +209,15 @@ class AbstractTokenTest extends \PHPUnit_Framework_TestCase
|
|||||||
array(
|
array(
|
||||||
new TestUser('foo'), $user,
|
new TestUser('foo'), $user,
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
new TestUser('foo'), $advancedUser,
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
$user, $advancedUser
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
$advancedUser, $user
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user