Skip to content

Commit f827cc8

Browse files
test: run SwooleClientTest on openswoole as well. (#692)
1 parent f3ae57e commit f827cc8

File tree

1 file changed

+16
-33
lines changed

1 file changed

+16
-33
lines changed

tests/SwooleClientTest.php

Lines changed: 16 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
class SwooleClientTest extends TestCase
1515
{
16-
public function test_marshal_request_method_marshals_proper_illuminate_request()
16+
public function test_marshal_request_method_marshals_proper_illuminate_request(): void
1717
{
1818
$client = new SwooleClient;
1919

@@ -57,7 +57,7 @@ public function rawContent()
5757
$this->assertSame($givenContext, $context);
5858
}
5959

60-
public function test_can_serve_static_files_if_configured_to_and_file_is_within_public_directory()
60+
public function test_can_serve_static_files_if_configured_to_and_file_is_within_public_directory(): void
6161
{
6262
$client = new SwooleClient;
6363

@@ -71,7 +71,7 @@ public function test_can_serve_static_files_if_configured_to_and_file_is_within_
7171
$this->assertTrue($client->canServeRequestAsStaticFile($request, $context));
7272
}
7373

74-
public function test_cant_serve_static_files_if_file_is_outside_public_directory()
74+
public function test_cant_serve_static_files_if_file_is_outside_public_directory(): void
7575
{
7676
$client = new SwooleClient;
7777

@@ -85,7 +85,7 @@ public function test_cant_serve_static_files_if_file_is_outside_public_directory
8585
$this->assertFalse($client->canServeRequestAsStaticFile($request, $context));
8686
}
8787

88-
public function test_cant_serve_static_files_if_file_has_forbidden_extension()
88+
public function test_cant_serve_static_files_if_file_has_forbidden_extension(): void
8989
{
9090
$client = new SwooleClient;
9191

@@ -100,7 +100,7 @@ public function test_cant_serve_static_files_if_file_has_forbidden_extension()
100100
}
101101

102102
/** @doesNotPerformAssertions @test */
103-
public function test_static_file_can_be_served()
103+
public function test_static_file_can_be_served(): void
104104
{
105105
$client = new SwooleClient;
106106

@@ -119,7 +119,8 @@ public function test_static_file_can_be_served()
119119
$client->serveStaticFile($request, $context);
120120
}
121121

122-
public function test_static_file_headers_can_be_sent()
122+
/** @doesNotPerformAssertions @test */
123+
public function test_static_file_headers_can_be_sent(): void
123124
{
124125
$client = new SwooleClient;
125126

@@ -145,7 +146,7 @@ public function test_static_file_headers_can_be_sent()
145146
$client->serveStaticFile($request, $context);
146147
}
147148

148-
public function test_can_serve_static_files_through_symlink()
149+
public function test_can_serve_static_files_through_symlink(): void
149150
{
150151
$client = new SwooleClient;
151152

@@ -159,7 +160,7 @@ public function test_can_serve_static_files_through_symlink()
159160
$this->assertTrue($client->canServeRequestAsStaticFile($request, $context));
160161
}
161162

162-
public function test_cant_serve_static_files_through_symlink_using_directory_traversal()
163+
public function test_cant_serve_static_files_through_symlink_using_directory_traversal(): void
163164
{
164165
$client = new SwooleClient;
165166

@@ -174,13 +175,11 @@ public function test_cant_serve_static_files_through_symlink_using_directory_tra
174175
}
175176

176177
/** @doesNotPerformAssertions @test */
177-
public function test_respond_method_sends_response_to_swoole()
178+
public function test_respond_method_sends_response_to_swoole(): void
178179
{
179-
$client = new SwooleClient;
180+
$this->createApplication();
180181

181-
if (extension_loaded('openswoole')) {
182-
$this->markTestSkipped('This test is not compatible with Open Swoole');
183-
}
182+
$client = new SwooleClient;
184183

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

@@ -203,14 +202,10 @@ public function test_respond_method_sends_response_to_swoole()
203202
}
204203

205204
/** @doesNotPerformAssertions @test */
206-
public function test_respond_method_send_streamed_response_to_swoole()
205+
public function test_respond_method_send_streamed_response_to_swoole(): void
207206
{
208207
$client = new SwooleClient;
209208

210-
if (extension_loaded('openswoole')) {
211-
$this->markTestSkipped('This test is not compatible with Open Swoole');
212-
}
213-
214209
$swooleResponse = Mockery::mock('Swoole\Http\Response');
215210

216211
$swooleResponse->shouldReceive('status')->once()->with(200);
@@ -228,14 +223,10 @@ public function test_respond_method_send_streamed_response_to_swoole()
228223
}
229224

230225
/** @doesNotPerformAssertions @test */
231-
public function test_respond_method_with_laravel_specific_status_code_sends_response_to_swoole()
226+
public function test_respond_method_with_laravel_specific_status_code_sends_response_to_swoole(): void
232227
{
233228
$client = new SwooleClient;
234229

235-
if (extension_loaded('openswoole')) {
236-
$this->markTestSkipped('This test is not compatible with Open Swoole');
237-
}
238-
239230
$swooleResponse = Mockery::mock('Swoole\Http\Response');
240231

241232
$swooleResponse->shouldReceive('status')->once()->with(419, 'Page Expired');
@@ -251,14 +242,10 @@ public function test_respond_method_with_laravel_specific_status_code_sends_resp
251242
}
252243

253244
/** @doesNotPerformAssertions @test */
254-
public function test_error_method_sends_error_response_to_swoole()
245+
public function test_error_method_sends_error_response_to_swoole(): void
255246
{
256247
$client = new SwooleClient;
257248

258-
if (extension_loaded('openswoole')) {
259-
$this->markTestSkipped('This test is not compatible with Open Swoole');
260-
}
261-
262249
$swooleResponse = Mockery::spy('Swoole\Http\Response');
263250

264251
$app = $this->createApplication();
@@ -275,14 +262,10 @@ public function test_error_method_sends_error_response_to_swoole()
275262
}
276263

277264
/** @doesNotPerformAssertions @test */
278-
public function test_error_method_sends_detailed_error_response_to_swoole_in_debug_mode()
265+
public function test_error_method_sends_detailed_error_response_to_swoole_in_debug_mode(): void
279266
{
280267
$client = new SwooleClient;
281268

282-
if (extension_loaded('openswoole')) {
283-
$this->markTestSkipped('This test is not compatible with Open Swoole');
284-
}
285-
286269
$swooleResponse = Mockery::spy('Swoole\Http\Response');
287270

288271
$app = $this->createApplication();

0 commit comments

Comments
 (0)