Skip to content

Commit 482f079

Browse files
timacdonalddriesvints
authored andcommitted
[2.x] Fix inter test dependencies (#914)
* Flush container between tests * Ensure app is available when needed
1 parent 50afb5b commit 482f079

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

tests/RoadRunnerServerProcessInspectorTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public function test_can_determine_if_roadrunner_server_process_is_running_when_
5050
/** @doesNotPerformAssertions @test */
5151
public function test_roadrunner_server_process_can_be_reloaded()
5252
{
53+
$this->createApplication();
5354
$inspector = new ServerProcessInspector(
5455
$processIdFile = new ServerStateFile(sys_get_temp_dir().'/swoole.pid'),
5556
$processFactory = Mockery::mock(SymfonyProcessFactory::class),

tests/SequentialTaskDispatcherTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public function test_tasks_can_be_resolved()
2727

2828
public function test_resolving_tasks_with_exceptions_do_not_effect_other_tasks()
2929
{
30+
$this->createApplication();
3031
$dispatcher = new SequentialTaskDispatcher;
3132

3233
$a = false;
@@ -77,6 +78,7 @@ public function test_tasks_can_be_dispatched()
7778

7879
public function test_resolving_tasks_propagate_exceptions()
7980
{
81+
$this->createApplication();
8082
$dispatcher = new SequentialTaskDispatcher();
8183

8284
$this->expectException(TaskException::class);
@@ -89,6 +91,7 @@ public function test_resolving_tasks_propagate_exceptions()
8991

9092
public function test_resolving_tasks_propagate_dd_calls()
9193
{
94+
$this->createApplication();
9295
$dispatcher = new SequentialTaskDispatcher();
9396

9497
$this->expectException(DdException::class);

tests/SwooleClientTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ public function test_static_file_can_be_served(): void
124124
/** @doesNotPerformAssertions @test */
125125
public function test_static_file_headers_can_be_sent(): void
126126
{
127+
$this->createApplication();
127128
$client = new SwooleClient;
128129

129130
$request = Request::create('/foo.txt', 'GET');
@@ -206,6 +207,7 @@ public function test_respond_method_sends_response_to_swoole(): void
206207
/** @doesNotPerformAssertions @test */
207208
public function test_respond_method_send_streamed_response_to_swoole(): void
208209
{
210+
$this->createApplication();
209211
$client = new SwooleClient;
210212

211213
$swooleResponse = Mockery::mock('Swoole\Http\Response');
@@ -227,6 +229,7 @@ public function test_respond_method_send_streamed_response_to_swoole(): void
227229
/** @doesNotPerformAssertions @test */
228230
public function test_respond_method_with_laravel_specific_status_code_sends_response_to_swoole(): void
229231
{
232+
$this->createApplication();
230233
$client = new SwooleClient;
231234

232235
$swooleResponse = Mockery::mock('Swoole\Http\Response');
@@ -286,6 +289,7 @@ public function test_error_method_sends_detailed_error_response_to_swoole_in_deb
286289
/** @doesNotPerformAssertions @test */
287290
public function test_respond_method_send_not_chunked_response_to_swoole(): void
288291
{
292+
$this->createApplication();
289293
$client = new SwooleClient;
290294

291295
$swooleResponse = Mockery::mock(SwooleResponse::class);
@@ -307,6 +311,7 @@ public function test_respond_method_send_not_chunked_response_to_swoole(): void
307311
/** @doesNotPerformAssertions @test */
308312
public function test_respond_method_send_chunked_response_to_swoole(): void
309313
{
314+
$this->createApplication();
310315
$client = new SwooleClient(6);
311316

312317
$swooleResponse = Mockery::mock('Swoole\Http\Response');

tests/TestCase.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
namespace Laravel\Octane\Tests;
44

55
use Carbon\Laravel\ServiceProvider as CarbonServiceProvider;
6+
use Illuminate\Container\Container;
7+
use Illuminate\Support\Facades\Facade;
68
use Laravel\Octane\ApplicationFactory;
79
use Laravel\Octane\Contracts\Client;
810
use Laravel\Octane\Octane;
@@ -72,6 +74,11 @@ protected function tearDown(): void
7274
{
7375
parent::tearDown();
7476

77+
Container::setInstance(null);
78+
79+
Facade::clearResolvedInstances();
80+
Facade::setFacadeApplication(null);
81+
7582
Mockery::close();
7683
}
7784
}

0 commit comments

Comments
 (0)