@@ -27,7 +27,7 @@ public function testCreate(): void
2727 {
2828 $ data = $ this ->getJsonFixture ('create_welcome_bonus_request.json ' );
2929
30- $ response = $ this ->actingAs (self ::$ user, ' web ' )->json ( ' post ' , ' /nova-api/welcome-bonus-resources ' , $ data );
30+ $ response = $ this ->novaActingAs (self ::$ user )->novaCreateResource (WelcomeBonus::class , $ data );
3131
3232 $ response ->assertCreated ();
3333
@@ -39,7 +39,7 @@ public function testCreate(): void
3939
4040 public function testCreateNoAuth (): void
4141 {
42- $ response = $ this ->json ( ' post ' , ' /nova-api/welcome-bonus-resources ' );
42+ $ response = $ this ->novaCreateResource (Card::class );
4343
4444 $ response ->assertUnauthorized ();
4545
@@ -48,7 +48,7 @@ public function testCreateNoAuth(): void
4848
4949 public function testCreateValidationError (): void
5050 {
51- $ response = $ this ->actingAs (self ::$ user, ' web ' )->json ( ' post ' , ' /nova-api/welcome-bonus-resources ' );
51+ $ response = $ this ->novaActingAs (self ::$ user )->novaCreateResource (WelcomeBonus::class );
5252
5353 $ response ->assertUnprocessable ();
5454
@@ -62,7 +62,7 @@ public function testUpdate(): void
6262 {
6363 $ data = $ this ->getJsonFixture ('update_welcome_bonus_request.json ' );
6464
65- $ response = $ this ->actingAs (self ::$ user, ' web ' )->json ( ' put ' , ' /nova-api/welcome-bonus-resources/1 ' , $ data );
65+ $ response = $ this ->novaActingAs (self ::$ user )->novaUpdateResource (WelcomeBonus::class, 1 , $ data );
6666
6767 $ response ->assertNoContent ();
6868
@@ -74,21 +74,21 @@ public function testUpdateNotExists(): void
7474 {
7575 $ data = $ this ->getJsonFixture ('update_welcome_bonus_request.json ' );
7676
77- $ response = $ this ->actingAs (self ::$ user, ' web ' )->json ( ' put ' , ' /nova-api/welcome-bonus-resources/0 ' , $ data );
77+ $ response = $ this ->novaActingAs (self ::$ user )->novaUpdateResource (WelcomeBonus::class, 0 , $ data );
7878
7979 $ response ->assertNotFound ();
8080 }
8181
8282 public function testUpdateNoAuth (): void
8383 {
84- $ response = $ this ->json ( ' put ' , ' /nova-api/welcome-bonus-resources/1 ' );
84+ $ response = $ this ->novaUpdateResource (WelcomeBonus::class, 1 );
8585
8686 $ response ->assertUnauthorized ();
8787 }
8888
8989 public function testUpdateValidationError (): void
9090 {
91- $ response = $ this ->actingAs (self ::$ user, ' web ' )->json ( ' put ' , ' /nova-api/welcome-bonus-resources/4 ' );
91+ $ response = $ this ->novaActingAs (self ::$ user )->novaUpdateResource (WelcomeBonus::class, 4 );
9292
9393 $ response ->assertUnprocessable ();
9494
@@ -98,7 +98,7 @@ public function testUpdateValidationError(): void
9898
9999 public function testGetUpdatableFields (): void
100100 {
101- $ response = $ this ->actingAs (self ::$ user, ' web ' )->json ( ' get ' , ' /nova-api/welcome-bonus-resources/1/update-fields ' );
101+ $ response = $ this ->novaActingAs (self ::$ user )->novaGetUpdatableFields (WelcomeBonus::class, 1 );
102102
103103 $ response ->assertOk ();
104104
@@ -108,9 +108,10 @@ public function testGetUpdatableFields(): void
108108
109109 public function testDelete (): void
110110 {
111- $ response = $ this ->actingAs (self ::$ user , 'web ' )->json ('delete ' , '/nova-api/welcome-bonus-resources ' , [
112- 'resources ' => [1 , 2 ]
113- ]);
111+ $ response = $ this ->novaActingAs (self ::$ user )->novaDeleteResource (
112+ resourceClass: WelcomeBonus::class,
113+ resourceIds: [1 , 2 ],
114+ );
114115
115116 $ response ->assertOk ();
116117
@@ -120,25 +121,27 @@ public function testDelete(): void
120121
121122 public function testDeleteNotExists (): void
122123 {
123- $ response = $ this ->actingAs (self ::$ user , 'web ' )->json ('delete ' , '/nova-api/welcome-bonus-resources ' , [
124- 'resources ' => [0 ]
125- ]);
124+ $ response = $ this ->novaActingAs (self ::$ user )->novaDeleteResource (
125+ resourceClass: WelcomeBonus::class,
126+ resourceIds: [0 ],
127+ );
126128
127129 $ response ->assertNotFound ();
128130 }
129131
130132 public function testDeleteNoAuth (): void
131133 {
132- $ response = $ this ->json ('delete ' , '/nova-api/welcome-bonus-resources ' , [
133- 'resources ' => [1 , 2 ]
134- ]);
134+ $ response = $ this ->novaDeleteResource (
135+ resourceClass: WelcomeBonus::class,
136+ resourceIds: [1 , 2 ],
137+ );
135138
136139 $ response ->assertUnauthorized ();
137140 }
138141
139142 public function testGet (): void
140143 {
141- $ response = $ this ->actingAs (self ::$ user, ' web ' )->json ( ' get ' , ' /nova-api/welcome-bonus-resources/1 ' );
144+ $ response = $ this ->novaActingAs (self ::$ user )->novaGetResource (WelcomeBonus::class, 1 );
142145
143146 $ response ->assertOk ();
144147
@@ -148,28 +151,34 @@ public function testGet(): void
148151
149152 public function testGetNotExists (): void
150153 {
151- $ response = $ this ->actingAs (self ::$ user, ' web ' )->json ( ' get ' , ' /nova-api/welcome-bonus-resources/0 ' );
154+ $ response = $ this ->novaActingAs (self ::$ user )->novaGetResource (WelcomeBonus::class, 0 );
152155
153156 $ response ->assertNotFound ();
154157 }
155158
156159 public function testGetNoAuth (): void
157160 {
158- $ response = $ this ->json ( ' get ' , ' /nova-api/welcome-bonus-resources/1 ' );
161+ $ response = $ this ->novaGetResource (WelcomeBonus::class, 1 );
159162
160163 $ response ->assertUnauthorized ();
161164 }
162165
163166 public function testSearchUnauthorized (): void
164167 {
165- $ response = $ this ->json ('get ' , '/nova-api/welcome-bonus-resources ' );
168+ $ response = $ this ->novaSearchResource (
169+ resourceClass: WelcomeBonus::class,
170+ request: [
171+ 'orderBy ' => 'id ' ,
172+ 'orderByDirection ' => 'asc ' ,
173+ ],
174+ );
166175
167176 $ response ->assertUnauthorized ();
168177 }
169178
170179 public function testGetFieldsVisibleOnCreate (): void
171180 {
172- $ response = $ this ->actingAs (self ::$ user, ' web ' )->json ( ' get ' , ' /nova-api/welcome-bonus-resources/creation-fields ' );
181+ $ response = $ this ->novaActingAs (self ::$ user )->novaGetCreationFields (WelcomeBonus::class );
173182
174183 $ response ->assertOk ();
175184
@@ -181,14 +190,14 @@ public function getRunWelcomeBonusActionsData(): array
181190 {
182191 return [
183192 [
184- 'action ' => ' publish-post-action ' ,
193+ 'action ' => PublishPostAction::class ,
185194 'request ' => [
186195 'resources ' => '1,2 ' ,
187196 ],
188197 'state ' => 'run_publish_post_action_state.json ' ,
189198 ],
190199 [
191- 'action ' => ' un-publish-post-action ' ,
200+ 'action ' => UnPublishPostAction::class ,
192201 'request ' => [
193202 'resources ' => '1,2 ' ,
194203 ],
@@ -202,7 +211,7 @@ public function getRunWelcomeBonusActionsData(): array
202211 */
203212 public function testRunWelcomeBonusActions ($ action , $ request , $ welcome_bonusesStateFixture ): void
204213 {
205- $ response = $ this ->actingAs (self ::$ user, ' web ' )->json ('post ' , "/nova-api/welcome-bonus-resources/action?action= {$ action }" , $ request );
214+ $ response = $ this ->novaActingAs (self ::$ user )->json ('post ' , "/nova-api/welcome-bonus-resources/action?action= {$ action }" , $ request );
206215
207216 $ response ->assertOk ();
208217
@@ -216,15 +225,11 @@ public function getWelcomeBonusActionsData(): array
216225 {
217226 return [
218227 [
219- 'request ' => [
220- 'resources ' => '1,2 ' ,
221- ],
228+ 'resources ' => [1 , 2 ],
222229 'response_fixture ' => 'get_welcome_bonus_actions_publish_post_action.json ' ,
223230 ],
224231 [
225- 'request ' => [
226- 'resources ' => '1,2 ' ,
227- ],
232+ 'resources ' => [1 , 2 ],
228233 'response_fixture ' => 'get_welcome_bonus_actions_un_publish_post_action.json ' ,
229234 ],
230235 ];
@@ -233,9 +238,9 @@ public function getWelcomeBonusActionsData(): array
233238 /**
234239 * @dataProvider getWelcomeBonusActionsData
235240 */
236- public function testGetWelcomeBonusActions (array $ request , string $ responseFixture ): void
241+ public function testGetWelcomeBonusActions (array $ resources , string $ responseFixture ): void
237242 {
238- $ response = $ this ->actingAs (self ::$ user, ' web ' )->json ( ' get ' , ' /nova-api/welcome-bonus-resources/actions ' , $ request );
243+ $ response = $ this ->novaActingAs (self ::$ user )->novaGetActions (WelcomeBonus::class, $ resources );
239244
240245 $ response ->assertOk ();
241246
@@ -266,7 +271,7 @@ public function getWelcomeBonusFiltersData(): array
266271 */
267272 public function testFilterWelcomeBonus (array $ request , string $ responseFixture ): void
268273 {
269- $ response = $ this ->actingAs (self ::$ user, ' web ' )->json ( ' get ' , ' /nova-api/welcome-bonus-resources ' , $ request );
274+ $ response = $ this ->novaActingAs (self ::$ user )->novaSearchResource (WelcomeBonus::class , $ request );
270275
271276 $ response ->assertOk ();
272277
0 commit comments