Skip to content

Commit 3ea6180

Browse files
authored
[12.x] Test Improvements (#54782)
* [12.x] Test Improvements Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> --------- Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
1 parent abf823f commit 3ea6180

17 files changed

+21
-69
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
"league/flysystem-read-only": "^3.25.1",
112112
"league/flysystem-sftp-v3": "^3.25.1",
113113
"mockery/mockery": "^1.6.10",
114-
"orchestra/testbench-core": "^10.0",
114+
"orchestra/testbench-core": "^10.0.0",
115115
"pda/pheanstalk": "^5.0.6",
116116
"php-http/discovery": "^1.15",
117117
"phpstan/phpstan": "^2.0",

tests/Integration/Cache/Psr6RedisTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ protected function setUp(): void
2121

2222
protected function tearDown(): void
2323
{
24-
parent::tearDown();
25-
2624
$this->tearDownRedis();
25+
26+
parent::tearDown();
2727
}
2828

2929
#[DataProvider('redisClientDataProvider')]

tests/Integration/Cache/RedisStoreTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,9 @@ protected function setUp(): void
2525

2626
protected function tearDown(): void
2727
{
28-
parent::tearDown();
29-
3028
$this->tearDownRedis();
31-
m::close();
29+
30+
parent::tearDown();
3231
}
3332

3433
public function testCacheTtl(): void

tests/Integration/Console/CallbackSchedulingTest.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,6 @@ public function store($name = null)
4545
$container->instance(SchedulingMutex::class, new CacheSchedulingMutex($cache));
4646
}
4747

48-
protected function tearDown(): void
49-
{
50-
Container::setInstance(null);
51-
52-
parent::tearDown();
53-
}
54-
5548
public function testExecutionOrder()
5649
{
5750
$event = $this->app->make(Schedule::class)

tests/Integration/Console/Scheduling/ScheduleListCommandTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,9 @@ public function testClosureCommandsMayBeScheduled()
156156

157157
protected function tearDown(): void
158158
{
159-
parent::tearDown();
160-
161159
putenv('SHELL_VERBOSITY');
162160

163-
ScheduleListCommand::resolveTerminalWidthUsing(null);
161+
parent::tearDown();
164162
}
165163
}
166164

tests/Integration/Database/EloquentBelongsToManyTest.php

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

1616
class EloquentBelongsToManyTest extends DatabaseTestCase
1717
{
18-
protected function tearDown(): void
19-
{
20-
parent::tearDown();
21-
22-
Carbon::setTestNow(null);
23-
}
24-
2518
protected function afterRefreshingDatabase()
2619
{
2720
Schema::create('users', function (Blueprint $table) {

tests/Integration/Database/EloquentMassPrunableTest.php

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Illuminate\Tests\Integration\Database;
44

5-
use Illuminate\Container\Container;
65
use Illuminate\Contracts\Events\Dispatcher;
76
use Illuminate\Database\Eloquent\MassPrunable;
87
use Illuminate\Database\Eloquent\Model;
@@ -19,13 +18,11 @@ protected function setUp(): void
1918
{
2019
parent::setUp();
2120

22-
Container::setInstance($container = new Container);
23-
24-
$container->singleton(Dispatcher::class, function () {
21+
$this->app->singleton(Dispatcher::class, function () {
2522
return m::mock(Dispatcher::class);
2623
});
2724

28-
$container->alias(Dispatcher::class, 'events');
25+
$this->app->alias(Dispatcher::class, 'events');
2926
}
3027

3128
protected function afterRefreshingDatabase()
@@ -93,15 +90,6 @@ public function testPrunesSoftDeletedRecords()
9390
$this->assertEquals(0, MassPrunableSoftDeleteTestModel::count());
9491
$this->assertEquals(2000, MassPrunableSoftDeleteTestModel::withTrashed()->count());
9592
}
96-
97-
protected function tearDown(): void
98-
{
99-
parent::tearDown();
100-
101-
Container::setInstance(null);
102-
103-
m::close();
104-
}
10593
}
10694

10795
class MassPrunableTestModel extends Model

tests/Integration/Events/ListenerTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ class ListenerTest extends TestCase
1111
{
1212
protected function tearDown(): void
1313
{
14-
parent::tearDown();
15-
1614
ListenerTestListener::$ran = false;
1715
ListenerTestListenerAfterCommit::$ran = false;
1816

tests/Integration/Foundation/Console/OptimizeCommandTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class OptimizeCommandTest extends TestCase
1414
protected $files = [
1515
'bootstrap/cache/config.php',
1616
'bootstrap/cache/events.php',
17+
'bootstrap/cache/routes-v7.php',
1718
];
1819

1920
protected function getPackageProviders($app): array

tests/Integration/Foundation/Support/Providers/RouteServiceProviderHealthTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44

55
use Illuminate\Foundation\Application;
66
use Illuminate\Support\Str;
7+
use Orchestra\Testbench\Attributes\WithConfig;
78
use Orchestra\Testbench\TestCase;
89

10+
#[WithConfig('filesystems.disks.local.serve', false)]
911
class RouteServiceProviderHealthTest extends TestCase
1012
{
1113
/**

0 commit comments

Comments
 (0)