@@ -78,7 +78,7 @@ public function getting_a_paginated_list_of_resources(): void
7878 }
7979
8080 /** @test */
81- public function getting_a_list_of_soft_deletable_resources_when_with_trashed_query_parameter_is_present (): void
81+ public function getting_a_list_of_soft_deletable_resources_when_with_trashed_query_parameter_is_set_to_true (): void
8282 {
8383 $ trashedPosts = factory (Post::class)->state ('trashed ' )->times (5 )->create ();
8484 $ posts = factory (Post::class)->times (5 )->create ();
@@ -94,7 +94,23 @@ public function getting_a_list_of_soft_deletable_resources_when_with_trashed_que
9494 }
9595
9696 /** @test */
97- public function getting_a_list_of_soft_deletable_resources_when_only_trashed_query_parameter_is_present (): void
97+ public function getting_a_list_of_soft_deletable_resources_when_with_trashed_query_parameter_is_set_to_false (): void
98+ {
99+ factory (Post::class)->state ('trashed ' )->times (5 )->create ();
100+ $ posts = factory (Post::class)->times (5 )->create ();
101+
102+ Gate::policy (Post::class, GreenPolicy::class);
103+
104+ $ response = $ this ->get ('/api/posts?with_trashed=false ' );
105+
106+ $ this ->assertResourcesPaginated (
107+ $ response ,
108+ $ this ->makePaginator ($ posts , 'posts ' )
109+ );
110+ }
111+
112+ /** @test */
113+ public function getting_a_list_of_soft_deletable_resources_when_only_trashed_query_parameter_is_set_to_true (): void
98114 {
99115 $ trashedPosts = factory (Post::class)->state ('trashed ' )->times (5 )->create ();
100116 factory (Post::class)->times (5 )->create ();
@@ -109,6 +125,22 @@ public function getting_a_list_of_soft_deletable_resources_when_only_trashed_que
109125 );
110126 }
111127
128+ /** @test */
129+ public function getting_a_list_of_soft_deletable_resources_when_only_trashed_query_parameter_is_set_to_false (): void
130+ {
131+ factory (Post::class)->state ('trashed ' )->times (5 )->create ();
132+ $ posts = factory (Post::class)->times (5 )->create ();
133+
134+ Gate::policy (Post::class, GreenPolicy::class);
135+
136+ $ response = $ this ->get ('/api/posts?only_trashed=false ' );
137+
138+ $ this ->assertResourcesPaginated (
139+ $ response ,
140+ $ this ->makePaginator ($ posts , 'posts ' )
141+ );
142+ }
143+
112144 /** @test */
113145 public function getting_a_list_of_soft_deletable_resources_with_trashed_resources_filtered_out (): void
114146 {
0 commit comments