Skip to content

Commit 6350194

Browse files
authored
[10.x] Test Improvements (#48797)
* [10.x] Test Improvements Remove deprecated `@test` usage and always prefix test method name with `test`. Signed-off-by: Mior Muhammad Zaki <[email protected]> * Apply suggestions from code review --------- Signed-off-by: Mior Muhammad Zaki <[email protected]>
1 parent 61ea0bc commit 6350194

8 files changed

+13
-29
lines changed

tests/Database/DatabaseEloquentIrregularPluralTest.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,14 @@ protected function schema()
7171
return $connection->getSchemaBuilder();
7272
}
7373

74-
/** @test */
75-
public function itPluralizesTheTableName()
74+
public function testItPluralizesTheTableName()
7675
{
7776
$model = new IrregularPluralHuman;
7877

7978
$this->assertSame('irregular_plural_humans', $model->getTable());
8079
}
8180

82-
/** @test */
83-
public function itTouchesTheParentWithAnIrregularPlural()
81+
public function testItTouchesTheParentWithAnIrregularPlural()
8482
{
8583
Carbon::setTestNow('2018-05-01 12:13:14');
8684

@@ -104,8 +102,7 @@ public function itTouchesTheParentWithAnIrregularPlural()
104102
$this->assertSame('2018-05-01 15:16:17', (string) $human->updated_at);
105103
}
106104

107-
/** @test */
108-
public function itPluralizesMorphToManyRelationships()
105+
public function testItPluralizesMorphToManyRelationships()
109106
{
110107
$human = IrregularPluralHuman::create(['email' => '[email protected]']);
111108

tests/Foundation/FoundationApplicationTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,6 @@ public function testEnvPathsAreAbsoluteInWindows()
500500
);
501501
}
502502

503-
/** @test */
504503
public function testMacroable(): void
505504
{
506505
$app = new Application;
@@ -517,7 +516,6 @@ public function testMacroable(): void
517516
$this->assertFalse($app->foo());
518517
}
519518

520-
/** @test */
521519
public function testUseConfigPath(): void
522520
{
523521
$app = new Application;

tests/Integration/Auth/ForgotPasswordTest.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ protected function defineRoutes($router)
4343
})->name('custom.password.reset');
4444
}
4545

46-
/** @test */
47-
public function it_can_send_forgot_password_email()
46+
public function testItCanSendForgotPasswordEmail()
4847
{
4948
Notification::fake();
5049

@@ -67,8 +66,7 @@ function (ResetPassword $notification, $channels) use ($user) {
6766
);
6867
}
6968

70-
/** @test */
71-
public function it_can_send_forgot_password_email_via_create_url_using()
69+
public function testItCanSendForgotPasswordEmailViaCreateUrlUsing()
7270
{
7371
Notification::fake();
7472

@@ -95,8 +93,7 @@ function (ResetPassword $notification, $channels) use ($user) {
9593
);
9694
}
9795

98-
/** @test */
99-
public function it_can_send_forgot_password_email_via_to_mail_using()
96+
public function testItCanSendForgotPasswordEmailViaToMailUsing()
10097
{
10198
Notification::fake();
10299

tests/Integration/Auth/ForgotPasswordWithoutDefaultRoutesTest.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ protected function defineRoutes($router)
3939
})->name('custom.password.reset');
4040
}
4141

42-
/** @test */
43-
public function it_cannot_send_forgot_password_email()
42+
public function testItCannotSendForgotPasswordEmail()
4443
{
4544
$this->expectException('Symfony\Component\Routing\Exception\RouteNotFoundException');
4645
$this->expectExceptionMessage('Route [password.reset] not defined.');
@@ -66,8 +65,7 @@ function (ResetPassword $notification, $channels) use ($user) {
6665
);
6766
}
6867

69-
/** @test */
70-
public function it_can_send_forgot_password_email_via_create_url_using()
68+
public function testItCanSendForgotPasswordEmailViaCreateUrlUsing()
7169
{
7270
Notification::fake();
7371

@@ -94,8 +92,7 @@ function (ResetPassword $notification, $channels) use ($user) {
9492
);
9593
}
9694

97-
/** @test */
98-
public function it_can_send_forgot_password_email_via_to_mail_using()
95+
public function testItCanSendForgotPasswordEmailViaToMailUsing()
9996
{
10097
Notification::fake();
10198

tests/Integration/Foundation/FoundationServiceProvidersTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ protected function getPackageProviders($app)
1212
return [HeadServiceProvider::class];
1313
}
1414

15-
/** @test */
16-
public function it_can_boot_service_provider_registered_from_another_service_provider()
15+
public function testItCanBootServiceProviderRegisteredFromAnotherServiceProvider()
1716
{
1817
$this->assertTrue($this->app['tail.registered']);
1918
$this->assertTrue($this->app['tail.booted']);

tests/Integration/Generators/FactoryMakeCommandTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ class FactoryMakeCommandTest extends TestCase
88
'database/factories/FooFactory.php',
99
];
1010

11-
/** @test */
1211
public function testItCanGenerateFactoryFile()
1312
{
1413
$this->artisan('make:factory', ['name' => 'FooFactory'])

tests/Integration/Generators/ResourceMakeCommandTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ class ResourceMakeCommandTest extends TestCase
99
'app/Http/Resources/FooResourceCollection.php',
1010
];
1111

12-
/** @test */
13-
public function it_can_generate_resource_file()
12+
public function testItCanGenerateResourceFile()
1413
{
1514
$this->artisan('make:resource', ['name' => 'FooResource'])
1615
->assertExitCode(0);
@@ -22,8 +21,7 @@ public function it_can_generate_resource_file()
2221
], 'app/Http/Resources/FooResource.php');
2322
}
2423

25-
/** @test */
26-
public function it_can_generate_resource_collection_file()
24+
public function testItCanGenerateResourceCollectionFile()
2725
{
2826
$this->artisan('make:resource', ['name' => 'FooResourceCollection', '--collection' => true])
2927
->assertExitCode(0);

tests/Support/SupportStrTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,8 +533,7 @@ public function testRandom()
533533
$this->assertIsString(Str::random());
534534
}
535535

536-
/** @test */
537-
public function TestWhetherTheNumberOfGeneratedCharactersIsEquallyDistributed()
536+
public function testWhetherTheNumberOfGeneratedCharactersIsEquallyDistributed()
538537
{
539538
$results = [];
540539
// take 6.200.000 samples, because there are 62 different characters

0 commit comments

Comments
 (0)