Skip to content

Commit 13a87c3

Browse files
committed
Allow passing an url generation strategy instead of a bool
1 parent 3b6c5e5 commit 13a87c3

35 files changed

+567
-92
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ jobs:
337337
name: Run Behat tests
338338
command: |
339339
mkdir -p build/logs/behat build/coverage
340-
for f in $(find features -name '*.feature' -not -path 'features/main/exposed_state.feature' -not -path 'features/elasticsearch/*' -not -path 'features/mongodb/*' -not -path 'features/absolute_url/*' | circleci tests split --split-by=timings); do
340+
for f in $(find features -name '*.feature' -not -path 'features/main/exposed_state.feature' -not -path 'features/elasticsearch/*' -not -path 'features/mongodb/*' -not -path 'features/absolute_url/*' -not -path 'features/network_path/*' | circleci tests split --split-by=timings); do
341341
_f=$(echo "$f" | tr / _)
342342
FEATURE="${_f}" vendor/bin/behat --format=progress --out=std --format=junit --out=build/logs/behat/"${_f}" --profile=default-coverage --no-interaction --colors "$f"
343343
done

.travis.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,28 @@ jobs:
263263
script:
264264
- *run-phpunit-tests
265265
- *clear-test-app-cache
266-
- vendor/bin/behat --format=progress --profile=absoluteUrl --no-interaction
266+
- vendor/bin/behat --format=progress --profile=absolute-url --no-interaction
267+
- *validate-openapi-v2-json
268+
- *validate-openapi-v2-yaml
269+
- *validate-openapi-v3-json
270+
- *validate-openapi-v3-yaml
271+
272+
273+
- php: '7.3'
274+
env: APP_ENV=network_path
275+
before_install:
276+
- *enable-mongodb-php-extension
277+
- *disable-xdebug-php-extension
278+
- *disable-php-memory-limit
279+
- *add-composer-bin-dir-to-path
280+
install:
281+
- *update-project-dependencies
282+
before_script:
283+
- *clear-test-app-cache
284+
script:
285+
- *run-phpunit-tests
286+
- *clear-test-app-cache
287+
- vendor/bin/behat --format=progress --profile=network-path --no-interaction
267288
- *validate-openapi-v2-json
268289
- *validate-openapi-v2-yaml
269290
- *validate-openapi-v3-json

behat.yml.dist

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ default:
2020
- 'Behat\MinkExtension\Context\MinkContext'
2121
- 'Behatch\Context\RestContext'
2222
filters:
23-
tags: '~@postgres&&~@mongodb&&~@elasticsearch&&~@absoluteUrl'
23+
tags: '~@postgres&&~@mongodb&&~@elasticsearch&&~@absoluteUrl&&~@networkPath'
2424
extensions:
2525
'Behat\Symfony2Extension':
2626
kernel:
@@ -65,7 +65,7 @@ postgres:
6565
- 'Behat\MinkExtension\Context\MinkContext'
6666
- 'Behatch\Context\RestContext'
6767
filters:
68-
tags: '~@sqlite&&~@mongodb&&~@elasticsearch&&~@absoluteUrl'
68+
tags: '~@sqlite&&~@mongodb&&~@elasticsearch&&~@absoluteUrl&&~@networkPath'
6969

7070
mongodb:
7171
suites:
@@ -90,7 +90,7 @@ mongodb:
9090
- 'Behat\MinkExtension\Context\MinkContext'
9191
- 'Behatch\Context\RestContext'
9292
filters:
93-
tags: '~@sqlite&&~@elasticsearch&&~@!mongodb&&~@absoluteUrl'
93+
tags: '~@sqlite&&~@elasticsearch&&~@!mongodb&&~@absoluteUrl&&~@networkPath'
9494

9595
elasticsearch:
9696
suites:
@@ -111,10 +111,10 @@ elasticsearch:
111111
filters:
112112
tags: '@elasticsearch'
113113

114-
absoluteUrl:
114+
absolute-url:
115115
suites:
116116
default: false
117-
absoluteUrl:
117+
absolute-url:
118118
paths:
119119
- '%paths.base%/features/absolute_url'
120120
contexts:
@@ -127,6 +127,22 @@ absoluteUrl:
127127
filters:
128128
tags: '@absoluteUrl'
129129

130+
network-path:
131+
suites:
132+
default: false
133+
network-path:
134+
paths:
135+
- '%paths.base%/features/network_path'
136+
contexts:
137+
- 'DoctrineContext':
138+
doctrine: '@doctrine'
139+
passwordEncoder: '@security.password_encoder'
140+
- 'JsonContext'
141+
- 'Behatch\Context\RestContext'
142+
- 'Behat\MinkExtension\Context\MinkContext'
143+
filters:
144+
tags: '@networkPath'
145+
130146
default-coverage:
131147
suites:
132148
default:
@@ -150,7 +166,7 @@ default-coverage:
150166
- 'Behat\MinkExtension\Context\MinkContext'
151167
- 'Behatch\Context\RestContext'
152168
filters:
153-
tags: '~@postgres&&~@mongodb&&~@elasticsearch&&~@absoluteUrl'
169+
tags: '~@postgres&&~@mongodb&&~@elasticsearch&&~@absoluteUrl&&~@networkPath'
154170

155171
mongodb-coverage:
156172
suites:
@@ -176,7 +192,7 @@ mongodb-coverage:
176192
- 'Behat\MinkExtension\Context\MinkContext'
177193
- 'Behatch\Context\RestContext'
178194
filters:
179-
tags: '~@sqlite&&~@elasticsearch&&~@!mongodb&&~@absoluteUrl'
195+
tags: '~@sqlite&&~@elasticsearch&&~@!mongodb&&~@absoluteUrl&&~@networkPath'
180196

181197
elasticsearch-coverage:
182198
suites:

features/absolute_url/hal/absolute_url.feature

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ Feature: IRI should contain Absolute URL
77
Scenario: I should be able to GET a collection of Objects with Absolute Urls
88
Given there are 1 absoluteUrlDummy objects with a related absoluteUrlRelationDummy
99
And I add "Accept" header equal to "application/hal+json"
10-
And I add "Content-Type" header equal to "application/json"
1110
And I send a "GET" request to "/absolute_url_dummies"
1211
And the JSON should be equal to:
1312
"""

features/absolute_url/hal/entrypoint.feature

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
Feature: Check the Entrypoint with Absolute URLs
33

44
Scenario: Retrieve the API Entrypoint
5-
And I add "Accept" header equal to "application/hal+json"
6-
And I add "Content-Type" header equal to "application/json"
5+
Given I add "Accept" header equal to "application/hal+json"
76
And I send a "GET" request to "/"
8-
And the JSON nodes should be equal to:
9-
| _links.self.href | http://example.com/ |
7+
Then the JSON node "_links.self.href" should be equal to "http://example.com/"

features/absolute_url/jsonapi/absolute_url.feature

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ Feature: IRI should contain Absolute URL
77
Scenario: I should be able to GET a collection of Objects with Absolute Urls
88
Given there are 1 absoluteUrlDummy objects with a related absoluteUrlRelationDummy
99
And I add "Accept" header equal to "application/vnd.api+json"
10-
And I add "Content-Type" header equal to "application/json"
1110
And I send a "GET" request to "/absolute_url_dummies"
1211
And the JSON should be equal to:
1312
"""
@@ -65,7 +64,6 @@ Feature: IRI should contain Absolute URL
6564

6665
Scenario: I should be able to GET an Item with Absolute Urls
6766
Given I add "Accept" header equal to "application/vnd.api+json"
68-
And I add "Content-Type" header equal to "application/json"
6967
And I send a "GET" request to "/absolute_url_dummies/1"
7068
And the JSON should be equal to:
7169
"""
@@ -90,7 +88,6 @@ Feature: IRI should contain Absolute URL
9088

9189
Scenario: I should be able to GET subresources with Absolute Urls
9290
Given I add "Accept" header equal to "application/vnd.api+json"
93-
And I add "Content-Type" header equal to "application/json"
9491
And I send a "GET" request to "/absolute_url_relation_dummies/1/absolute_url_dummies"
9592
And the JSON should be equal to:
9693
"""

features/absolute_url/jsonapi/entrypoint.feature

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
Feature: Check the Entrypoint with Absolute URLs
33

44
Scenario: Retrieve the API Entrypoint
5-
And I add "Accept" header equal to "application/hal+json"
6-
And I add "Content-Type" header equal to "application/json"
5+
Given I add "Accept" header equal to "application/vnd.api+json"
76
And I send a "GET" request to "/"
8-
And the JSON nodes should be equal to:
9-
| _links.self.href | http://example.com/ |
7+
Then the JSON node "links.self" should be equal to "http://example.com/"

features/absolute_url/jsonld/absolute_url.feature

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ Feature: IRI should contain Absolute URL
77
Scenario: I should be able to GET a collection of Objects with Absolute Urls
88
Given there are 1 absoluteUrlDummy objects with a related absoluteUrlRelationDummy
99
And I add "Accept" header equal to "application/ld+json"
10-
And I add "Content-Type" header equal to "application/json"
1110
And I send a "GET" request to "/absolute_url_dummies"
1211
And the JSON should be equal to:
1312
"""
@@ -51,9 +50,7 @@ Feature: IRI should contain Absolute URL
5150

5251
Scenario: I should be able to GET an Item with Absolute Urls
5352
Given I add "Accept" header equal to "application/ld+json"
54-
And I add "Content-Type" header equal to "application/json"
5553
And I send a "GET" request to "/absolute_url_dummies/1"
56-
And print last JSON response
5754
And the JSON should be equal to:
5855
"""
5956
{
@@ -67,9 +64,7 @@ Feature: IRI should contain Absolute URL
6764

6865
Scenario: I should be able to GET subresources with Absolute Urls
6966
Given I add "Accept" header equal to "application/ld+json"
70-
And I add "Content-Type" header equal to "application/json"
7167
And I send a "GET" request to "/absolute_url_relation_dummies/1/absolute_url_dummies"
72-
And print last JSON response
7368
And the JSON should be equal to:
7469
"""
7570
{

features/absolute_url/jsonld/entrypoint.feature

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,24 @@
22
Feature: Check the Entrypoint with Absolute URLs
33

44
Scenario: Retrieve the API Entrypoint
5-
And I add "Accept" header equal to "application/ld+json"
6-
And I add "Content-Type" header equal to "application/json"
5+
Given I add "Accept" header equal to "application/ld+json"
76
And I send a "GET" request to "/"
8-
And the JSON nodes should be equal to:
7+
Then the JSON nodes should be equal to:
98
| @context | http://example.com/contexts/Entrypoint |
109
| @id | http://example.com/ |
1110
| @type | Entrypoint |
11+
12+
13+
Scenario: Get an error during deserialization of simple relation
14+
Given I add "Accept" header equal to "application/ld+json"
15+
And I add "Content-Type" header equal to "application/ld+json"
16+
And I send a "POST" request to "/dummies" with body:
17+
"""
18+
{
19+
"name": "Foo",
20+
"relatedDummy": {
21+
"name": "bar"
22+
}
23+
}
24+
"""
25+
And the JSON node "@context" should be equal to "http://example.com/contexts/Error"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
@absoluteUrl
2+
Feature: Check the Errors with Absolute URLs
3+
4+
Scenario: Get an error during deserialization of simple relation
5+
Given I add "Accept" header equal to "application/ld+json"
6+
And I add "Content-Type" header equal to "application/ld+json"
7+
And I send a "POST" request to "/dummies" with body:
8+
"""
9+
{
10+
"name": "Foo",
11+
"relatedDummy": {
12+
"name": "bar"
13+
}
14+
}
15+
"""
16+
And the JSON node "@context" should be equal to "http://example.com/contexts/Error"

features/doctrine/search_filter.feature

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,6 @@ Feature: Search filter on collections
804804
When I send a "GET" request to "/converted_owners?name_converted.name_converted=Converted 3"
805805
Then the response status code should be 200
806806
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
807-
Then print last JSON response
808807
And the JSON should be valid according to this schema:
809808
"""
810809
{
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@networkPath
2+
Feature: Check the Entrypoint with network path
3+
4+
Scenario: Retrieve the API Entrypoint
5+
Given I add "Accept" header equal to "application/hal+json"
6+
And I send a "GET" request to "/"
7+
Then the JSON node "_links.self.href" should be equal to "//example.com/"
8+
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
@networkPath
2+
Feature: IRI should contain network path
3+
In order to add detail to IRIs
4+
Include the network path
5+
6+
@createSchema
7+
Scenario: I should be able to GET a collection of objects with network paths
8+
Given there are 1 absoluteUrlDummy objects with a related absoluteUrlRelationDummy
9+
And I add "Accept" header equal to "application/hal+json"
10+
And I send a "GET" request to "/absolute_url_dummies"
11+
And the JSON should be equal to:
12+
"""
13+
{
14+
"_links": {
15+
"self": {
16+
"href": "\/\/example.com\/absolute_url_dummies"
17+
},
18+
"item": [
19+
{
20+
"href": "\/\/example.com\/absolute_url_dummies\/1"
21+
}
22+
]
23+
},
24+
"totalItems": 1,
25+
"itemsPerPage": 3,
26+
"_embedded": {
27+
"item": [
28+
{
29+
"_links": {
30+
"self": {
31+
"href": "\/\/example.com\/absolute_url_dummies\/1"
32+
},
33+
"absoluteUrlRelationDummy": {
34+
"href": "\/\/example.com\/absolute_url_relation_dummies\/1"
35+
}
36+
},
37+
"id": 1
38+
}
39+
]
40+
}
41+
}
42+
"""
43+
44+
Scenario: I should be able to POST an object using a network path
45+
Given I add "Accept" header equal to "application/hal+json"
46+
And I add "Content-Type" header equal to "application/json"
47+
And I send a "POST" request to "/absolute_url_relation_dummies" with body:
48+
"""
49+
{
50+
"absolute_url_dummies": "//example.com/absolute_url_dummies/1"
51+
}
52+
"""
53+
Then the response status code should be 201
54+
And the JSON should be equal to:
55+
"""
56+
{
57+
"_links": {
58+
"self": {
59+
"href": "\/\/example.com\/absolute_url_relation_dummies\/2"
60+
}
61+
},
62+
"id": 2
63+
}
64+
"""
65+
66+
Scenario: I should be able to GET an Item with network paths
67+
Given I add "Accept" header equal to "application/hal+json"
68+
And I send a "GET" request to "/absolute_url_dummies/1"
69+
And the JSON should be equal to:
70+
"""
71+
{
72+
"_links": {
73+
"self": {
74+
"href": "\/\/example.com\/absolute_url_dummies\/1"
75+
},
76+
"absoluteUrlRelationDummy": {
77+
"href": "\/\/example.com\/absolute_url_relation_dummies\/1"
78+
}
79+
},
80+
"id": 1
81+
}
82+
"""
83+
84+
Scenario: I should be able to GET subresources with network paths
85+
Given I add "Accept" header equal to "application/hal+json"
86+
And I send a "GET" request to "/absolute_url_relation_dummies/1/absolute_url_dummies"
87+
And the JSON should be equal to:
88+
"""
89+
{
90+
"_links": {
91+
"self": {
92+
"href": "\/\/example.com\/absolute_url_relation_dummies\/1\/absolute_url_dummies"
93+
},
94+
"item": [
95+
{
96+
"href": "\/\/example.com\/absolute_url_dummies\/1"
97+
}
98+
]
99+
},
100+
"totalItems": 1,
101+
"itemsPerPage": 3,
102+
"_embedded": {
103+
"item": [
104+
{
105+
"_links": {
106+
"self": {
107+
"href": "\/\/example.com\/absolute_url_dummies\/1"
108+
},
109+
"absoluteUrlRelationDummy": {
110+
"href": "\/\/example.com\/absolute_url_relation_dummies\/1"
111+
}
112+
},
113+
"id": 1
114+
}
115+
]
116+
}
117+
}
118+
"""
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@networkPath
2+
Feature: Check the Entrypoint with network path
3+
4+
Scenario: Retrieve the API Entrypoint
5+
Given I add "Accept" header equal to "application/hal+json"
6+
And I send a "GET" request to "/"
7+
Then the JSON node "links.self" should be equal to "//example.com/"

0 commit comments

Comments
 (0)