|
16 | 16 | use PHPUnit\Framework\MockObject\MockObject; |
17 | 17 | use PHPUnit\Framework\TestCase; |
18 | 18 | use Symfony\Component\Security\Core\Exception\UnsupportedUserException; |
19 | | -use Symfony\Component\Security\Core\Exception\UsernameNotFoundException; |
20 | 19 | use Symfony\Component\Security\Core\Exception\UserNotFoundException; |
21 | 20 |
|
22 | 21 | class UserProviderTest extends TestCase |
@@ -45,23 +44,19 @@ public function testLoadUserByUsername() |
45 | 44 | ->with('foobar') |
46 | 45 | ->will($this->returnValue($user)); |
47 | 46 |
|
48 | | - $this->assertSame($user, $this->userProvider->loadUserByUsername('foobar')); |
| 47 | + $this->assertSame($user, $this->userProvider->loadUserByIdentifier('foobar')); |
49 | 48 | } |
50 | 49 |
|
51 | 50 | public function testLoadUserByInvalidUsername() |
52 | 51 | { |
53 | | - if (class_exists(UserNotFoundException::class)) { |
54 | | - $this->expectException(UserNotFoundException::class); |
55 | | - } else { |
56 | | - $this->expectException(UsernameNotFoundException::class); |
57 | | - } |
| 52 | + $this->expectException(UserNotFoundException::class); |
58 | 53 |
|
59 | 54 | $this->userManager->expects($this->once()) |
60 | 55 | ->method('findUserByUsername') |
61 | 56 | ->with('foobar') |
62 | 57 | ->will($this->returnValue(null)); |
63 | 58 |
|
64 | | - $this->userProvider->loadUserByUsername('foobar'); |
| 59 | + $this->userProvider->loadUserByIdentifier('foobar'); |
65 | 60 | } |
66 | 61 |
|
67 | 62 | public function testRefreshUserBy() |
@@ -89,11 +84,7 @@ public function testRefreshUserBy() |
89 | 84 |
|
90 | 85 | public function testRefreshDeleted() |
91 | 86 | { |
92 | | - if (class_exists(UserNotFoundException::class)) { |
93 | | - $this->expectException(UserNotFoundException::class); |
94 | | - } else { |
95 | | - $this->expectException(UsernameNotFoundException::class); |
96 | | - } |
| 87 | + $this->expectException(UserNotFoundException::class); |
97 | 88 |
|
98 | 89 | $user = $this->getMockForAbstractClass('FOS\UserBundle\Model\User'); |
99 | 90 | $this->userManager->expects($this->once()) |
|
0 commit comments