Skip to content

Commit 9049537

Browse files
committed
test: schema return skeleton insteadof object (stdClass)
1 parent e89bfee commit 9049537

File tree

1 file changed

+4
-26
lines changed

1 file changed

+4
-26
lines changed

tests/Feature/SchemaTest.php

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Test\Feature;
44

55
use Ark4ne\JsonApi\Resources\JsonApiCollection;
6+
use Ark4ne\JsonApi\Resources\Skeleton;
67
use Test\app\Http\Resources\CommentResource;
78
use Test\app\Http\Resources\PostResource;
89
use Test\app\Http\Resources\UserResource;
@@ -11,32 +12,9 @@ class SchemaTest extends FeatureTestCase
1112
{
1213
public function testSchema()
1314
{
14-
$user = (object)[
15-
'type' => 'user',
16-
'fields' => ['name', 'email'],
17-
'relationships' => [
18-
'posts' => null,
19-
'comments' => null,
20-
]
21-
];
22-
23-
$post = (object)[
24-
'type' => 'post',
25-
'fields' => ['title', 'content'],
26-
'relationships' => [
27-
'user' => null,
28-
'comments' => null,
29-
]
30-
];
31-
32-
$comment = (object)[
33-
'type' => 'comment',
34-
'fields' => ['content'],
35-
'relationships' => [
36-
'user' => null,
37-
'post' => null,
38-
]
39-
];
15+
$user = new Skeleton(UserResource::class, 'user', ['name', 'email']);
16+
$post = new Skeleton(PostResource::class, 'post', ['title', 'content']);
17+
$comment = new Skeleton(CommentResource::class, 'comment', ['content']);
4018

4119
$user->relationships['posts'] = $post;
4220
$user->relationships['comments'] = $comment;

0 commit comments

Comments
 (0)