22
33namespace Laravel \Ui \Tests \AuthBackend ;
44
5- use Illuminate \Foundation \Auth \ThrottlesLogins ;
5+ use Illuminate \Foundation \Auth \ThrottlesLogins as ThrottlesLoginsTrait ;
66use Orchestra \Testbench \TestCase ;
77use Illuminate \Http \Request ;
8- use PHPUnit \Framework \MockObject \MockObject ;
8+ use PHPUnit \Framework \Attributes \DataProvider ;
9+ use PHPUnit \Framework \Attributes \Test ;
910
1011class ThrottleLoginsTest extends TestCase
1112{
12- /**
13- * @test
14- * @dataProvider emailProvider
15- */
13+ #[Test]
14+ #[DataProvider('emailProvider ' )]
1615 public function it_can_generate_throttle_key (string $ email , string $ expectedEmail ): void
1716 {
18- $ throttle = $ this ->getMockForTrait (ThrottlesLogins::class, [], '' , true , true , true , [ ' username ' ] );
17+ $ throttle = $ this ->createMock (ThrottlesLogins::class);
1918 $ throttle ->method ('username ' )->willReturn ('email ' );
2019 $ reflection = new \ReflectionClass ($ throttle );
2120 $ method = $ reflection ->getMethod ('throttleKey ' );
@@ -33,8 +32,18 @@ public static function emailProvider(): array
3332 return [
3433 'lowercase special characters ' => [
'ⓣⓔⓢⓣ@ⓛⓐⓡⓐⓥⓔⓛ.ⓒⓞⓜ ' ,
'[email protected] ' ],
3534 'uppercase special characters ' => [
'ⓉⒺⓈⓉ@ⓁⒶⓇⒶⓋⒺⓁ.ⒸⓄⓂ ' ,
'[email protected] ' ],
36- 'special character numbers ' =>[
'test⑩⓸③@laravel.com ' ,
'[email protected] ' ],
35+ 'special character numbers ' =>
[
'test⑩⓸③@laravel.com ' ,
'[email protected] ' ],
37363837 ];
3938 }
4039}
40+
41+ class ThrottlesLogins
42+ {
43+ use ThrottlesLoginsTrait;
44+
45+ public function username ()
46+ {
47+ return 'email ' ;
48+ }
49+ }
0 commit comments