File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change 88use Binaryk \LaravelRestify \Tests \IntegrationTest ;
99use Illuminate \Support \Facades \Gate ;
1010
11- /**
12- * @author Eduard Lupacescu <[email protected] > 13- */
1411class 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 ()
You can’t perform that action at this time.
0 commit comments