Skip to content

Commit 2dd6560

Browse files
adjust PHPunit to sylius 2.1
1 parent 12c5d69 commit 2dd6560

9 files changed

+284
-10
lines changed

tests/PHPUnit/Integration/Api/ProductListingTest.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
namespace PHPUnit\Integration\Api;
1414

1515
use ApiTestCase\JsonApiTestCase;
16+
use Sylius\Bundle\CoreBundle\SyliusCoreBundle;
1617
use Symfony\Component\HttpFoundation\Response;
1718
use Symfony\Component\Process\Process;
1819

@@ -40,6 +41,12 @@ public function test_it_finds_products_by_name(): void
4041
);
4142

4243
$response = $this->client->getResponse();
44+
45+
if (SyliusCoreBundle::VERSION_ID >= 20100) {
46+
$this->assertResponse($response, '2.1_test_it_finds_products_by_name', Response::HTTP_OK);
47+
return;
48+
}
49+
4350
$this->assertResponse($response, 'test_it_finds_products_by_name', Response::HTTP_OK);
4451
}
4552

@@ -54,6 +61,12 @@ public function test_it_finds_products_by_name_and_facets(): void
5461
);
5562

5663
$response = $this->client->getResponse();
64+
65+
if (SyliusCoreBundle::VERSION_ID >= 20100) {
66+
$this->assertResponse($response, '2.1_test_it_finds_products_by_name_and_facets', Response::HTTP_OK);
67+
return;
68+
}
69+
5770
$this->assertResponse($response, 'test_it_finds_products_by_name_and_facets', Response::HTTP_OK);
5871
}
5972

@@ -68,6 +81,12 @@ public function test_it_finds_products_by_name_and_multiple_facets(): void
6881
);
6982

7083
$response = $this->client->getResponse();
84+
85+
if (SyliusCoreBundle::VERSION_ID >= 20100) {
86+
$this->assertResponse($response, '2.1_test_it_finds_products_by_name_and_multiple_facets', Response::HTTP_OK);
87+
return;
88+
}
89+
7190
$this->assertResponse($response, 'test_it_finds_products_by_name_and_multiple_facets', Response::HTTP_OK);
7291
}
7392

@@ -82,6 +101,12 @@ public function test_it_updates_facets(): void
82101
);
83102

84103
$response = $this->client->getResponse();
104+
105+
if (SyliusCoreBundle::VERSION_ID >= 20100) {
106+
$this->assertResponse($response, '2.1_test_it_updates_facets', Response::HTTP_OK);
107+
return;
108+
}
109+
85110
$this->assertResponse($response, 'test_it_updates_facets', Response::HTTP_OK);
86111
}
87112

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"items": [
3+
{
4+
"productTaxons": [
5+
"/api/v2/shop/product-taxons/@string@"
6+
],
7+
"mainTaxon": null,
8+
"averageRating": "@integer@ || @float@",
9+
"images": [],
10+
"id": "@integer@",
11+
"code": "MUG",
12+
"variants": [],
13+
"options": [],
14+
"associations": [],
15+
"createdAt": "@string@",
16+
"updatedAt": "@string@",
17+
"shortDescription": null,
18+
"reviews": [],
19+
"name": "Mug",
20+
"description": "@string@",
21+
"slug": "mug",
22+
"defaultVariant": null,
23+
"defaultVariantData": null
24+
}
25+
],
26+
"facets": {
27+
"taxon": {
28+
"doc_count_error_upper_bound": 0,
29+
"sum_other_doc_count": 0,
30+
"buckets": [
31+
{
32+
"key": "mugs",
33+
"doc_count": 1
34+
}
35+
]
36+
}
37+
},
38+
"pagination": {
39+
"current_page": 1,
40+
"has_previous_page": false,
41+
"has_next_page": false,
42+
"per_page": 9,
43+
"total_items": 1,
44+
"total_pages": 1
45+
}
46+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"items": [
3+
{
4+
"productTaxons": [
5+
"/api/v2/shop/product-taxons/@string@"
6+
],
7+
"mainTaxon": null,
8+
"averageRating": 0,
9+
"images": [],
10+
"id": "@integer@",
11+
"code": "MUG",
12+
"variants": [],
13+
"options": [],
14+
"associations": [],
15+
"createdAt": "@string@",
16+
"updatedAt": "@string@",
17+
"shortDescription": null,
18+
"reviews": [],
19+
"name": "Mug",
20+
"description": "@string@",
21+
"slug": "mug",
22+
"defaultVariant": null,
23+
"defaultVariantData": null
24+
}
25+
],
26+
"facets": {
27+
"color": {
28+
"doc_count_error_upper_bound": 0,
29+
"sum_other_doc_count": 0,
30+
"buckets": [
31+
{
32+
"key": "red",
33+
"doc_count": 1
34+
}
35+
]
36+
},
37+
"taxon": {
38+
"doc_count_error_upper_bound": 0,
39+
"sum_other_doc_count": 0,
40+
"buckets": [
41+
{
42+
"key": "mugs",
43+
"doc_count": 1
44+
}
45+
]
46+
}
47+
},
48+
"pagination": {
49+
"current_page": 1,
50+
"has_previous_page": false,
51+
"has_next_page": false,
52+
"per_page": 9,
53+
"total_items": 1,
54+
"total_pages": 1
55+
}
56+
}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{
2+
"items": [
3+
{
4+
"productTaxons": [
5+
"/api/v2/shop/product-taxons/@string@"
6+
],
7+
"mainTaxon": null,
8+
"averageRating": 0,
9+
"images": [],
10+
"id": "@integer@",
11+
"code": "MUG",
12+
"variants": [],
13+
"options": [],
14+
"associations": [],
15+
"createdAt": "@string@",
16+
"updatedAt": "@string@",
17+
"shortDescription": null,
18+
"reviews": [],
19+
"name": "Mug",
20+
"description": "@string@",
21+
"slug": "mug",
22+
"defaultVariant": null,
23+
"defaultVariantData": null
24+
},
25+
{
26+
"productTaxons": [],
27+
"mainTaxon": null,
28+
"averageRating": 0,
29+
"images": [],
30+
"id": "@integer@",
31+
"code": "MUG2",
32+
"variants": [],
33+
"options": [],
34+
"associations": [],
35+
"createdAt": "@string@",
36+
"updatedAt": "@string@",
37+
"shortDescription": null,
38+
"reviews": [],
39+
"name": "Mug 2",
40+
"description": "@string@",
41+
"slug": "mug-2",
42+
"defaultVariant": null,
43+
"defaultVariantData": null
44+
}
45+
],
46+
"facets": {
47+
"material": {
48+
"doc_count_error_upper_bound": 0,
49+
"sum_other_doc_count": 0,
50+
"buckets": [
51+
{
52+
"key": "ceramic",
53+
"doc_count": 2
54+
}
55+
]
56+
},
57+
"color": {
58+
"doc_count_error_upper_bound": 0,
59+
"sum_other_doc_count": 0,
60+
"buckets": [
61+
{
62+
"key": "red",
63+
"doc_count": 2
64+
}
65+
]
66+
},
67+
"taxon": {
68+
"doc_count_error_upper_bound": 0,
69+
"sum_other_doc_count": 0,
70+
"buckets": [
71+
{
72+
"key": "mugs",
73+
"doc_count": 1
74+
}
75+
]
76+
}
77+
},
78+
"pagination": {
79+
"current_page": 1,
80+
"has_previous_page": false,
81+
"has_next_page": false,
82+
"per_page": 9,
83+
"total_items": 2,
84+
"total_pages": 1
85+
}
86+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
"items": [
3+
{
4+
"productTaxons": [
5+
"/api/v2/shop/product-taxons/@string@"
6+
],
7+
"mainTaxon": null,
8+
"averageRating": 0,
9+
"images": [],
10+
"id": "@integer@",
11+
"code": "MUG",
12+
"variants": [],
13+
"options": [],
14+
"associations": [],
15+
"createdAt": "@string@",
16+
"updatedAt": "@string@",
17+
"shortDescription": null,
18+
"reviews": [],
19+
"name": "Mug",
20+
"description": "@string@",
21+
"slug": "mug",
22+
"defaultVariant": null,
23+
"defaultVariantData": null
24+
}
25+
],
26+
"facets": {
27+
"material": {
28+
"doc_count_error_upper_bound": 0,
29+
"sum_other_doc_count": 0,
30+
"buckets": [
31+
{
32+
"key": "ceramic",
33+
"doc_count": 1
34+
}
35+
]
36+
},
37+
"color": {
38+
"doc_count_error_upper_bound": 0,
39+
"sum_other_doc_count": 0,
40+
"buckets": [
41+
{
42+
"key": "red",
43+
"doc_count": 1
44+
}
45+
]
46+
},
47+
"taxon": {
48+
"doc_count_error_upper_bound": 0,
49+
"sum_other_doc_count": 0,
50+
"buckets": [
51+
{
52+
"key": "mugs",
53+
"doc_count": 1
54+
}
55+
]
56+
}
57+
},
58+
"pagination": {
59+
"current_page": 1,
60+
"has_previous_page": false,
61+
"has_next_page": false,
62+
"per_page": 9,
63+
"total_items": 1,
64+
"total_pages": 1
65+
}
66+
}

tests/PHPUnit/Integration/Api/Responses/Expected/test_it_finds_products_by_name.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
"name": "Mug",
2020
"description": "@string@",
2121
"slug": "mug",
22-
"defaultVariant": null,
23-
"defaultVariantData": null
22+
"defaultVariant": null
2423
}
2524
],
2625
"facets": {

tests/PHPUnit/Integration/Api/Responses/Expected/test_it_finds_products_by_name_and_facets.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
"name": "Mug",
2020
"description": "@string@",
2121
"slug": "mug",
22-
"defaultVariant": null,
23-
"defaultVariantData": null
22+
"defaultVariant": null
2423
}
2524
],
2625
"facets": {

tests/PHPUnit/Integration/Api/Responses/Expected/test_it_finds_products_by_name_and_multiple_facets.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
"name": "Mug",
2020
"description": "@string@",
2121
"slug": "mug",
22-
"defaultVariant": null,
23-
"defaultVariantData": null
22+
"defaultVariant": null
2423
},
2524
{
2625
"productTaxons": [],
@@ -39,8 +38,7 @@
3938
"name": "Mug 2",
4039
"description": "@string@",
4140
"slug": "mug-2",
42-
"defaultVariant": null,
43-
"defaultVariantData": null
41+
"defaultVariant": null
4442
}
4543
],
4644
"facets": {

tests/PHPUnit/Integration/Api/Responses/Expected/test_it_updates_facets.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
"name": "Mug",
2020
"description": "@string@",
2121
"slug": "mug",
22-
"defaultVariant": null,
23-
"defaultVariantData": null
22+
"defaultVariant": null
2423
}
2524
],
2625
"facets": {

0 commit comments

Comments
 (0)