@@ -78,7 +78,7 @@ public function getting_a_paginated_list_of_resources(): void
78
78
}
79
79
80
80
/** @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
82
82
{
83
83
$ trashedPosts = factory (Post::class)->state ('trashed ' )->times (5 )->create ();
84
84
$ posts = factory (Post::class)->times (5 )->create ();
@@ -94,7 +94,23 @@ public function getting_a_list_of_soft_deletable_resources_when_with_trashed_que
94
94
}
95
95
96
96
/** @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
98
114
{
99
115
$ trashedPosts = factory (Post::class)->state ('trashed ' )->times (5 )->create ();
100
116
factory (Post::class)->times (5 )->create ();
@@ -109,6 +125,22 @@ public function getting_a_list_of_soft_deletable_resources_when_only_trashed_que
109
125
);
110
126
}
111
127
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
+
112
144
/** @test */
113
145
public function getting_a_list_of_soft_deletable_resources_with_trashed_resources_filtered_out (): void
114
146
{
0 commit comments