Skip to content

Commit c8262c6

Browse files
author
abluchet
committed
debug2
1 parent 3ed6c7d commit c8262c6

File tree

8 files changed

+64
-9
lines changed

8 files changed

+64
-9
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ install:
4949

5050
script:
5151
- if [[ $coverage = 1 ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-php build/cov/coverage-phpunit.cov; else vendor/bin/phpunit; fi
52-
- if [[ $coverage = 1 ]]; then for f in $(find features -name '*.feature'); do FEATURE=${f//\//_} phpdbg -qrr vendor/bin/behat --format=progress --profile coverage $f || exit $?; done; elif [[ $postgres = 1 ]]; then vendor/bin/behat --stop-on-failure; else vendor/bin/behat --format=progress; fi
52+
- if [[ $coverage = 1 ]]; then for f in $(find features -name '*.feature'); do FEATURE=${f//\//_} phpdbg -qrr vendor/bin/behat --tags ~@postgres --format=progress --profile coverage $f || exit $?; done; elif [[ $postgres = 1 ]]; then vendor/bin/behat --tags ~@sqlite --stop-on-failure; else vendor/bin/behat --tags ~@postgres --format=progress; fi
5353
- if [[ $coverage = 1 ]]; then phpdbg -qrr phpcov.phar merge --clover build/logs/clover.xml build/cov; fi
5454
- tests/Fixtures/app/console api:swagger:export > swagger.json && swagger validate swagger.json && rm swagger.json
5555
- if [[ $lint = 1 ]]; then php php-cs-fixer.phar fix --dry-run --diff --no-ansi; fi

features/doctrine/numeric_filter.feature

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# None of these tests have something to do with the numeric filter
2+
# indeed they're only testing searchFilter with numeric values
3+
# the only numeric filters are on properties dummyFloat and dummyPrice
4+
# and none of the above is tested in this file
5+
# Testing on postgresql made searching `id=9.99` bug since `id` is an integer
6+
# @TODO move this stuff to search fitler + do numeric tests
7+
# @TODO remove the sqlite tag by:
8+
# - skipping incorrect search filters on numeric database types?
9+
# - fixing that $field === 'id' stuff in SearchFilter? (since when `id` is always the index key)
10+
@sqlite
111
Feature: Numeric filter on collections
212
In order to retrieve ordered large collections of resources
313
As a client software developer
@@ -7,7 +17,8 @@ Feature: Numeric filter on collections
717
Scenario: Get collection by id equals 9.99 which is not possible
818
Given there is "30" dummy objects
919
When I send a "GET" request to "/dummies?id=9.99"
10-
Then the response status code should be 200
20+
Then print last JSON response
21+
And the response status code should be 200
1122
And the response should be in JSON
1223
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
1324
And the JSON should be valid according to this schema:
@@ -35,7 +46,8 @@ Feature: Numeric filter on collections
3546

3647
Scenario: Get collection by id 10
3748
When I send a "GET" request to "/dummies?id=10"
38-
Then the response status code should be 200
49+
Then print last JSON response
50+
And the response status code should be 200
3951
And the response should be in JSON
4052
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
4153
And the JSON should be valid according to this schema:

features/doctrine/search_filter.feature

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ Feature: Search filter on collections
211211
}
212212
"""
213213

214+
@sqlite
214215
Scenario: Search collection by description (word_start)
215216
When I send a "GET" request to "/dummies?description=smart"
216217
Then the response status code should be 200
@@ -250,6 +251,47 @@ Feature: Search filter on collections
250251
}
251252
"""
252253

254+
# note on Postgres compared to sqlite the LIKE clause is case sensitive
255+
@postgres
256+
Scenario: Search collection by description (word_start)
257+
When I send a "GET" request to "/dummies?description=smart"
258+
Then the response status code should be 200
259+
And the response should be in JSON
260+
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
261+
And the JSON should be valid according to this schema:
262+
"""
263+
{
264+
"type": "object",
265+
"properties": {
266+
"@context": {"pattern": "^/contexts/Dummy$"},
267+
"@id": {"pattern": "^/dummies$"},
268+
"@type": {"pattern": "^hydra:Collection$"},
269+
"hydra:member": {
270+
"type": "array",
271+
"items": {
272+
"type": "object",
273+
"properties": {
274+
"@id": {
275+
"oneOf": [
276+
{"pattern": "^/dummies/2$"},
277+
{"pattern": "^/dummies/4$"},
278+
{"pattern": "^/dummies/6$"}
279+
]
280+
}
281+
}
282+
}
283+
},
284+
"hydra:view": {
285+
"type": "object",
286+
"properties": {
287+
"@id": {"pattern": "^/dummies\\?description=smart"},
288+
"@type": {"pattern": "^hydra:PartialCollectionView$"}
289+
}
290+
}
291+
}
292+
}
293+
"""
294+
253295
@dropSchema
254296
Scenario: Search for entities within an impossible range
255297
When I send a "GET" request to "/dummies?name=MuYm"

features/http_cache/tags.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@sqlite
12
Feature: Cache invalidation through HTTP Cache tags
23
In order to have a fast API
34
As an API software developer

features/integration/fos_user.feature

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ Feature: FOSUser integration
1515
"plainPassword": "azerty"
1616
}
1717
"""
18-
Then print last JSON response
19-
And the response status code should be 201
18+
Then the response status code should be 201
2019
And the response should be in JSON
2120
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
2221
And the JSON should be equal to:

tests/Fixtures/TestBundle/Entity/User.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
* A User.
2424
*
2525
* @ORM\Entity
26+
* @ORM\Table(name="user_test")
2627
* @ApiResource(attributes={
2728
* "normalization_context"={"groups"={"user", "user-read"}},
2829
* "denormalization_context"={"groups"={"user", "user-write"}}

tests/Fixtures/app/config/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ doctrine:
2828
charset: 'UTF8'
2929
postgres:
3030
driver: 'pdo_pgsql'
31-
dbname: 'api_platform_test'
31+
dbname: 'postgres'
3232
user: 'postgres'
33-
password: ''
34-
host: 'localhost'
33+
password: 'api-platform'
34+
host: '172.17.0.2'
3535

3636
orm:
3737
auto_generate_proxy_classes: '%kernel.debug%'
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
parameters:
2-
default_connection: sqlite
2+
default_connection: postgres

0 commit comments

Comments
 (0)