Skip to content

Commit 3102fa5

Browse files
committed
Allow passing an url generation strategy instead of a bool
1 parent 3c3df6b commit 3102fa5

35 files changed

+564
-132
lines changed

.circleci/config.yml

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ jobs:
353353
name: Run Behat tests
354354
command: |
355355
mkdir -p build/logs/behat build/coverage
356-
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
356+
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
357357
_f=$(echo "$f" | tr / _)
358358
FEATURE="${_f}" vendor/bin/behat --format=progress --out=std --format=junit --out=build/logs/behat/"${_f}" --profile=default-coverage --no-interaction --colors "$f"
359359
done
@@ -508,48 +508,6 @@ jobs:
508508
file: build/logs/clover.xml
509509
- save-npm-cache
510510

511-
behat-absolute-url-coverage:
512-
executor: php
513-
environment:
514-
APP_ENV: absolute_url
515-
working_directory: ~/api-platform/core
516-
steps:
517-
- checkout
518-
- install-mongodb-php-extension
519-
- install-pcov-php-extension
520-
- disable-xdebug-php-extension
521-
- disable-php-memory-limit
522-
- restore-composer-cache
523-
- update-project-dependencies
524-
- save-composer-cache
525-
- clear-test-app-cache
526-
- run:
527-
name: Run Behat tests
528-
command: |
529-
mkdir -p build/logs/behat
530-
vendor/bin/behat --format=progress --out=std --format=junit --out=build/logs/behat --profile=absoluteUrl --no-interaction --colors
531-
- restore-npm-cache
532-
- merge-test-reports:
533-
dir: build/logs/behat
534-
out: build/logs/behat/junit.xml
535-
- store_test_results:
536-
path: build/logs
537-
- store_artifacts:
538-
path: build/logs/behat/junit.xml
539-
destination: build/logs/behat/junit.xml
540-
- merge-code-coverage-reports:
541-
dir: build/coverage
542-
out: build/logs/clover.xml
543-
- store_artifacts:
544-
path: build/logs/clover.xml
545-
destination: build/logs/clover.xml
546-
- codecov/upload:
547-
file: build/logs/clover.xml
548-
flags: behat_absolute_url
549-
- coveralls/upload:
550-
file: build/logs/clover.xml
551-
- save-npm-cache
552-
553511
workflows:
554512
version: 2
555513
lint:
@@ -563,4 +521,3 @@ workflows:
563521
- phpunit-mongodb-coverage
564522
- behat-mongodb-coverage
565523
- behat-elasticsearch-coverage
566-
- behat-absolute-url-coverage

.travis.yml

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

behat.yml.dist

Lines changed: 20 additions & 4 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
postgres-no-legacy:
7171
suites:
@@ -98,7 +98,7 @@ mongodb:
9898
- 'Behat\MinkExtension\Context\MinkContext'
9999
- 'Behatch\Context\RestContext'
100100
filters:
101-
tags: '~@sqlite&&~@elasticsearch&&~@!mongodb&&~@absoluteUrl'
101+
tags: '~@sqlite&&~@elasticsearch&&~@!mongodb&&~@absoluteUrl&&~@networkPath'
102102

103103
mongodb-no-legacy:
104104
suites:
@@ -135,6 +135,22 @@ elasticsearch-no-legacy:
135135
filters:
136136
tags: '@elasticsearch&&~@legacy'
137137

138+
network-path:
139+
suites:
140+
default: false
141+
network-path:
142+
paths:
143+
- '%paths.base%/features/network_path'
144+
contexts:
145+
- 'DoctrineContext':
146+
doctrine: '@doctrine'
147+
passwordEncoder: '@security.password_encoder'
148+
- 'JsonContext'
149+
- 'Behatch\Context\RestContext'
150+
- 'Behat\MinkExtension\Context\MinkContext'
151+
filters:
152+
tags: '@networkPath'
153+
138154
default-coverage:
139155
suites:
140156
default:

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)