Skip to content

Commit 8ba9bb6

Browse files
committed
Adjust: replace PHP-docs with more descriptive test-names
1 parent 101eac3 commit 8ba9bb6

File tree

2 files changed

+73
-166
lines changed

2 files changed

+73
-166
lines changed

test/php/application/controllers/ApiV1ContactGroupsTest.php

Lines changed: 35 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class ApiV1ContactGroupsTest extends BaseApiV1TestCase
1111
{
1212
/**
1313
* @dataProvider databases
14-
* @depends testPostWithValidData
14+
* @depends testPostToCreateWithValidData
1515
*/
1616
public function testGetWithMatchingFilter(): void
1717
{
@@ -35,7 +35,7 @@ public function testGetWithMatchingFilter(): void
3535

3636
/**
3737
* @dataProvider databases
38-
* @depends testPostWithValidData
38+
* @depends testPostToCreateWithValidData
3939
*/
4040
public function testGetEverything(): void
4141
{
@@ -80,7 +80,7 @@ public function testGetEverything(): void
8080

8181
/**
8282
* @dataProvider databases
83-
* @depends testPostWithValidData
83+
* @depends testPostToCreateWithValidData
8484
*/
8585
public function testGetWithAlreadyExistingIdentifier(): void
8686
{
@@ -116,7 +116,7 @@ public function testGetWithNewIdentifier(): void
116116

117117
/**
118118
* @dataProvider databases
119-
* @depends testPostWithValidData
119+
* @depends testPostToCreateWithValidData
120120
*/
121121
public function testGetWithNonMatchingFilter(): void
122122
{
@@ -134,11 +134,9 @@ public function testGetWithNonMatchingFilter(): void
134134
}
135135

136136
/**
137-
* Create a new contact group with a YAML payload, while declaring the body type as application/json.
138-
*
139137
* @dataProvider databases
140138
*/
141-
public function testPostWithInvalidContent(): void
139+
public function testPostToCreateWithInvalidContent(): void
142140
{
143141
$body = <<<YAML
144142
---
@@ -161,11 +159,9 @@ public function testPostWithInvalidContent(): void
161159
}
162160

163161
/**
164-
* Create a new contact group with a YAML payload.
165-
*
166162
* @dataProvider databases
167163
*/
168-
public function testPostWithInvalidContentType(): void
164+
public function testPostToCreateWithInvalidContentType(): void
169165
{
170166
$body = <<<YAML
171167
---
@@ -191,11 +187,9 @@ public function testPostWithInvalidContentType(): void
191187
}
192188

193189
/**
194-
* Create a new contact group with a valid JSON payload, while providing a filter.
195-
*
196190
* @dataProvider databases
197191
*/
198-
public function testPostWithFilter(): void
192+
public function testPostToCreateWithFilter(): void
199193
{
200194
$response = $this->sendRequest(
201195
'POST',
@@ -216,11 +210,9 @@ public function testPostWithFilter(): void
216210
}
217211

218212
/**
219-
* Replace a contact group, while providing an unknown identifier.
220-
*
221213
* @dataProvider databases
222214
*/
223-
public function testPostWithNewIdentifier(): void
215+
public function testPostToReplaceWithNonExistingIdentifier(): void
224216
{
225217
$response = $this->sendRequest('POST', 'contactgroups/' . BaseApiV1TestCase::GROUP_UUID, [
226218
'id' => BaseApiV1TestCase::GROUP_UUID_2,
@@ -234,12 +226,10 @@ public function testPostWithNewIdentifier(): void
234226
}
235227

236228
/**
237-
* Replace a contact group, while providing the same identifier in the Request-URI and the JSON payload.
238-
*
239229
* @dataProvider databases
240-
* @depends testPostWithValidData
230+
* @depends testPostToCreateWithValidData
241231
*/
242-
public function testPostWithAlreadyExistingIdentifierAndIndifferentPayloadId(): void
232+
public function testPostToReplaceWithAlreadyExistingIdentifierAndIndifferentPayloadId(): void
243233
{
244234
$this->sendRequest('POST', 'contactgroups', [
245235
'id' => BaseApiV1TestCase::GROUP_UUID,
@@ -262,12 +252,10 @@ public function testPostWithAlreadyExistingIdentifierAndIndifferentPayloadId():
262252
}
263253

264254
/**
265-
* Replace a contact with an id which already exists
266-
*
267255
* @dataProvider databases
268-
* @depends testPostWithValidData
256+
* @depends testPostToCreateWithValidData
269257
*/
270-
public function testPostWithAlreadyExistingIdentifierAndExistingPayloadId(): void
258+
public function testPostToReplaceWithAlreadyExistingIdentifierAndExistingPayloadId(): void
271259
{
272260
$this->sendRequest('POST', 'contactgroups', [
273261
'id' => BaseApiV1TestCase::GROUP_UUID,
@@ -293,12 +281,10 @@ public function testPostWithAlreadyExistingIdentifierAndExistingPayloadId(): voi
293281
}
294282

295283
/**
296-
* Replace a contact group while providing a new identifier in the JSON payload.
297-
*
298284
* @dataProvider databases
299-
* @depends testPostWithValidData
285+
* @depends testPostToCreateWithValidData
300286
*/
301-
public function testPostWithAlreadyExistingIdentifierAndValidData(): void
287+
public function testPostToReplaceWithAlreadyExistingIdentifierAndValidData(): void
302288
{
303289
$this->sendRequest('POST', 'contactgroups', [
304290
'id' => BaseApiV1TestCase::GROUP_UUID,
@@ -322,12 +308,10 @@ public function testPostWithAlreadyExistingIdentifierAndValidData(): void
322308
}
323309

324310
/**
325-
* Create a new contact group with a valid JSON payload, while providing an already existing Payload id.
326-
*
327311
* @dataProvider databases
328-
* @depends testPostWithValidData
312+
* @depends testPostToCreateWithValidData
329313
*/
330-
public function testPostWithAlreadyExistingPayloadId(): void
314+
public function testPostToCreateWithAlreadyExistingPayloadId(): void
331315
{
332316
$this->sendRequest('POST', 'contactgroups', [
333317
'id' => BaseApiV1TestCase::GROUP_UUID,
@@ -347,11 +331,9 @@ public function testPostWithAlreadyExistingPayloadId(): void
347331
}
348332

349333
/**
350-
* Create a new contact group with a valid JSON payload.
351-
*
352334
* @dataProvider databases
353335
*/
354-
public function testPostWithValidData(): void
336+
public function testPostToCreateWithValidData(): void
355337
{
356338
$response = $this->sendRequest('POST', 'contacts', [
357339
'id' => '0817d973-398e-41d7-9ef2-61cdb7ef41a1',
@@ -389,11 +371,9 @@ public function testPostWithValidData(): void
389371
}
390372

391373
/**
392-
* Create a new contact group with an incorrect JSON payload.
393-
*
394374
* @dataProvider databases
395375
*/
396-
public function testPostWithInvalidData(): void
376+
public function testPostToCreateWithInvalidData(): void
397377
{
398378
$expected = $this->jsonEncodeError(
399379
'Invalid request body: the fields id and name must be present and of type string'
@@ -435,12 +415,10 @@ public function testPostWithInvalidData(): void
435415
}
436416

437417
/**
438-
* Replace a contact group with an incorrect JSON payload.
439-
*
440418
* @dataProvider databases
441-
* @depends testPostWithValidData
419+
* @depends testPostToCreateWithValidData
442420
*/
443-
public function testPostWithAlreadyExistingIdentifierAndInvalidData(): void
421+
public function testPostToReplaceWithAlreadyExistingIdentifierAndInvalidData(): void
444422
{
445423
$this->sendRequest('POST', 'contactgroups', [
446424
'id' => BaseApiV1TestCase::GROUP_UUID,
@@ -474,11 +452,9 @@ public function testPostWithAlreadyExistingIdentifierAndInvalidData(): void
474452
}
475453

476454
/**
477-
* Replace a contact group with a YAML payload, while declaring the body type as application/json.
478-
*
479455
* @dataProvider databases
480456
*/
481-
public function testPutWithInvalidContent(): void
457+
public function testPutToUpdateWithInvalidContent(): void
482458
{
483459
$body = <<<YAML
484460
---
@@ -501,11 +477,9 @@ public function testPutWithInvalidContent(): void
501477
}
502478

503479
/**
504-
* Replace a contact group with a YAML payload, while declaring the body type as application/json.
505-
*
506480
* @dataProvider databases
507481
*/
508-
public function testPutWithInvalidContentType(): void
482+
public function testPutToUpdateWithInvalidContentType(): void
509483
{
510484
$body = <<<YAML
511485
---
@@ -531,11 +505,9 @@ public function testPutWithInvalidContentType(): void
531505
}
532506

533507
/**
534-
* Replace a contact group with a valid JSON payload, while providing a filter.
535-
*
536508
* @dataProvider databases
537509
*/
538-
public function testPutWithFilter(): void
510+
public function testPutToUpdateWithFilter(): void
539511
{
540512
$response = $this->sendRequest('PUT', 'contactgroups?id=' . BaseApiV1TestCase::GROUP_UUID, [
541513
'id' => BaseApiV1TestCase::GROUP_UUID,
@@ -552,11 +524,9 @@ public function testPutWithFilter(): void
552524
}
553525

554526
/**
555-
* Replace a contact group, while omitting the identifier in the JSON payload.
556-
*
557527
* @dataProvider databases
558528
*/
559-
public function testPutWithoutIdentifier(): void
529+
public function testPutToUpdateWithoutIdentifier(): void
560530
{
561531
$response = $this->sendRequest('PUT', 'contactgroups', [
562532
'id' => BaseApiV1TestCase::GROUP_UUID,
@@ -570,13 +540,10 @@ public function testPutWithoutIdentifier(): void
570540
}
571541

572542
/**
573-
* Replace a contact group with the same identifier in the Request-URI
574-
* and the JSON payload, while omitting required fields.
575-
*
576543
* @dataProvider databases
577-
* @depends testPostWithValidData
544+
* @depends testPostToCreateWithValidData
578545
*/
579-
public function testPutWithAlreadyExistingIdentifierAndMissingRequiredFields(): void
546+
public function testPutToUpdateWithAlreadyExistingIdentifierAndMissingRequiredFields(): void
580547
{
581548
$this->sendRequest('POST', 'contactgroups', [
582549
'id' => BaseApiV1TestCase::GROUP_UUID,
@@ -610,12 +577,10 @@ public function testPutWithAlreadyExistingIdentifierAndMissingRequiredFields():
610577
}
611578

612579
/**
613-
* Replace a contact group with a different identifier in the Request-URI and the JSON payload.
614-
*
615580
* @dataProvider databases
616-
* @depends testPostWithValidData
581+
* @depends testPostToCreateWithValidData
617582
*/
618-
public function testPutWithAlreadyExistingIdentifierAndDifferentPayloadId(): void
583+
public function testPutToUpdateWithAlreadyExistingIdentifierAndDifferentPayloadId(): void
619584
{
620585
$this->sendRequest('POST', 'contactgroups', [
621586
'id' => BaseApiV1TestCase::GROUP_UUID,
@@ -636,11 +601,9 @@ public function testPutWithAlreadyExistingIdentifierAndDifferentPayloadId(): voi
636601
}
637602

638603
/**
639-
* Create a new contact group with a valid JSON payload, while providing a new identifier.
640-
*
641604
* @dataProvider databases
642605
*/
643-
public function testPutWithNewIdentifierAndValidData(): void
606+
public function testPutToCreateWithNewIdentifierAndValidData(): void
644607
{
645608
$response = $this->sendRequest('POST', 'contacts', [
646609
'id' => BaseApiV1TestCase::CONTACT_UUID,
@@ -665,12 +628,10 @@ public function testPutWithNewIdentifierAndValidData(): void
665628
}
666629

667630
/**
668-
* Replace a contact group with the same identifier in the Request-URI and the JSON payload.
669-
*
670631
* @dataProvider databases
671-
* @depends testPostWithValidData
632+
* @depends testPostToCreateWithValidData
672633
*/
673-
public function testPutWithAlreadyExistingIdentifierAndValidData(): void
634+
public function testPutToUpdateWithAlreadyExistingIdentifierAndValidData(): void
674635
{
675636
$this->sendRequest('POST', 'contactgroups', [
676637
'id' => BaseApiV1TestCase::GROUP_UUID,
@@ -690,11 +651,9 @@ public function testPutWithAlreadyExistingIdentifierAndValidData(): void
690651
}
691652

692653
/**
693-
* Create a new contact group with incorrect JSON payload, while providing a new identifier.
694-
*
695654
* @dataProvider databases
696655
*/
697-
public function testPutWithNewIdentifierAndInvalidData(): void
656+
public function testPutToCreateWithNewIdentifierAndInvalidData(): void
698657
{
699658
// different id
700659
$response = $this->sendRequest('PUT', 'contactgroups/' . BaseApiV1TestCase::GROUP_UUID, [
@@ -723,11 +682,9 @@ public function testPutWithNewIdentifierAndInvalidData(): void
723682
}
724683

725684
/**
726-
* Create a new contact group with missing optional fields in the JSON payload, while providing a new identifier.
727-
*
728685
* @dataProvider databases
729686
*/
730-
public function testPutWithNewIdentifierAndValidOptionalData(): void
687+
public function testPutToCreateWithNewIdentifierAndValidOptionalData(): void
731688
{
732689
$response = $this->sendRequest('PUT', 'contactgroups/' . BaseApiV1TestCase::GROUP_UUID, [
733690
'id' => BaseApiV1TestCase::GROUP_UUID,
@@ -744,11 +701,9 @@ public function testPutWithNewIdentifierAndValidOptionalData(): void
744701
}
745702

746703
/**
747-
* Create a new contact group with missing required fields in the JSON payload, while providing a new identifier.
748-
*
749704
* @dataProvider databases
750705
*/
751-
public function testPutWithNewIdentifierAndMissingRequiredFields(): void
706+
public function testPutToCreateWithNewIdentifierAndMissingRequiredFields(): void
752707
{
753708
$expected = $this->jsonEncodeError(
754709
'Invalid request body: the fields id and name must be present and of type string'
@@ -800,7 +755,7 @@ public function testDeleteWithNewIdentifier(): void
800755

801756
/**
802757
* @dataProvider databases
803-
* @depends testPostWithValidData
758+
* @depends testPostToCreateWithValidData
804759
*/
805760
public function testDeleteWithAlreadyExistingIdentifier(): void
806761
{

0 commit comments

Comments
 (0)