diff --git a/.gitignore b/.gitignore index df0e1ea..384d40a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /vendor /coverage +/.phpunit.cache composer.phar composer.lock diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 422eeac..2cb7512 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,17 +1,8 @@ - - - - ./tests/ - - + + + + ./tests/ + + diff --git a/tests/FractalTest.php b/tests/FractalTest.php index 455be8a..cd75fa4 100644 --- a/tests/FractalTest.php +++ b/tests/FractalTest.php @@ -3,6 +3,8 @@ namespace Yajra\DataTables\Fractal\Tests; use Illuminate\Foundation\Testing\DatabaseTransactions; +use PHPUnit\Framework\Attributes\Test; +use Yajra\DataTables\Facades\DataTables; use Yajra\DataTables\Fractal\Tests\Models\User; use Yajra\DataTables\Fractal\Tests\Transformers\UserTransformer; @@ -10,7 +12,7 @@ class FractalTest extends TestCase { use DatabaseTransactions; - /** @test */ + #[Test] public function it_can_transform_response() { $json = $this->getAjax('/users'); @@ -25,7 +27,7 @@ public function it_can_transform_response() $this->assertIsString($json['data'][0]['name']); } - /** @test */ + #[Test] public function it_works_with_closure() { $json = $this->getAjax('/closure'); @@ -45,13 +47,13 @@ protected function setUp(): void parent::setUp(); $this->app['router']->get('/users', function () { - return datatables()->eloquent(User::query()) + return DataTables::eloquent(User::query()) ->setTransformer(UserTransformer::class) ->toJson(); }); $this->app['router']->get('/closure', function () { - return datatables()->eloquent(User::query()) + return DataTables::eloquent(User::query()) ->setTransformer(function (User $user) { return [ 'id' => (int) $user->id,