Skip to content

Commit

Permalink
Merge pull request #1924 from teohhanhui/revert-merge-master-into-2.2…
Browse files Browse the repository at this point in the history
…-no-rewriting-history

Revert merge master into 2.2
  • Loading branch information
soyuka committed May 2, 2018
2 parents 654e42e + 12aeb64 commit cc34af9
Show file tree
Hide file tree
Showing 160 changed files with 1,022 additions and 2,476 deletions.
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ script:
- if [[ $lint != 1 ]]; then
tests/Fixtures/app/console api:swagger:export > swagger.json && npx swagger-cli validate swagger.json && rm swagger.json;
fi
- if [[ $lint != 1 ]]; then
tests/Fixtures/app/console api:swagger:export --yaml > swagger.yaml && npx swagger-cli validate --no-schema swagger.yaml && rm swagger.yaml;
fi
- if [[ $lint = 1 ]]; then
php php-cs-fixer.phar fix --dry-run --diff --no-ansi;
fi
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
* Add support for the immutable date and time types introduced in Doctrine
* Fix the Doctrine query generated to retrieve nested subresources
* Fix several bugs in the automatic eager loading support
* Fix a bug occurring when passing neither an IRI nor an array in an embedded relation
* Fix a bug occurring when passing nor an IRI nor an array in an embedded relation
* Allow to request `0` items per page in collections
* Also copy the `Host` from the Symfony Router
* `Paginator::getLastPage()` now always returns a `float`
Expand Down
23 changes: 15 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ First of all, thank you for contributing, you're awesome!

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

## Reporting Bugs
## Reporting bugs

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

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

### Writing a Pull Request

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

### Matching Coding Standards
### Matching coding standards

The API Platform project follows [Symfony coding standards](https://symfony.com/doc/current/contributing/code/standards.html).
But don't worry, you can fix CS issues automatically using the [PHP CS Fixer](http://cs.sensiolabs.org/) tool
Expand All @@ -51,7 +52,7 @@ When you send a PR, just make sure that:
* You make a PR on the related documentation in the [api-platform/docs](https://github.com/api-platform/docs) repository.
* You make the PR on the same branch you based your changes on. If you see commits
that you did not make in your PR, you're doing it wrong.
* 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.
* 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.
* Squash your commits into one commit. (see the next chapter)

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

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

#### Phpunit and Coverage Generation
#### Phpunit and coverage generation

To launch unit tests:

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

## Squash your Commits
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:

```
rm -r tests/Fixtures/app/cache/test
```

## Squash your commits

If you have 3 commits. So start with:

Expand Down Expand Up @@ -120,7 +127,7 @@ Now force push to update your PR:
git push --force
```

# License and Copyright Attribution
# License and copyright attribution

When you open a Pull Request to the API Platform project, you agree to license your code under the [MIT license](LICENSE)
and to transfer the copyright on the submitted code to Kévin Dunglas.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT license

Copyright (c) 2015-present Kévin Dunglas
Copyright (c) 2015 Kévin Dunglas

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
25 changes: 10 additions & 15 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
"behat/symfony2-extension": "^2.1.1",
"behatch/contexts": "^3.1",
"doctrine/annotations": "^1.2",
"doctrine/doctrine-bundle": "^1.8",
"doctrine/doctrine-bundle": "^1.6.3",
"doctrine/orm": "^2.5.2",
"friendsofsymfony/user-bundle": "^2.1",
"friendsofsymfony/user-bundle": "^2.0",
"guzzlehttp/guzzle": "^6.0",
"justinrainbow/json-schema": "^5.0",
"nelmio/api-doc-bundle": "^2.13.3",
Expand All @@ -44,46 +44,41 @@
"phpdocumentor/type-resolver": "^0.2.1 || ^0.3 || 0.4",
"phpunit/phpunit": "^6.1",
"psr/log": "^1.0",
"ramsey/uuid": "^3.7",
"ramsey/uuid-doctrine": "^1.4",
"sensio/framework-extra-bundle": "^3.0.11 || ^4.0",
"symfony/asset": "^3.3 || ^4.0",
"symfony/cache": "^3.3 || ^4.0",
"symfony/config": "^3.4 || ^4.0",
"symfony/console": "^3.4 || ^4.0",
"symfony/config": "^3.3 || ^4.0",
"symfony/console": "^3.3 || ^4.0",
"symfony/debug": "^2.8 || ^3.0 || ^4.0",
"symfony/dependency-injection": "^3.4 || ^4.0",
"symfony/dependency-injection": "^3.3 || ^4.0",
"symfony/doctrine-bridge": "^2.8.12 || ^3.0 || ^4.0",
"symfony/event-dispatcher": "^3.4 || ^4.0",
"symfony/event-dispatcher": "^3.3 || ^4.0",
"symfony/expression-language": "^2.8 || ^3.0 || ^4.0",
"symfony/finder": "^3.3 || ^4.0",
"symfony/form": "^3.3 || ^4.0",
"symfony/framework-bundle": "^3.3 || ^4.0",
"symfony/phpunit-bridge": "^3.3 || ^4.0",
"symfony/routing": "^3.3 || ^4.0",
"symfony/security": "^3.0 || ^4.0",
"symfony/security-bundle": "^3.4 || ^4.0",
"symfony/twig-bundle": "^3.4 || ^4.0",
"symfony/security-bundle": "^3.0 || ^4.0",
"symfony/twig-bundle": "^3.1 || ^4.0",
"symfony/validator": "^3.3 || ^4.0",
"symfony/web-profiler-bundle": "^3.3 || ^4.0",
"symfony/yaml": "^3.3 || ^4.0",
"webonyx/graphql-php": "^0.11.5"
},
"conflict": {
"symfony/dependency-injection": "<3.4"
"symfony/dependency-injection": "<3.3"
},
"suggest": {
"friendsofsymfony/user-bundle": "To use the FOSUserBundle bridge.",
"guzzlehttp/guzzle": "To use the HTTP cache invalidation system.",
"phpdocumentor/reflection-docblock": "To support extracting metadata from PHPDoc.",
"psr/cache-implementation": "To use metadata caching.",
"ramsey/uuid": "To support Ramsey's UUID identifiers.",
"symfony/cache": "To have metadata caching when using Symfony integration.",
"symfony/config": "To load XML configuration files.",
"symfony/expression-language": "To use authorization features.",
"symfony/security": "To use authorization features.",
"symfony/twig-bundle": "To use the Swagger UI integration.",
"symfony/web-profiler-bundle": "To use the data collector.",
"webonyx/graphql-php": "To support GraphQL."
},
"autoload": {
Expand All @@ -94,7 +89,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "2.3.x-dev"
"dev-master": "2.2.x-dev"
}
},
"config": {
Expand Down
1 change: 1 addition & 0 deletions features/authorization/deny.feature
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ Feature: Authorization checking
Then the response status code should be 403
And the response should be in JSON

@dropSchema
Scenario: An user can retrieve an item he owns
When I add "Accept" header equal to "application/ld+json"
And I add "Authorization" header equal to "Basic ZHVuZ2xhczprZXZpbg=="
Expand Down
58 changes: 8 additions & 50 deletions features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,11 @@
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\FileConfigDummy;
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\Foo;
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\FooDummy;
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\FourthLevel;
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\Node;
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\Person;
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\PersonToPet;
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\Pet;
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\Question;
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\RamseyUuidDummy;
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\RelatedDummy;
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\RelatedToDummyFriend;
use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\RelationEmbedder;
Expand Down Expand Up @@ -111,10 +109,17 @@ public function removeAcceptHeaderBeforeScenario()
* @BeforeScenario @createSchema
*/
public function createDatabase()
{
$this->schemaTool->createSchema($this->classes);
}

/**
* @AfterScenario @dropSchema
*/
public function dropDatabase()
{
$this->schemaTool->dropSchema($this->classes);
$this->doctrine->getManager()->clear();
$this->schemaTool->createSchema($this->classes);
}

/**
Expand Down Expand Up @@ -733,7 +738,6 @@ public function thereIsARelatedDummyWithFriends(int $nb)
$relatedDummy2->setName('RelatedDummy without friends');
$this->manager->persist($relatedDummy2);
$this->manager->flush();
$this->manager->clear();
}

/**
Expand Down Expand Up @@ -873,50 +877,4 @@ public function thereAreDummyImmutableDateObjectsWithDummyDate(int $nb)

$this->manager->flush();
}

/**
* @Given there is a ramsey identified resource with uuid :uuid
*/
public function thereIsARamseyIdentifiedResource(string $uuid)
{
$dummy = new RamseyUuidDummy();
$dummy->setId($uuid);

$this->manager->persist($dummy);
$this->manager->flush();
}

/**
* @Given there is a dummy object with a fourth level relation
*/
public function thereIsADummyObjectWithAFourthLevelRelation()
{
$fourthLevel = new FourthLevel();
$fourthLevel->setLevel(4);
$this->manager->persist($fourthLevel);

$thirdLevel = new ThirdLevel();
$thirdLevel->setLevel(3);
$thirdLevel->setFourthLevel($fourthLevel);
$this->manager->persist($thirdLevel);

$namedRelatedDummy = new RelatedDummy();
$namedRelatedDummy->setName('Hello');
$namedRelatedDummy->setThirdLevel($thirdLevel);
$this->manager->persist($namedRelatedDummy);

$relatedDummy = new RelatedDummy();
$relatedDummy = new RelatedDummy();
$relatedDummy->setThirdLevel($thirdLevel);
$this->manager->persist($relatedDummy);

$dummy = new Dummy();
$dummy->setName('Dummy with relations');
$dummy->setRelatedDummy($namedRelatedDummy);
$dummy->addRelatedDummy($namedRelatedDummy);
$dummy->addRelatedDummy($relatedDummy);
$this->manager->persist($dummy);

$this->manager->flush();
}
}
1 change: 1 addition & 0 deletions features/doctrine/boolean_filter.feature
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ Feature: Boolean filter on collections
"""
And the JSON node "hydra:totalItems" should be equal to 15

@dropSchema
Scenario: Get collection filtered by non valid properties
When I send a "GET" request to "/dummies?unknown=0"
Then the response status code should be 200
Expand Down
5 changes: 5 additions & 0 deletions features/doctrine/date_filter.feature
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ Feature: Date filter on collections
}
"""

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

@dropSchema
@createSchema
Scenario: Get collection filtered by association date
Given there are 2 dummy objects with dummyDate and relatedDummy
Expand Down Expand Up @@ -676,6 +678,7 @@ Feature: Date filter on collections
}
"""

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

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

@dropSchema
@createSchema
Scenario: Get collection filtered by embedded date
Given there are 2 embedded dummy objects with dummyDate and embeddedDummy
Expand Down
1 change: 1 addition & 0 deletions features/doctrine/exists_filter.feature
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Feature: Exists filter on collections
}
"""

@dropSchema
Scenario: Get collection where exists does exist
When I send a "GET" request to "/dummies?dummyBoolean[exists]=1"
Then the response status code should be 200
Expand Down
1 change: 1 addition & 0 deletions features/doctrine/multiple_filter.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Feature: Multiple filters on collections
I need to retrieve collections filtered by multiple parameters

@createSchema
@dropSchema
Scenario: Get collection filtered by multiple parameters
Given there are 30 dummy objects with dummyDate and dummyBoolean true
And there are 20 dummy objects with dummyDate and dummyBoolean false
Expand Down
1 change: 1 addition & 0 deletions features/doctrine/numeric_filter.feature
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Feature: Numeric filter on collections
}
"""

@dropSchema
Scenario: Get collection by non-numeric dummyPrice=marty
Given there are 10 dummy objects with dummyPrice
When I send a "GET" request to "/dummies?dummyPrice=marty"
Expand Down
2 changes: 2 additions & 0 deletions features/doctrine/order_filter.feature
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@ Feature: Order filter on collections
}
"""

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

@createSchema
@dropSchema
Scenario: Get collection ordered in descending order on a related property
Given there are 2 dummy objects with relatedDummy
When I send a "GET" request to "/dummies?order[relatedDummy.name]=desc"
Expand Down
1 change: 1 addition & 0 deletions features/doctrine/range_filter.feature
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ Feature: Range filter on collections
}
"""

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

0 comments on commit cc34af9

Please sign in to comment.