Skip to content

Commit 9300d58

Browse files
committed
update composer.json & fix behat tests
1 parent 044bebf commit 9300d58

15 files changed

+78
-54
lines changed

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
},
2929
"require-dev": {
3030
"behat/behat": "^3.1",
31-
"behat/mink": "^1.7",
32-
"behat/mink-browserkit-driver": "^1.3.1",
33-
"behat/mink-extension": "^2.2",
31+
"friends-of-behat/mink": "^1.7",
32+
"friends-of-behat/mink-browserkit-driver": "^1.3.1",
33+
"friends-of-behat/mink-extension": "^2.2",
3434
"behat/symfony2-extension": "^2.1.1",
3535
"behatch/contexts": "^3.1.0",
3636
"doctrine/annotations": "^1.7",

features/bootstrap/GraphqlContext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public function theGraphQLFieldIsDeprecatedForTheReason(string $fieldName, strin
162162

163163
private function sendGraphqlRequest()
164164
{
165-
$this->request->setHttpHeader('Accept', null);
165+
$this->request->setHttpHeader('Accept', 'application/json');
166166
$this->restContext->iSendARequestTo('GET', '/graphql?'.http_build_query($this->graphqlRequest));
167167
}
168168
}

features/bootstrap/HttpHeaderContext.php

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
declare(strict_types=1);
1313

1414
use Behat\Behat\Context\Context;
15-
use Behat\Behat\Hook\Scope\AfterStepScope;
1615
use Behatch\HttpCall\Request;
1716

1817
final class HttpHeaderContext implements Context
@@ -25,24 +24,12 @@ public function __construct(Request $request)
2524
}
2625

2726
/**
28-
* Sets the default Accept HTTP header to null (workaround to artificially remove it).
29-
*
30-
* @AfterStep
31-
*/
32-
public function removeAcceptHeaderAfterRequest(AfterStepScope $event)
33-
{
34-
if (preg_match('/^I send a "[A-Z]+" request to ".+"/', $event->getStep()->getText())) {
35-
$this->request->setHttpHeader('Accept', null);
36-
}
37-
}
38-
39-
/**
40-
* Sets the default Accept HTTP header to null (workaround to artificially remove it).
27+
* Sets the default Accept HTTP header to application/ld+json before each scenario.
4128
*
4229
* @BeforeScenario
4330
*/
4431
public function removeAcceptHeaderBeforeScenario()
4532
{
46-
$this->request->setHttpHeader('Accept', null);
33+
$this->request->setHttpHeader('Accept', 'application/ld+json');
4734
}
4835
}

features/doctrine/boolean_filter.feature

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,8 @@ Feature: Boolean filter on collections
371371
And the JSON node "hydra:totalItems" should be equal to 15
372372

373373
Scenario: Get collection filtered by non valid properties
374-
When I send a "GET" request to "/dummies?unknown=0"
374+
When I add "Accept" header equal to "application/ld+json"
375+
And I send a "GET" request to "/dummies?unknown=0"
375376
Then the response status code should be 200
376377
And the response should be in JSON
377378
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
@@ -410,7 +411,8 @@ Feature: Boolean filter on collections
410411
"""
411412
And the JSON node "hydra:totalItems" should be equal to 25
412413

413-
When I send a "GET" request to "/dummies?unknown=1"
414+
When I add "Accept" header equal to "application/ld+json"
415+
And I send a "GET" request to "/dummies?unknown=1"
414416
Then the response status code should be 200
415417
And the response should be in JSON
416418
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"

features/doctrine/date_filter.feature

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ Feature: Date filter on collections
66
@createSchema
77
Scenario: Get collection filtered by date
88
Given there are 30 dummy objects with dummyDate
9-
When I send a "GET" request to "/dummies?dummyDate[after]=2015-04-28"
9+
When I add "Accept" header equal to "application/ld+json"
10+
And I send a "GET" request to "/dummies?dummyDate[after]=2015-04-28"
1011
Then the response status code should be 200
1112
And the response should be in JSON
1213
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
@@ -49,7 +50,8 @@ Feature: Date filter on collections
4950
}
5051
"""
5152

52-
When I send a "GET" request to "/dummies?dummyDate[before]=2015-04-05"
53+
When I add "Accept" header equal to "application/ld+json"
54+
And I send a "GET" request to "/dummies?dummyDate[before]=2015-04-05"
5355
Then the response status code should be 200
5456
And the response should be in JSON
5557
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
@@ -92,7 +94,8 @@ Feature: Date filter on collections
9294
}
9395
"""
9496

95-
When I send a "GET" request to "/dummies?dummyDate[after]=2015-04-28T00:00:00%2B00:00"
97+
When I add "Accept" header equal to "application/ld+json"
98+
And I send a "GET" request to "/dummies?dummyDate[after]=2015-04-28T00:00:00%2B00:00"
9699
Then the response status code should be 200
97100
And the response should be in JSON
98101
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
@@ -134,7 +137,8 @@ Feature: Date filter on collections
134137
}
135138
"""
136139

137-
When I send a "GET" request to "/dummies?dummyDate[before]=2015-04-05Z"
140+
When I add "Accept" header equal to "application/ld+json"
141+
And I send a "GET" request to "/dummies?dummyDate[before]=2015-04-05Z"
138142
Then the response status code should be 200
139143
And the response should be in JSON
140144
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
@@ -179,7 +183,8 @@ Feature: Date filter on collections
179183

180184
Scenario: Search for entities within a range
181185
# The order should not influence the search
182-
When I send a "GET" request to "/dummies?dummyDate[before]=2015-04-05&dummyDate[after]=2015-04-05"
186+
When I add "Accept" header equal to "application/ld+json"
187+
And I send a "GET" request to "/dummies?dummyDate[before]=2015-04-05&dummyDate[after]=2015-04-05"
183188
Then the response status code should be 200
184189
And the response should be in JSON
185190
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
@@ -216,7 +221,8 @@ Feature: Date filter on collections
216221
}
217222
"""
218223

219-
When I send a "GET" request to "/dummies?dummyDate[after]=2015-04-05&dummyDate[before]=2015-04-05"
224+
When I add "Accept" header equal to "application/ld+json"
225+
And I send a "GET" request to "/dummies?dummyDate[after]=2015-04-05&dummyDate[before]=2015-04-05"
220226
Then the response status code should be 200
221227
And the response should be in JSON
222228
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
@@ -285,7 +291,8 @@ Feature: Date filter on collections
285291

286292
Scenario: Get collection filtered by association date
287293
Given there are 30 dummy objects with dummyDate and relatedDummy
288-
When I send a "GET" request to "/dummies?relatedDummy.dummyDate[after]=2015-04-28"
294+
When I add "Accept" header equal to "application/ld+json"
295+
And I send a "GET" request to "/dummies?relatedDummy.dummyDate[after]=2015-04-28"
289296
Then the response status code should be 200
290297
And the response should be in JSON
291298
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
@@ -329,7 +336,8 @@ Feature: Date filter on collections
329336
}
330337
"""
331338

332-
When I send a "GET" request to "/dummies?relatedDummy.dummyDate[after]=2015-04-28&relatedDummy_dummyDate[after]=2015-04-28"
339+
When I add "Accept" header equal to "application/ld+json"
340+
And I send a "GET" request to "/dummies?relatedDummy.dummyDate[after]=2015-04-28&relatedDummy_dummyDate[after]=2015-04-28"
333341
Then the response status code should be 200
334342
And the response should be in JSON
335343
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
@@ -373,7 +381,8 @@ Feature: Date filter on collections
373381
}
374382
"""
375383

376-
When I send a "GET" request to "/dummies?relatedDummy.dummyDate[after]=2015-04-28T00:00:00%2B00:00"
384+
When I add "Accept" header equal to "application/ld+json"
385+
And I send a "GET" request to "/dummies?relatedDummy.dummyDate[after]=2015-04-28T00:00:00%2B00:00"
377386
Then the response status code should be 200
378387
And the response should be in JSON
379388
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
@@ -461,13 +470,15 @@ Feature: Date filter on collections
461470
@createSchema
462471
Scenario: Get collection filtered by date that is not a datetime including null after
463472
Given there are 3 dummydate objects with nullable dateIncludeNullAfter
464-
When I send a "GET" request to "/dummy_dates?dateIncludeNullAfter[after]=2015-04-02"
473+
When I add "Accept" header equal to "application/ld+json"
474+
And I send a "GET" request to "/dummy_dates?dateIncludeNullAfter[after]=2015-04-02"
465475
Then the response status code should be 200
466476
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
467477
And the JSON node "hydra:totalItems" should be equal to 2
468478
And the JSON node "hydra:member[0].dateIncludeNullAfter" should be equal to "2015-04-02T00:00:00+00:00"
469479
And the JSON node "hydra:member[1].dateIncludeNullAfter" should be null
470-
When I send a "GET" request to "/dummy_dates?dateIncludeNullAfter[before]=2015-04-02"
480+
When I add "Accept" header equal to "application/ld+json"
481+
And I send a "GET" request to "/dummy_dates?dateIncludeNullAfter[before]=2015-04-02"
471482
Then the response status code should be 200
472483
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
473484
And the JSON node "hydra:totalItems" should be equal to 2
@@ -477,13 +488,15 @@ Feature: Date filter on collections
477488
@createSchema
478489
Scenario: Get collection filtered by date that is not a datetime including null before
479490
Given there are 3 dummydate objects with nullable dateIncludeNullBefore
480-
When I send a "GET" request to "/dummy_dates?dateIncludeNullBefore[before]=2015-04-01"
491+
When I add "Accept" header equal to "application/ld+json"
492+
And I send a "GET" request to "/dummy_dates?dateIncludeNullBefore[before]=2015-04-01"
481493
Then the response status code should be 200
482494
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
483495
And the JSON node "hydra:totalItems" should be equal to 2
484496
And the JSON node "hydra:member[0].dateIncludeNullBefore" should be equal to "2015-04-01T00:00:00+00:00"
485497
And the JSON node "hydra:member[1].dateIncludeNullBefore" should be null
486-
When I send a "GET" request to "/dummy_dates?dateIncludeNullBefore[after]=2015-04-01"
498+
When I add "Accept" header equal to "application/ld+json"
499+
And I send a "GET" request to "/dummy_dates?dateIncludeNullBefore[after]=2015-04-01"
487500
Then the response status code should be 200
488501
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
489502
And the JSON node "hydra:totalItems" should be equal to 2
@@ -493,13 +506,15 @@ Feature: Date filter on collections
493506
@createSchema
494507
Scenario: Get collection filtered by date that is not a datetime including null before and after
495508
Given there are 3 dummydate objects with nullable dateIncludeNullBeforeAndAfter
496-
When I send a "GET" request to "/dummy_dates?dateIncludeNullBeforeAndAfter[before]=2015-04-01"
509+
When I add "Accept" header equal to "application/ld+json"
510+
And I send a "GET" request to "/dummy_dates?dateIncludeNullBeforeAndAfter[before]=2015-04-01"
497511
Then the response status code should be 200
498512
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
499513
And the JSON node "hydra:totalItems" should be equal to 2
500514
And the JSON node "hydra:member[0].dateIncludeNullBeforeAndAfter" should be equal to "2015-04-01T00:00:00+00:00"
501515
And the JSON node "hydra:member[1].dateIncludeNullBeforeAndAfter" should be null
502-
When I send a "GET" request to "/dummy_dates?dateIncludeNullBeforeAndAfter[after]=2015-04-02"
516+
When I add "Accept" header equal to "application/ld+json"
517+
And I send a "GET" request to "/dummy_dates?dateIncludeNullBeforeAndAfter[after]=2015-04-02"
503518
Then the response status code should be 200
504519
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
505520
And the JSON node "hydra:totalItems" should be equal to 2

features/doctrine/order_filter.feature

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,8 @@ Feature: Order filter on collections
599599
"""
600600

601601
Scenario: Get collection ordered by a non valid properties and on which order filter has been enabled in whitelist mode
602-
When I send a "GET" request to "/dummies?order[alias]=asc"
602+
When I add "Accept" header equal to "application/ld+json"
603+
And I send a "GET" request to "/dummies?order[alias]=asc"
603604
Then the response status code should be 200
604605
And the response should be in JSON
605606
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
@@ -657,7 +658,8 @@ Feature: Order filter on collections
657658
}
658659
"""
659660

660-
When I send a "GET" request to "/dummies?order[alias]=desc"
661+
When I add "Accept" header equal to "application/ld+json"
662+
And I send a "GET" request to "/dummies?order[alias]=desc"
661663
Then the response status code should be 200
662664
And the response should be in JSON
663665
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
@@ -715,7 +717,8 @@ Feature: Order filter on collections
715717
}
716718
"""
717719

718-
When I send a "GET" request to "/dummies?order[unknown]=asc"
720+
When I add "Accept" header equal to "application/ld+json"
721+
And I send a "GET" request to "/dummies?order[unknown]=asc"
719722
Then the response status code should be 200
720723
And the response should be in JSON
721724
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
@@ -773,7 +776,8 @@ Feature: Order filter on collections
773776
}
774777
"""
775778

776-
When I send a "GET" request to "/dummies?order[unknown]=desc"
779+
When I add "Accept" header equal to "application/ld+json"
780+
And I send a "GET" request to "/dummies?order[unknown]=desc"
777781
Then the response status code should be 200
778782
And the response should be in JSON
779783
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"

features/doctrine/search_filter.feature

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,8 @@ Feature: Search filter on collections
577577
"""
578578

579579
Scenario: Get collection ordered by a non valid properties
580-
When I send a "GET" request to "/dummies?unknown=0"
580+
When I add "Accept" header equal to "application/ld+json"
581+
And I send a "GET" request to "/dummies?unknown=0"
581582
Then the response status code should be 200
582583
And the response should be in JSON
583584
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
@@ -615,7 +616,8 @@ Feature: Search filter on collections
615616
}
616617
"""
617618

618-
When I send a "GET" request to "/dummies?unknown=1"
619+
When I add "Accept" header equal to "application/ld+json"
620+
And I send a "GET" request to "/dummies?unknown=1"
619621
Then the response status code should be 200
620622
And the response should be in JSON
621623
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"

features/http_cache/tags.feature

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,15 @@ Feature: Cache invalidation through HTTP Cache tags
6464
And "/relation_embedders,/relation_embedders/1,/related_dummies/1" IRIs should be purged
6565

6666
Scenario: Create two Relation2
67-
When I add "Content-Type" header equal to "application/ld+json"
67+
When I add "Accept" header equal to "application/ld+json"
68+
And I add "Content-Type" header equal to "application/ld+json"
6869
And I send a "POST" request to "/relation2s" with body:
6970
"""
7071
{
7172
}
7273
"""
73-
When I add "Content-Type" header equal to "application/ld+json"
74+
When I add "Accept" header equal to "application/ld+json"
75+
And I add "Content-Type" header equal to "application/ld+json"
7476
And I send a "POST" request to "/relation2s" with body:
7577
"""
7678
{

features/hydra/collection.feature

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,8 @@ Feature: Collections support
398398

399399
@createSchema
400400
Scenario: Allow passing 0 to `itemsPerPage`
401-
When I send a "GET" request to "/dummies?itemsPerPage=0"
401+
When I add "Accept" header equal to "application/ld+json"
402+
And I send a "GET" request to "/dummies?itemsPerPage=0"
402403
Then the response status code should be 200
403404
And the response should be in JSON
404405
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
@@ -433,7 +434,8 @@ Feature: Collections support
433434
}
434435
"""
435436

436-
When I send a "GET" request to "/dummies?itemsPerPage=0&page=2"
437+
When I add "Accept" header equal to "application/ld+json"
438+
And I send a "GET" request to "/dummies?itemsPerPage=0&page=2"
437439
Then the response status code should be 400
438440
And the JSON node "hydra:description" should be equal to "Page should not be greater than 1 if limit is equal to 0"
439441

features/main/circular_reference.feature

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ Feature: Circular references handling
55

66
@createSchema
77
Scenario: Create a circular reference
8-
When I add "Content-Type" header equal to "application/ld+json"
8+
When I add "Accept" header equal to "application/ld+json"
9+
And I add "Content-Type" header equal to "application/ld+json"
910
And I send a "POST" request to "/circular_references" with body:
1011
"""
1112
{}
1213
"""
14+
And I add "Accept" header equal to "application/ld+json"
1315
And I add "Content-Type" header equal to "application/ld+json"
1416
And I send a "PUT" request to "/circular_references/1" with body:
1517
"""
@@ -34,11 +36,13 @@ Feature: Circular references handling
3436
"""
3537

3638
Scenario: Fetch circular reference
37-
When I add "Content-Type" header equal to "application/ld+json"
39+
When I add "Accept" header equal to "application/ld+json"
40+
And I add "Content-Type" header equal to "application/ld+json"
3841
And I send a "POST" request to "/circular_references" with body:
3942
"""
4043
{}
4144
"""
45+
And I add "Accept" header equal to "application/ld+json"
4246
And I add "Content-Type" header equal to "application/ld+json"
4347
And I send a "PUT" request to "/circular_references/2" with body:
4448
"""
@@ -67,6 +71,7 @@ Feature: Circular references handling
6771
"children": []
6872
}
6973
"""
74+
And I add "Accept" header equal to "application/ld+json"
7075
And I send a "GET" request to "/circular_references/1"
7176
Then the response status code should be 200
7277
And the JSON should be equal to:

0 commit comments

Comments
 (0)