@@ -50,12 +50,10 @@ private function doSetUp()
5050 $ this ->event = new GetResponseEvent ($ this ->getMockBuilder ('Symfony\Component\HttpKernel\HttpKernelInterface ' )->getMock (), $ this ->request , HttpKernelInterface::MASTER_REQUEST );
5151 }
5252
53- /**
54- * @expectedException \InvalidArgumentException
55- * @expectedExceptionMessage $providerKey must not be empty
56- */
5753 public function testProviderKeyIsRequired ()
5854 {
55+ $ this ->expectException ('InvalidArgumentException ' );
56+ $ this ->expectExceptionMessage ('$providerKey must not be empty ' );
5957 new SwitchUserListener ($ this ->tokenStorage , $ this ->userProvider , $ this ->userChecker , '' , $ this ->accessDecisionManager );
6058 }
6159
@@ -68,22 +66,18 @@ public function testEventIsIgnoredIfUsernameIsNotPassedWithTheRequest()
6866 $ this ->assertNull ($ this ->tokenStorage ->getToken ());
6967 }
7068
71- /**
72- * @expectedException \Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException
73- */
7469 public function testExitUserThrowsAuthenticationExceptionIfNoCurrentToken ()
7570 {
71+ $ this ->expectException ('Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException ' );
7672 $ this ->tokenStorage ->setToken (null );
7773 $ this ->request ->query ->set ('_switch_user ' , '_exit ' );
7874 $ listener = new SwitchUserListener ($ this ->tokenStorage , $ this ->userProvider , $ this ->userChecker , 'provider123 ' , $ this ->accessDecisionManager );
7975 $ listener ->handle ($ this ->event );
8076 }
8177
82- /**
83- * @expectedException \Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException
84- */
8578 public function testExitUserThrowsAuthenticationExceptionIfOriginalTokenCannotBeFound ()
8679 {
80+ $ this ->expectException ('Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException ' );
8781 $ token = new UsernamePasswordToken ('username ' , '' , 'key ' , ['ROLE_FOO ' ]);
8882
8983 $ this ->tokenStorage ->setToken ($ token );
@@ -158,11 +152,9 @@ public function testExitUserDoesNotDispatchEventWithStringUser()
158152 $ listener ->handle ($ this ->event );
159153 }
160154
161- /**
162- * @expectedException \Symfony\Component\Security\Core\Exception\AccessDeniedException
163- */
164155 public function testSwitchUserIsDisallowed ()
165156 {
157+ $ this ->expectException ('Symfony\Component\Security\Core\Exception\AccessDeniedException ' );
166158 $ token = new UsernamePasswordToken ('username ' , '' , 'key ' , ['ROLE_FOO ' ]);
167159
168160 $ this ->tokenStorage ->setToken ($ token );
@@ -270,11 +262,9 @@ public function testSwitchUserWithReplacedToken()
270262 $ this ->assertSame ($ replacedToken , $ this ->tokenStorage ->getToken ());
271263 }
272264
273- /**
274- * @expectedException \Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException
275- */
276265 public function testSwitchtUserThrowsAuthenticationExceptionIfNoCurrentToken ()
277266 {
267+ $ this ->expectException ('Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException ' );
278268 $ this ->tokenStorage ->setToken (null );
279269 $ this ->request ->query ->set ('_switch_user ' , 'username ' );
280270 $ listener = new SwitchUserListener ($ this ->tokenStorage , $ this ->userProvider , $ this ->userChecker , 'provider123 ' , $ this ->accessDecisionManager );
0 commit comments