Skip to content

Commit cc34af9

Browse files
authored
Merge pull request #1924 from teohhanhui/revert-merge-master-into-2.2-no-rewriting-history
Revert merge master into 2.2
2 parents 654e42e + 12aeb64 commit cc34af9

File tree

160 files changed

+1022
-2476
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+1022
-2476
lines changed

.travis.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ script:
7373
- if [[ $lint != 1 ]]; then
7474
tests/Fixtures/app/console api:swagger:export > swagger.json && npx swagger-cli validate swagger.json && rm swagger.json;
7575
fi
76-
- if [[ $lint != 1 ]]; then
77-
tests/Fixtures/app/console api:swagger:export --yaml > swagger.yaml && npx swagger-cli validate --no-schema swagger.yaml && rm swagger.yaml;
78-
fi
7976
- if [[ $lint = 1 ]]; then
8077
php php-cs-fixer.phar fix --dry-run --diff --no-ansi;
8178
fi

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
* Add support for the immutable date and time types introduced in Doctrine
7676
* Fix the Doctrine query generated to retrieve nested subresources
7777
* Fix several bugs in the automatic eager loading support
78-
* Fix a bug occurring when passing neither an IRI nor an array in an embedded relation
78+
* Fix a bug occurring when passing nor an IRI nor an array in an embedded relation
7979
* Allow to request `0` items per page in collections
8080
* Also copy the `Host` from the Symfony Router
8181
* `Paginator::getLastPage()` now always returns a `float`

CONTRIBUTING.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ First of all, thank you for contributing, you're awesome!
44

55
To have your code integrated in the API Platform project, there is some rules to follow, but don't panic, it's easy!
66

7-
## Reporting Bugs
7+
## Reporting bugs
88

99
If you happen to find a bug, we kindly request you to report it. However, before submitting it, please:
1010

@@ -27,10 +27,11 @@ publicly**. We will disclose details of the issue and credit you after having re
2727

2828
### Writing a Pull Request
2929

30-
First of all, you must decide on what branch your changes will be based depending of the nature of the change.
31-
See [the dedicated documentation entry](https://api-platform.com/docs/extra/releases/).
30+
First of all, you must decide on what branch your changes will be based. If the changes your are going to make are
31+
fully backward-compatible, you should base your changes on the latest stable branch (`2.0` at the moment).
32+
Otherwise, you should base your changes on the `master` branch.
3233

33-
### Matching Coding Standards
34+
### Matching coding standards
3435

3536
The API Platform project follows [Symfony coding standards](https://symfony.com/doc/current/contributing/code/standards.html).
3637
But don't worry, you can fix CS issues automatically using the [PHP CS Fixer](http://cs.sensiolabs.org/) tool
@@ -51,7 +52,7 @@ When you send a PR, just make sure that:
5152
* You make a PR on the related documentation in the [api-platform/docs](https://github.com/api-platform/docs) repository.
5253
* You make the PR on the same branch you based your changes on. If you see commits
5354
that you did not make in your PR, you're doing it wrong.
54-
* Also don't forget to add a comment when you update a PR with a ping to [the maintainers](https://github.com/orgs/api-platform/people), so he/she will get a notification.
55+
* Also don't forget to add a comment when you update a PR with a ping to the maintainer (`@dunglas`, `@sroze` or `@theofidry`), so he/she will get a notification.
5556
* Squash your commits into one commit. (see the next chapter)
5657

5758
All Pull Requests must include [this header](.github/PULL_REQUEST_TEMPLATE.md).
@@ -62,7 +63,7 @@ On `api-platform/core` there are two kinds of tests: unit (`phpunit`) and integr
6263

6364
Both `phpunit` and `behat` are development dependencies and should be available in the `vendor` directory.
6465

65-
#### Phpunit and Coverage Generation
66+
#### Phpunit and coverage generation
6667

6768
To launch unit tests:
6869

@@ -92,7 +93,13 @@ The command to launch Behat tests is:
9293
./vendor/bin/behat --suite=default --stop-on-failure -vvv
9394
```
9495

95-
## Squash your Commits
96+
You may need to clear the cache manually before running behat tests because of the temporary sql database. To do so, just remove the `test` cache directory:
97+
98+
```
99+
rm -r tests/Fixtures/app/cache/test
100+
```
101+
102+
## Squash your commits
96103

97104
If you have 3 commits. So start with:
98105

@@ -120,7 +127,7 @@ Now force push to update your PR:
120127
git push --force
121128
```
122129

123-
# License and Copyright Attribution
130+
# License and copyright attribution
124131

125132
When you open a Pull Request to the API Platform project, you agree to license your code under the [MIT license](LICENSE)
126133
and to transfer the copyright on the submitted code to Kévin Dunglas.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT license
22

3-
Copyright (c) 2015-present Kévin Dunglas
3+
Copyright (c) 2015 Kévin Dunglas
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

composer.json

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
"behat/symfony2-extension": "^2.1.1",
3434
"behatch/contexts": "^3.1",
3535
"doctrine/annotations": "^1.2",
36-
"doctrine/doctrine-bundle": "^1.8",
36+
"doctrine/doctrine-bundle": "^1.6.3",
3737
"doctrine/orm": "^2.5.2",
38-
"friendsofsymfony/user-bundle": "^2.1",
38+
"friendsofsymfony/user-bundle": "^2.0",
3939
"guzzlehttp/guzzle": "^6.0",
4040
"justinrainbow/json-schema": "^5.0",
4141
"nelmio/api-doc-bundle": "^2.13.3",
@@ -44,46 +44,41 @@
4444
"phpdocumentor/type-resolver": "^0.2.1 || ^0.3 || 0.4",
4545
"phpunit/phpunit": "^6.1",
4646
"psr/log": "^1.0",
47-
"ramsey/uuid": "^3.7",
48-
"ramsey/uuid-doctrine": "^1.4",
4947
"sensio/framework-extra-bundle": "^3.0.11 || ^4.0",
5048
"symfony/asset": "^3.3 || ^4.0",
5149
"symfony/cache": "^3.3 || ^4.0",
52-
"symfony/config": "^3.4 || ^4.0",
53-
"symfony/console": "^3.4 || ^4.0",
50+
"symfony/config": "^3.3 || ^4.0",
51+
"symfony/console": "^3.3 || ^4.0",
5452
"symfony/debug": "^2.8 || ^3.0 || ^4.0",
55-
"symfony/dependency-injection": "^3.4 || ^4.0",
53+
"symfony/dependency-injection": "^3.3 || ^4.0",
5654
"symfony/doctrine-bridge": "^2.8.12 || ^3.0 || ^4.0",
57-
"symfony/event-dispatcher": "^3.4 || ^4.0",
55+
"symfony/event-dispatcher": "^3.3 || ^4.0",
5856
"symfony/expression-language": "^2.8 || ^3.0 || ^4.0",
5957
"symfony/finder": "^3.3 || ^4.0",
6058
"symfony/form": "^3.3 || ^4.0",
6159
"symfony/framework-bundle": "^3.3 || ^4.0",
6260
"symfony/phpunit-bridge": "^3.3 || ^4.0",
6361
"symfony/routing": "^3.3 || ^4.0",
6462
"symfony/security": "^3.0 || ^4.0",
65-
"symfony/security-bundle": "^3.4 || ^4.0",
66-
"symfony/twig-bundle": "^3.4 || ^4.0",
63+
"symfony/security-bundle": "^3.0 || ^4.0",
64+
"symfony/twig-bundle": "^3.1 || ^4.0",
6765
"symfony/validator": "^3.3 || ^4.0",
68-
"symfony/web-profiler-bundle": "^3.3 || ^4.0",
6966
"symfony/yaml": "^3.3 || ^4.0",
7067
"webonyx/graphql-php": "^0.11.5"
7168
},
7269
"conflict": {
73-
"symfony/dependency-injection": "<3.4"
70+
"symfony/dependency-injection": "<3.3"
7471
},
7572
"suggest": {
7673
"friendsofsymfony/user-bundle": "To use the FOSUserBundle bridge.",
7774
"guzzlehttp/guzzle": "To use the HTTP cache invalidation system.",
7875
"phpdocumentor/reflection-docblock": "To support extracting metadata from PHPDoc.",
7976
"psr/cache-implementation": "To use metadata caching.",
80-
"ramsey/uuid": "To support Ramsey's UUID identifiers.",
8177
"symfony/cache": "To have metadata caching when using Symfony integration.",
8278
"symfony/config": "To load XML configuration files.",
8379
"symfony/expression-language": "To use authorization features.",
8480
"symfony/security": "To use authorization features.",
8581
"symfony/twig-bundle": "To use the Swagger UI integration.",
86-
"symfony/web-profiler-bundle": "To use the data collector.",
8782
"webonyx/graphql-php": "To support GraphQL."
8883
},
8984
"autoload": {
@@ -94,7 +89,7 @@
9489
},
9590
"extra": {
9691
"branch-alias": {
97-
"dev-master": "2.3.x-dev"
92+
"dev-master": "2.2.x-dev"
9893
}
9994
},
10095
"config": {

features/authorization/deny.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ Feature: Authorization checking
6565
Then the response status code should be 403
6666
And the response should be in JSON
6767

68+
@dropSchema
6869
Scenario: An user can retrieve an item he owns
6970
When I add "Accept" header equal to "application/ld+json"
7071
And I add "Authorization" header equal to "Basic ZHVuZ2xhczprZXZpbg=="

features/bootstrap/FeatureContext.php

Lines changed: 8 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,11 @@
3333
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\FileConfigDummy;
3434
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\Foo;
3535
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\FooDummy;
36-
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\FourthLevel;
3736
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\Node;
3837
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\Person;
3938
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\PersonToPet;
4039
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\Pet;
4140
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\Question;
42-
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\RamseyUuidDummy;
4341
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\RelatedDummy;
4442
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\RelatedToDummyFriend;
4543
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\RelationEmbedder;
@@ -111,10 +109,17 @@ public function removeAcceptHeaderBeforeScenario()
111109
* @BeforeScenario @createSchema
112110
*/
113111
public function createDatabase()
112+
{
113+
$this->schemaTool->createSchema($this->classes);
114+
}
115+
116+
/**
117+
* @AfterScenario @dropSchema
118+
*/
119+
public function dropDatabase()
114120
{
115121
$this->schemaTool->dropSchema($this->classes);
116122
$this->doctrine->getManager()->clear();
117-
$this->schemaTool->createSchema($this->classes);
118123
}
119124

120125
/**
@@ -733,7 +738,6 @@ public function thereIsARelatedDummyWithFriends(int $nb)
733738
$relatedDummy2->setName('RelatedDummy without friends');
734739
$this->manager->persist($relatedDummy2);
735740
$this->manager->flush();
736-
$this->manager->clear();
737741
}
738742

739743
/**
@@ -873,50 +877,4 @@ public function thereAreDummyImmutableDateObjectsWithDummyDate(int $nb)
873877

874878
$this->manager->flush();
875879
}
876-
877-
/**
878-
* @Given there is a ramsey identified resource with uuid :uuid
879-
*/
880-
public function thereIsARamseyIdentifiedResource(string $uuid)
881-
{
882-
$dummy = new RamseyUuidDummy();
883-
$dummy->setId($uuid);
884-
885-
$this->manager->persist($dummy);
886-
$this->manager->flush();
887-
}
888-
889-
/**
890-
* @Given there is a dummy object with a fourth level relation
891-
*/
892-
public function thereIsADummyObjectWithAFourthLevelRelation()
893-
{
894-
$fourthLevel = new FourthLevel();
895-
$fourthLevel->setLevel(4);
896-
$this->manager->persist($fourthLevel);
897-
898-
$thirdLevel = new ThirdLevel();
899-
$thirdLevel->setLevel(3);
900-
$thirdLevel->setFourthLevel($fourthLevel);
901-
$this->manager->persist($thirdLevel);
902-
903-
$namedRelatedDummy = new RelatedDummy();
904-
$namedRelatedDummy->setName('Hello');
905-
$namedRelatedDummy->setThirdLevel($thirdLevel);
906-
$this->manager->persist($namedRelatedDummy);
907-
908-
$relatedDummy = new RelatedDummy();
909-
$relatedDummy = new RelatedDummy();
910-
$relatedDummy->setThirdLevel($thirdLevel);
911-
$this->manager->persist($relatedDummy);
912-
913-
$dummy = new Dummy();
914-
$dummy->setName('Dummy with relations');
915-
$dummy->setRelatedDummy($namedRelatedDummy);
916-
$dummy->addRelatedDummy($namedRelatedDummy);
917-
$dummy->addRelatedDummy($relatedDummy);
918-
$this->manager->persist($dummy);
919-
920-
$this->manager->flush();
921-
}
922880
}

features/doctrine/boolean_filter.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ Feature: Boolean filter on collections
370370
"""
371371
And the JSON node "hydra:totalItems" should be equal to 15
372372

373+
@dropSchema
373374
Scenario: Get collection filtered by non valid properties
374375
When I send a "GET" request to "/dummies?unknown=0"
375376
Then the response status code should be 200

features/doctrine/date_filter.feature

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ Feature: Date filter on collections
264264
}
265265
"""
266266

267+
@dropSchema
267268
Scenario: Get collection filtered by association date
268269
Given there are 30 dummy objects with dummyDate and relatedDummy
269270
When I send a "GET" request to "/dummies?relatedDummy.dummyDate[after]=2015-04-28"
@@ -383,6 +384,7 @@ Feature: Date filter on collections
383384
}
384385
"""
385386

387+
@dropSchema
386388
@createSchema
387389
Scenario: Get collection filtered by association date
388390
Given there are 2 dummy objects with dummyDate and relatedDummy
@@ -676,6 +678,7 @@ Feature: Date filter on collections
676678
}
677679
"""
678680

681+
@dropSchema
679682
@createSchema
680683
Scenario: Get collection filtered by date that is not a datetime
681684
Given there are 30 dummydate objects with dummyDate
@@ -684,6 +687,7 @@ Feature: Date filter on collections
684687
And the JSON node "hydra:totalItems" should be equal to 3
685688
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
686689

690+
@dropSchema
687691
@createSchema
688692
Scenario: Get collection filtered by date that is an immutable date variant
689693
Given there are 30 dummyimmutabledate objects with dummyDate
@@ -692,6 +696,7 @@ Feature: Date filter on collections
692696
And the JSON node "hydra:totalItems" should be equal to 3
693697
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
694698

699+
@dropSchema
695700
@createSchema
696701
Scenario: Get collection filtered by embedded date
697702
Given there are 2 embedded dummy objects with dummyDate and embeddedDummy

features/doctrine/exists_filter.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Feature: Exists filter on collections
3434
}
3535
"""
3636

37+
@dropSchema
3738
Scenario: Get collection where exists does exist
3839
When I send a "GET" request to "/dummies?dummyBoolean[exists]=1"
3940
Then the response status code should be 200

features/doctrine/multiple_filter.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Feature: Multiple filters on collections
44
I need to retrieve collections filtered by multiple parameters
55

66
@createSchema
7+
@dropSchema
78
Scenario: Get collection filtered by multiple parameters
89
Given there are 30 dummy objects with dummyDate and dummyBoolean true
910
And there are 20 dummy objects with dummyDate and dummyBoolean false

features/doctrine/numeric_filter.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ Feature: Numeric filter on collections
4747
}
4848
"""
4949

50+
@dropSchema
5051
Scenario: Get collection by non-numeric dummyPrice=marty
5152
Given there are 10 dummy objects with dummyPrice
5253
When I send a "GET" request to "/dummies?dummyPrice=marty"

features/doctrine/order_filter.feature

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,7 @@ Feature: Order filter on collections
598598
}
599599
"""
600600

601+
@dropSchema
601602
Scenario: Get collection ordered by a non valid properties and on which order filter has been enabled in whitelist mode
602603
When I send a "GET" request to "/dummies?order[alias]=asc"
603604
Then the response status code should be 200
@@ -832,6 +833,7 @@ Feature: Order filter on collections
832833
"""
833834

834835
@createSchema
836+
@dropSchema
835837
Scenario: Get collection ordered in descending order on a related property
836838
Given there are 2 dummy objects with relatedDummy
837839
When I send a "GET" request to "/dummies?order[relatedDummy.name]=desc"

features/doctrine/range_filter.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ Feature: Range filter on collections
344344
}
345345
"""
346346

347+
@dropSchema
347348
Scenario: Filter for entities within an impossible range
348349
When I send a "GET" request to "/dummies?dummyPrice[gt]=19.99"
349350
Then the response status code should be 200

0 commit comments

Comments
 (0)