12
12
namespace Symfony \Component \Security \Tests \Core \Authentication \Provider ;
13
13
14
14
use Symfony \Component \Security \Core \Authentication \Provider \RememberMeAuthenticationProvider ;
15
- use Symfony \Component \Security \Core \Exception \AccountExpiredException ;
15
+ use Symfony \Component \Security \Core \Exception \DisabledException ;
16
16
use Symfony \Component \Security \Core \Role \Role ;
17
17
18
18
class RememberMeAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
@@ -45,15 +45,14 @@ public function testAuthenticateWhenKeysDoNotMatch()
45
45
}
46
46
47
47
/**
48
- * @expectedException \Symfony\Component\Security\Core\Exception\AccountExpiredException
48
+ * @expectedException \Symfony\Component\Security\Core\Exception\DisabledException
49
49
*/
50
- public function testAuthenticateWhenPostChecksFails ()
50
+ public function testAuthenticateWhenPreChecksFails ()
51
51
{
52
52
$ userChecker = $ this ->getMock ('Symfony\Component\Security\Core\User\UserCheckerInterface ' );
53
53
$ userChecker ->expects ($ this ->once ())
54
- ->method ('checkPostAuth ' )
55
- ->will ($ this ->throwException (new AccountExpiredException ()))
56
- ;
54
+ ->method ('checkPreAuth ' )
55
+ ->will ($ this ->throwException (new DisabledException ()));
57
56
58
57
$ provider = $ this ->getProvider ($ userChecker );
59
58
@@ -65,8 +64,7 @@ public function testAuthenticate()
65
64
$ user = $ this ->getMock ('Symfony\Component\Security\Core\User\UserInterface ' );
66
65
$ user ->expects ($ this ->exactly (2 ))
67
66
->method ('getRoles ' )
68
- ->will ($ this ->returnValue (array ('ROLE_FOO ' )))
69
- ;
67
+ ->will ($ this ->returnValue (array ('ROLE_FOO ' )));
70
68
71
69
$ provider = $ this ->getProvider ();
72
70
@@ -86,16 +84,14 @@ protected function getSupportedToken($user = null, $key = 'test')
86
84
$ user
87
85
->expects ($ this ->any ())
88
86
->method ('getRoles ' )
89
- ->will ($ this ->returnValue (array ()))
90
- ;
87
+ ->will($ this ->returnValue (array ()));
91
88
}
92
89
93
90
$ token = $ this ->getMock ('Symfony\Component\Security\Core\Authentication\Token\RememberMeToken ' , array ('getProviderKey ' ), array ($ user , 'foo ' , $ key ));
94
91
$ token
95
92
->expects ($ this ->once ())
96
93
->method ('getProviderKey ' )
97
- ->will ($ this ->returnValue ('foo ' ))
98
- ;
94
+ ->will ($ this ->returnValue ('foo ' ));
99
95
100
96
return $ token ;
101
97
}
0 commit comments