File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515use PHPUnit \Framework \TestCase ;
1616use Symfony \Component \Security \Core \Exception \UnsupportedUserException ;
1717use Symfony \Component \Security \Core \Exception \UsernameNotFoundException ;
18+ use Symfony \Component \Security \Core \Exception \UserNotFoundException ;
1819
1920class EmailProviderTest extends TestCase
2021{
@@ -47,7 +48,11 @@ public function testLoadUserByUsername()
4748
4849 public function testLoadUserByInvalidUsername ()
4950 {
50- $ this ->expectException (UsernameNotFoundException::class);
51+ if (class_exists (UserNotFoundException::class)) {
52+ $ this ->expectException (UserNotFoundException::class);
53+ } else {
54+ $ this ->expectException (UsernameNotFoundException::class);
55+ }
5156
5257 $ this ->userManager ->expects ($ this ->once ())
5358 ->method ('findUserByEmail ' )
@@ -82,7 +87,11 @@ public function testRefreshUserBy()
8287
8388 public function testRefreshDeleted ()
8489 {
85- $ this ->expectException (UsernameNotFoundException::class);
90+ if (class_exists (UserNotFoundException::class)) {
91+ $ this ->expectException (UserNotFoundException::class);
92+ } else {
93+ $ this ->expectException (UsernameNotFoundException::class);
94+ }
8695
8796 $ user = $ this ->getMockForAbstractClass ('FOS\UserBundle\Model\User ' );
8897 $ this ->userManager ->expects ($ this ->once ())
Original file line number Diff line number Diff line change 1515use PHPUnit \Framework \TestCase ;
1616use Symfony \Component \Security \Core \Exception \UnsupportedUserException ;
1717use Symfony \Component \Security \Core \Exception \UsernameNotFoundException ;
18+ use Symfony \Component \Security \Core \Exception \UserNotFoundException ;
1819
1920class EmailUserProviderTest extends TestCase
2021{
@@ -47,7 +48,11 @@ public function testLoadUserByUsername()
4748
4849 public function testLoadUserByInvalidUsername ()
4950 {
50- $ this ->expectException (UsernameNotFoundException::class);
51+ if (class_exists (UserNotFoundException::class)) {
52+ $ this ->expectException (UserNotFoundException::class);
53+ } else {
54+ $ this ->expectException (UsernameNotFoundException::class);
55+ }
5156
5257 $ this ->userManager ->expects ($ this ->once ())
5358 ->method ('findUserByUsernameOrEmail ' )
Original file line number Diff line number Diff line change 1515use PHPUnit \Framework \TestCase ;
1616use Symfony \Component \Security \Core \Exception \UnsupportedUserException ;
1717use Symfony \Component \Security \Core \Exception \UsernameNotFoundException ;
18+ use Symfony \Component \Security \Core \Exception \UserNotFoundException ;
1819
1920class UserProviderTest extends TestCase
2021{
@@ -47,7 +48,11 @@ public function testLoadUserByUsername()
4748
4849 public function testLoadUserByInvalidUsername ()
4950 {
50- $ this ->expectException (UsernameNotFoundException::class);
51+ if (class_exists (UserNotFoundException::class)) {
52+ $ this ->expectException (UserNotFoundException::class);
53+ } else {
54+ $ this ->expectException (UsernameNotFoundException::class);
55+ }
5156
5257 $ this ->userManager ->expects ($ this ->once ())
5358 ->method ('findUserByUsername ' )
@@ -82,7 +87,11 @@ public function testRefreshUserBy()
8287
8388 public function testRefreshDeleted ()
8489 {
85- $ this ->expectException (UsernameNotFoundException::class);
90+ if (class_exists (UserNotFoundException::class)) {
91+ $ this ->expectException (UserNotFoundException::class);
92+ } else {
93+ $ this ->expectException (UsernameNotFoundException::class);
94+ }
8695
8796 $ user = $ this ->getMockForAbstractClass ('FOS\UserBundle\Model\User ' );
8897 $ this ->userManager ->expects ($ this ->once ())
You can’t perform that action at this time.
0 commit comments