summaryrefslogtreecommitdiffstats
path: root/Core/Tests/User/InMemoryUserProviderTest.php
diff options
context:
space:
mode:
authorFabien Potencier <fabien.potencier@gmail.com>2015-10-05 17:19:10 +0200
committerFabien Potencier <fabien.potencier@gmail.com>2015-10-05 17:19:10 +0200
commit99d73ecb12dedf5c772aab7f00e7d39b60c5f4ed (patch)
tree1173b67020a5f5cee99d930f43ad6a593fb4d0f4 /Core/Tests/User/InMemoryUserProviderTest.php
parent88ef04f5d4cc2f895c7d74f6e5ba89255df9dc01 (diff)
parent427c50c174f7ae307d61a722da4ab53e87819041 (diff)
downloadsymfony-security-99d73ecb12dedf5c772aab7f00e7d39b60c5f4ed.zip
symfony-security-99d73ecb12dedf5c772aab7f00e7d39b60c5f4ed.tar.gz
symfony-security-99d73ecb12dedf5c772aab7f00e7d39b60c5f4ed.tar.bz2
Merge branch '2.7' into 2.8
* 2.7: [Security][bugfix] "Remember me" cookie cleared on logout with custom "secure"/"httponly" config options [1] [ci] Use current PHP_BINARY when running ./phpunit Fixed typos [UPGRADE-3.0] fix bullet indentation Fix PropertyAccessor modifying array in object when array key does not exist [Security] InMemoryUserProvider now concerns whether user's password is changed when refreshing
Diffstat (limited to 'Core/Tests/User/InMemoryUserProviderTest.php')
-rw-r--r--Core/Tests/User/InMemoryUserProviderTest.php33
1 files changed, 27 insertions, 6 deletions
diff --git a/Core/Tests/User/InMemoryUserProviderTest.php b/Core/Tests/User/InMemoryUserProviderTest.php
index dfc4237..0a1815f 100644
--- a/Core/Tests/User/InMemoryUserProviderTest.php
+++ b/Core/Tests/User/InMemoryUserProviderTest.php
@@ -18,18 +18,39 @@ class InMemoryUserProviderTest extends \PHPUnit_Framework_TestCase
{
public function testConstructor()
{
- $provider = new InMemoryUserProvider(array(
+ $provider = $this->createProvider();
+
+ $user = $provider->loadUserByUsername('fabien');
+ $this->assertEquals('foo', $user->getPassword());
+ $this->assertEquals(array('ROLE_USER'), $user->getRoles());
+ $this->assertFalse($user->isEnabled());
+ }
+
+ public function testRefresh()
+ {
+ $user = new User('fabien', 'bar');
+
+ $provider = $this->createProvider();
+
+ $refreshedUser = $provider->refreshUser($user);
+ $this->assertEquals('foo', $refreshedUser->getPassword());
+ $this->assertEquals(array('ROLE_USER'), $refreshedUser->getRoles());
+ $this->assertFalse($refreshedUser->isEnabled());
+ $this->assertFalse($refreshedUser->isCredentialsNonExpired());
+ }
+
+ /**
+ * @return InMemoryUserProvider
+ */
+ protected function createProvider()
+ {
+ return new InMemoryUserProvider(array(
'fabien' => array(
'password' => 'foo',
'enabled' => false,
'roles' => array('ROLE_USER'),
),
));
-
- $user = $provider->loadUserByUsername('fabien');
- $this->assertEquals('foo', $user->getPassword());
- $this->assertEquals(array('ROLE_USER'), $user->getRoles());
- $this->assertFalse($user->isEnabled());
}
public function testCreateUser()