diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index c58ccce..eb4a0a6 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: true matrix: - php: [8.0, 8.1] + php: [8.1, 8.2] stability: [prefer-stable] name: PHP ${{ matrix.php }} - ${{ matrix.stability }} @@ -42,4 +42,4 @@ jobs: command: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress - name: Execute tests - run: vendor/bin/phpunit --verbose + run: vendor/bin/phpunit diff --git a/.gitignore b/.gitignore index df0e1ea..cf5ef41 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /coverage composer.phar composer.lock +/.phpunit.cache diff --git a/README.md b/README.md index 69ca495..92c7c53 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Laravel DataTables Buttons Plugin -[![Laravel 9.x](https://img.shields.io/badge/Laravel-9.x-orange.svg)](http://laravel.com) +[![Laravel 10.x](https://img.shields.io/badge/Laravel-10.x-orange.svg)](http://laravel.com) [![Latest Stable Version](https://img.shields.io/packagist/v/yajra/laravel-datatables-buttons.svg)](https://packagist.org/packages/yajra/laravel-datatables-buttons) [![Build Status](https://travis-ci.org/yajra/laravel-datatables-buttons.svg?branch=master)](https://travis-ci.org/yajra/laravel-datatables-buttons) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/yajra/laravel-datatables-buttons/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/yajra/laravel-datatables-buttons/?branch=master) @@ -11,8 +11,8 @@ This package is a plugin of [Laravel DataTables](https://github.com/yajra/larave ## Requirements -- [PHP >= 8.0.2](http://php.net/) -- [Laravel 9.x](https://github.com/laravel/framework) +- [PHP >= 8.1](http://php.net/) +- [Laravel 10.x](https://github.com/laravel/framework) - [Laravel DataTables](https://github.com/yajra/laravel-datatables) - [jQuery DataTables v1.10.x](http://datatables.net/) - [jQuery DataTables Buttons Extension](https://datatables.net/reference/button/) @@ -27,10 +27,11 @@ This package is a plugin of [Laravel DataTables](https://github.com/yajra/larave |:--------------|:--------| | 8.x and below | 4.x | | 9.x | 9.x | +| 10.x | 10.x | ## Quick Installation -`composer require yajra/laravel-datatables-buttons:^9.0` +`composer require yajra/laravel-datatables-buttons:^10` #### Service Provider (Optional on Laravel 5.5) diff --git a/composer.json b/composer.json index 5be84e8..7bd7cc7 100644 --- a/composer.json +++ b/composer.json @@ -15,17 +15,17 @@ } ], "require": { - "php": "^8.0.2", - "yajra/laravel-datatables-oracle": "10.*", - "yajra/laravel-datatables-html": "9.*", - "illuminate/console": "*" + "php": "^8.1", + "yajra/laravel-datatables-oracle": "^10", + "yajra/laravel-datatables-html": "^10", + "illuminate/console": "^10" }, "require-dev": { - "maatwebsite/excel": "^3.1.40", - "nunomaduro/larastan": "2.1.*", - "orchestra/testbench": "^7.3", - "rap2hpoutre/fast-excel": "^3.2", - "barryvdh/laravel-snappy": "^1.0" + "maatwebsite/excel": "^3.1.46", + "nunomaduro/larastan": "^2.4", + "orchestra/testbench": "^8", + "rap2hpoutre/fast-excel": "^5.1", + "barryvdh/laravel-snappy": "^1.0.1" }, "autoload": { "psr-4": { @@ -39,7 +39,7 @@ }, "extra": { "branch-alias": { - "dev-master": "9.0-dev" + "dev-master": "10.0-dev" }, "laravel": { "providers": [ @@ -48,6 +48,7 @@ } }, "suggest": { + "yajra/laravel-datatables-export": "Exporting of dataTables (excel, csv and PDF) via livewire and queue worker.", "maatwebsite/excel": "Exporting of dataTables (excel, csv and PDF) using maatwebsite package.", "rap2hpoutre/fast-excel": "Faster exporting of dataTables using fast-excel package.", "dompdf/dompdf": "Allows exporting of dataTable to PDF using the DomPDF.", diff --git a/phpunit.xml.dist b/phpunit.xml.dist index b4af771..f258a25 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,18 +1,22 @@ - - - - ./tests/ - ./tests/views/ - - + + + ./tests/ + ./tests/views/ + ./tests/DataTables/ + ./tests/Providers/ + ./tests/Models/ + ./tests/TestCase.php + + diff --git a/src/Services/DataTable.php b/src/Services/DataTable.php index a3419d0..b00ff8d 100644 --- a/src/Services/DataTable.php +++ b/src/Services/DataTable.php @@ -217,6 +217,7 @@ public function render(string $view = null, array $data = [], array $mergeData = return app()->call($callback); } + /** @phpstan-ignore-next-line */ return view($view, $data, $mergeData)->with($this->dataTableVariable, $this->getHtmlBuilder()); } @@ -610,10 +611,6 @@ public function csv() * * @return \Illuminate\Http\Response|string|\Symfony\Component\HttpFoundation\StreamedResponse * - * @throws \Box\Spout\Common\Exception\IOException - * @throws \Box\Spout\Common\Exception\InvalidArgumentException - * @throws \Box\Spout\Common\Exception\UnsupportedTypeException - * @throws \Box\Spout\Writer\Exception\WriterNotOpenedException * @throws \Exception */ public function pdf() diff --git a/tests/DataTableServiceTest.php b/tests/DataTableServiceTest.php index 341392a..0afcebb 100644 --- a/tests/DataTableServiceTest.php +++ b/tests/DataTableServiceTest.php @@ -15,7 +15,7 @@ class DataTableServiceTest extends TestCase use DatabaseTransactions; /** @test */ - public function it_can_handle_ajax_request() + public function it_can_handle_ajax_request(): void { $response = $this->getAjax('/users'); @@ -27,7 +27,7 @@ public function it_can_handle_ajax_request() } /** @test */ - public function it_returns_view_on_normal_get_request() + public function it_returns_view_on_normal_get_request(): void { $response = $this->get('users'); @@ -36,7 +36,7 @@ public function it_returns_view_on_normal_get_request() } /** @test */ - public function it_can_return_a_csv_file() + public function it_can_return_a_csv_file(): void { $response = $this->get('users?action=csv'); @@ -44,7 +44,7 @@ public function it_can_return_a_csv_file() } /** @test */ - public function it_can_return_a_xls_file() + public function it_can_return_a_xls_file(): void { $response = $this->get('users?action=excel'); @@ -52,7 +52,7 @@ public function it_can_return_a_xls_file() } /** @test */ - public function it_can_return_a_pdf_file() + public function it_can_return_a_pdf_file(): void { $response = $this->get('users?action=pdf'); @@ -60,7 +60,7 @@ public function it_can_return_a_pdf_file() } /** @test */ - public function it_allows_before_response_callback() + public function it_allows_before_response_callback(): void { $response = $this->getAjax('users/before'); $response->assertOk(); @@ -70,7 +70,7 @@ public function it_allows_before_response_callback() } /** @test */ - public function it_allows_response_callback() + public function it_allows_response_callback(): void { $response = $this->getAjax('users/response'); $response->assertOk(); diff --git a/tests/DataTables/UsersDataTable.php b/tests/DataTables/UsersDataTable.php index 374620c..66e8e29 100644 --- a/tests/DataTables/UsersDataTable.php +++ b/tests/DataTables/UsersDataTable.php @@ -15,7 +15,8 @@ class UsersDataTable extends DataTable */ public function dataTable(Builder $query): EloquentDataTable { - return datatables()->eloquent($query)->setRowId('id'); + return (new EloquentDataTable($query)) + ->setRowId('id'); } public function query(User $user): Builder diff --git a/tests/Providers/TestServiceProvider.php b/tests/Providers/TestServiceProvider.php index ee09792..23ca2f6 100644 --- a/tests/Providers/TestServiceProvider.php +++ b/tests/Providers/TestServiceProvider.php @@ -6,7 +6,7 @@ class TestServiceProvider extends ServiceProvider { - public function boot() + public function boot(): void { $this->loadViewsFrom(__DIR__.'/../views', 'tests'); } diff --git a/tests/TestCase.php b/tests/TestCase.php index e72296a..094d576 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -23,7 +23,7 @@ protected function setUp(): void $this->seedDatabase(); } - protected function migrateDatabase() + protected function migrateDatabase(): void { /** @var \Illuminate\Database\Schema\Builder $schemaBuilder */ $schemaBuilder = $this->app['db']->connection()->getSchemaBuilder(); @@ -62,7 +62,7 @@ protected function migrateDatabase() } } - protected function seedDatabase() + protected function seedDatabase(): void { $adminRole = Role::create(['role' => 'Administrator']); $userRole = Role::create(['role' => 'User']); @@ -115,12 +115,12 @@ protected function getPackageProviders($app): array ]; } - public function getAjax($uri, array $headers = []): TestResponse + public function getAjax(string $uri, array $headers = []): TestResponse { return $this->getJson($uri, array_merge(['X-Requested-With' => 'XMLHttpRequest'], $headers)); } - public function postAjax($uri, array $headers = []): TestResponse + public function postAjax(string $uri, array $headers = []): TestResponse { return $this->postJson($uri, array_merge(['X-Requested-With' => 'XMLHttpRequest'], $headers)); }