Skip to content

Commit bb603c7

Browse files
committed
chore: add return types
1 parent 1eca927 commit bb603c7

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed

tests/DataTableServiceTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class DataTableServiceTest extends TestCase
1515
use DatabaseTransactions;
1616

1717
/** @test */
18-
public function it_can_handle_ajax_request()
18+
public function it_can_handle_ajax_request(): void
1919
{
2020
$response = $this->getAjax('/users');
2121

@@ -27,7 +27,7 @@ public function it_can_handle_ajax_request()
2727
}
2828

2929
/** @test */
30-
public function it_returns_view_on_normal_get_request()
30+
public function it_returns_view_on_normal_get_request(): void
3131
{
3232
$response = $this->get('users');
3333

@@ -36,31 +36,31 @@ public function it_returns_view_on_normal_get_request()
3636
}
3737

3838
/** @test */
39-
public function it_can_return_a_csv_file()
39+
public function it_can_return_a_csv_file(): void
4040
{
4141
$response = $this->get('users?action=csv');
4242

4343
$this->assertInstanceOf(BinaryFileResponse::class, $response->baseResponse);
4444
}
4545

4646
/** @test */
47-
public function it_can_return_a_xls_file()
47+
public function it_can_return_a_xls_file(): void
4848
{
4949
$response = $this->get('users?action=excel');
5050

5151
$this->assertInstanceOf(BinaryFileResponse::class, $response->baseResponse);
5252
}
5353

5454
/** @test */
55-
public function it_can_return_a_pdf_file()
55+
public function it_can_return_a_pdf_file(): void
5656
{
5757
$response = $this->get('users?action=pdf');
5858

5959
$this->assertInstanceOf(Response::class, $response->baseResponse);
6060
}
6161

6262
/** @test */
63-
public function it_allows_before_response_callback()
63+
public function it_allows_before_response_callback(): void
6464
{
6565
$response = $this->getAjax('users/before');
6666
$response->assertOk();
@@ -70,7 +70,7 @@ public function it_allows_before_response_callback()
7070
}
7171

7272
/** @test */
73-
public function it_allows_response_callback()
73+
public function it_allows_response_callback(): void
7474
{
7575
$response = $this->getAjax('users/response');
7676
$response->assertOk();

tests/DataTables/UsersDataTable.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ class UsersDataTable extends DataTable
1515
*/
1616
public function dataTable(Builder $query): EloquentDataTable
1717
{
18-
return datatables()->eloquent($query)->setRowId('id');
18+
return (new EloquentDataTable($query))
19+
->setRowId('id');
1920
}
2021

2122
public function query(User $user): Builder

tests/Providers/TestServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class TestServiceProvider extends ServiceProvider
88
{
9-
public function boot()
9+
public function boot(): void
1010
{
1111
$this->loadViewsFrom(__DIR__.'/../views', 'tests');
1212
}

tests/TestCase.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ protected function setUp(): void
2323
$this->seedDatabase();
2424
}
2525

26-
protected function migrateDatabase()
26+
protected function migrateDatabase(): void
2727
{
2828
/** @var \Illuminate\Database\Schema\Builder $schemaBuilder */
2929
$schemaBuilder = $this->app['db']->connection()->getSchemaBuilder();
@@ -62,7 +62,7 @@ protected function migrateDatabase()
6262
}
6363
}
6464

65-
protected function seedDatabase()
65+
protected function seedDatabase(): void
6666
{
6767
$adminRole = Role::create(['role' => 'Administrator']);
6868
$userRole = Role::create(['role' => 'User']);
@@ -115,12 +115,12 @@ protected function getPackageProviders($app): array
115115
];
116116
}
117117

118-
public function getAjax($uri, array $headers = []): TestResponse
118+
public function getAjax(string $uri, array $headers = []): TestResponse
119119
{
120120
return $this->getJson($uri, array_merge(['X-Requested-With' => 'XMLHttpRequest'], $headers));
121121
}
122122

123-
public function postAjax($uri, array $headers = []): TestResponse
123+
public function postAjax(string $uri, array $headers = []): TestResponse
124124
{
125125
return $this->postJson($uri, array_merge(['X-Requested-With' => 'XMLHttpRequest'], $headers));
126126
}

0 commit comments

Comments
 (0)