Skip to content

Commit e5de284

Browse files
committed
wip
1 parent d02078d commit e5de284

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

tests/Controllers/RepositoryStoreControllerTest.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
use Binaryk\LaravelRestify\Tests\IntegrationTest;
99
use Illuminate\Support\Facades\Gate;
1010

11-
/**
12-
* @author Eduard Lupacescu <[email protected]>
13-
*/
1411
class RepositoryStoreControllerTest extends IntegrationTest
1512
{
1613
protected function setUp(): void
@@ -50,16 +47,17 @@ public function test_unauthorized_store()
5047
public function test_success_storing()
5148
{
5249
$user = $this->mockUsers()->first();
53-
$response = $this->postJson('posts', [
50+
$response = $this->postJson('posts', $data = [
5451
'user_id' => $user->id,
5552
'title' => 'Some post title',
56-
])->assertStatus(201)
57-
->assertHeader('Location', '/posts/1');
53+
])->assertCreated()->assertHeader('Location', '/posts/1');
5854

5955
$this->assertEquals('Some post title', $response->json('data.attributes.title'));
6056
$this->assertEquals(1, $response->json('data.attributes.user_id'));
6157
$this->assertEquals(1, $response->json('data.id'));
6258
$this->assertEquals('posts', $response->json('data.type'));
59+
60+
$this->assertDatabaseHas('posts', $data);
6361
}
6462

6563
public function test_will_store_only_defined_fields_from_fieldsForStore()

0 commit comments

Comments
 (0)