Skip to content

Commit f2ec6fa

Browse files
authored
[10.x] Test Improvements for Console tests (#50685)
Signed-off-by: Mior Muhammad Zaki <[email protected]>
1 parent ebf2a83 commit f2ec6fa

File tree

7 files changed

+8
-31
lines changed

7 files changed

+8
-31
lines changed

tests/Integration/Console/CommandEventsTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Illuminate\Support\Str;
1313
use Orchestra\Testbench\Foundation\Application as Testbench;
1414
use Orchestra\Testbench\TestCase;
15+
use PHPUnit\Framework\Attributes\DataProvider;
1516

1617
class CommandEventsTest extends TestCase
1718
{
@@ -48,9 +49,7 @@ protected function setUp(): void
4849
parent::setUp();
4950
}
5051

51-
/**
52-
* @dataProvider foregroundCommandEventsProvider
53-
*/
52+
#[DataProvider('foregroundCommandEventsProvider')]
5453
public function testCommandEventsReceiveParsedInput($callback)
5554
{
5655
$this->app[ConsoleKernel::class]->registerCommand(new CommandEventsTestCommand);

tests/Integration/Console/CommandSchedulingTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Illuminate\Filesystem\Filesystem;
77
use Illuminate\Support\Str;
88
use Orchestra\Testbench\TestCase;
9+
use PHPUnit\Framework\Attributes\DataProvider;
910

1011
class CommandSchedulingTest extends TestCase
1112
{
@@ -62,9 +63,7 @@ protected function tearDown(): void
6263
parent::tearDown();
6364
}
6465

65-
/**
66-
* @dataProvider executionProvider
67-
*/
66+
#[DataProvider('executionProvider')]
6867
public function testExecutionOrder($background, $expected)
6968
{
7069
$schedule = $this->app->make(Schedule::class);

tests/Integration/Console/GeneratorCommandTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33
namespace Illuminate\Tests\Integration\Console;
44

55
use Orchestra\Testbench\TestCase;
6+
use PHPUnit\Framework\Attributes\DataProvider;
67

78
class GeneratorCommandTest extends TestCase
89
{
9-
/**
10-
* @dataProvider reservedNamesDataProvider
11-
*/
10+
#[DataProvider('reservedNamesDataProvider')]
1211
public function testItCannotGenerateClassUsingReservedName($given)
1312
{
1413
$this->artisan('make:command', ['name' => $given])

tests/Integration/Console/Scheduling/CallbackEventTest.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,6 @@
1010

1111
class CallbackEventTest extends TestCase
1212
{
13-
protected function tearDown(): void
14-
{
15-
parent::tearDown();
16-
17-
m::close();
18-
}
19-
2013
public function testDefaultResultIsSuccess()
2114
{
2215
$success = null;

tests/Integration/Console/Scheduling/EventPingTest.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,6 @@
1616

1717
class EventPingTest extends TestCase
1818
{
19-
protected function tearDown(): void
20-
{
21-
parent::tearDown();
22-
23-
m::close();
24-
}
25-
2619
public function testPingRescuesTransferExceptions()
2720
{
2821
$this->spy(ExceptionHandler::class)

tests/Integration/Console/Scheduling/SubMinuteSchedulingTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Illuminate\Support\Facades\Config;
88
use Illuminate\Support\Sleep;
99
use Orchestra\Testbench\TestCase;
10+
use PHPUnit\Framework\Attributes\DataProvider;
1011

1112
class SubMinuteSchedulingTest extends TestCase
1213
{
@@ -45,7 +46,7 @@ public function test_it_doesnt_wait_for_sub_minute_events_when_none_are_schedule
4546
Sleep::assertNeverSlept();
4647
}
4748

48-
/** @dataProvider frequencyProvider */
49+
#[DataProvider('frequencyProvider')]
4950
public function test_it_runs_sub_minute_callbacks($frequency, $expectedRuns)
5051
{
5152
$runs = 0;

tests/Integration/Cookie/CookieTest.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,6 @@
1414

1515
class CookieTest extends TestCase
1616
{
17-
protected function tearDown(): void
18-
{
19-
parent::tearDown();
20-
21-
Carbon::setTestNow(null);
22-
}
23-
2417
public function test_cookie_is_sent_back_with_proper_expire_time_when_should_expire_on_close()
2518
{
2619
$this->app['config']->set('session.expire_on_close', true);

0 commit comments

Comments
 (0)