Skip to content

Commit d457297

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

35 files changed

+569
-94
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
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
@@ -508,7 +508,7 @@ jobs:
508508
name: Run Behat tests
509509
command: |
510510
mkdir -p build/logs/behat
511-
vendor/bin/behat --format=progress --out=std --format=junit --out=build/logs/behat --profile=absoluteUrl --no-interaction --colors
511+
vendor/bin/behat --format=progress --out=std --format=junit --out=build/logs/behat --profile=absolute-url --no-interaction --colors
512512
- restore-npm-cache
513513
- merge-test-reports:
514514
dir: build/logs/behat

.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: 24 additions & 8 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:
@@ -40,7 +40,7 @@ default-no-legacy:
4040
suites:
4141
default:
4242
filters:
43-
tags: '~@postgres&&~@mongodb&&~@elasticsearch&&~@legacy'
43+
tags: '~@postgres&&~@mongodb&&~@elasticsearch&&~@legacy&&~@absoluteUrl&&~@networkPath'
4444

4545
postgres:
4646
suites:
@@ -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+
Then 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+

0 commit comments

Comments
 (0)