Skip to content

Commit 0eeec19

Browse files
committed
tests: use attribute
1 parent c2ff5c7 commit 0eeec19

File tree

3 files changed

+13
-19
lines changed

3 files changed

+13
-19
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/vendor
22
/coverage
3+
/.phpunit.cache
34
composer.phar
45
composer.lock

phpunit.xml.dist

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit backupGlobals="false"
3-
backupStaticAttributes="false"
4-
bootstrap="vendor/autoload.php"
5-
colors="true"
6-
convertErrorsToExceptions="true"
7-
convertNoticesToExceptions="true"
8-
convertWarningsToExceptions="true"
9-
processIsolation="false"
10-
stopOnFailure="false"
11-
>
12-
<testsuites>
13-
<testsuite name="Package Test Suite">
14-
<directory suffix=".php">./tests/</directory>
15-
</testsuite>
16-
</testsuites>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.0/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
3+
<testsuites>
4+
<testsuite name="Package Test Suite">
5+
<directory suffix="Test.php">./tests/</directory>
6+
</testsuite>
7+
</testsuites>
178
</phpunit>

tests/FractalTest.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@
33
namespace Yajra\DataTables\Fractal\Tests;
44

55
use Illuminate\Foundation\Testing\DatabaseTransactions;
6+
use PHPUnit\Framework\Attributes\Test;
7+
use Yajra\DataTables\Facades\DataTables;
68
use Yajra\DataTables\Fractal\Tests\Models\User;
79
use Yajra\DataTables\Fractal\Tests\Transformers\UserTransformer;
810

911
class FractalTest extends TestCase
1012
{
1113
use DatabaseTransactions;
1214

13-
/** @test */
15+
#[Test]
1416
public function it_can_transform_response()
1517
{
1618
$json = $this->getAjax('/users');
@@ -25,7 +27,7 @@ public function it_can_transform_response()
2527
$this->assertIsString($json['data'][0]['name']);
2628
}
2729

28-
/** @test */
30+
#[Test]
2931
public function it_works_with_closure()
3032
{
3133
$json = $this->getAjax('/closure');
@@ -45,13 +47,13 @@ protected function setUp(): void
4547
parent::setUp();
4648

4749
$this->app['router']->get('/users', function () {
48-
return datatables()->eloquent(User::query())
50+
return DataTables::eloquent(User::query())
4951
->setTransformer(UserTransformer::class)
5052
->toJson();
5153
});
5254

5355
$this->app['router']->get('/closure', function () {
54-
return datatables()->eloquent(User::query())
56+
return DataTables::eloquent(User::query())
5557
->setTransformer(function (User $user) {
5658
return [
5759
'id' => (int) $user->id,

0 commit comments

Comments
 (0)