diff --git a/api/.env.test b/api/.env.test new file mode 100644 index 000000000..d0486867e --- /dev/null +++ b/api/.env.test @@ -0,0 +1,5 @@ +# define your env variables for the test env here +KERNEL_CLASS='App\Kernel' +APP_SECRET='$ecretf0rt3st' +SYMFONY_DEPRECATIONS_HELPER=999999 +PANTHER_APP_ENV=panther diff --git a/api/.gitignore b/api/.gitignore index a8b65d607..b4ad98905 100755 --- a/api/.gitignore +++ b/api/.gitignore @@ -1,3 +1,7 @@ +/helm/api/charts +/helm/api/requirements.lock +/coverage + ###> symfony/framework-bundle ### /.env.local /.env.local.php @@ -7,14 +11,17 @@ /vendor/ ###< symfony/framework-bundle ### -###> behat/symfony2-extension ### -behat.yml -###< behat/symfony2-extension ### - -/helm/api/charts -/helm/api/requirements.lock -/coverage - ###> lexik/jwt-authentication-bundle ### /config/jwt/*.pem ###< lexik/jwt-authentication-bundle ### + +###> symfony/phpunit-bridge ### +.phpunit +.phpunit.result.cache +/phpunit.xml +###< symfony/phpunit-bridge ### + +###> friendsofphp/php-cs-fixer ### +/.php_cs +/.php_cs.cache +###< friendsofphp/php-cs-fixer ### diff --git a/api/.php_cs.cache b/api/.php_cs.cache deleted file mode 100644 index b38c7f551..000000000 --- a/api/.php_cs.cache +++ /dev/null @@ -1 +0,0 @@ -{"php":"7.2.6","version":"2.11.1","rules":{"blank_line_after_namespace":true,"braces":true,"class_definition":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_constants":true,"lowercase_keywords":true,"method_argument_space":{"ensure_fully_multiline":true},"no_break_comment":true,"no_closing_tag":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"visibility_required":true,"encoding":true,"full_opening_tag":true},"hashes":{"src\/\/Entity\/Book.php":3743908103,"src\/\/Entity\/Review.php":4281022700,"src\/\/Kernel.php":740139742}} \ No newline at end of file diff --git a/api/.php_cs.dist b/api/.php_cs.dist new file mode 100644 index 000000000..afe11185d --- /dev/null +++ b/api/.php_cs.dist @@ -0,0 +1,14 @@ +in(__DIR__) + ->exclude('var') +; + +return PhpCsFixer\Config::create() + ->setRules([ + '@Symfony' => true, + 'array_syntax' => ['syntax' => 'short'], + ]) + ->setFinder($finder) +; diff --git a/api/Dockerfile b/api/Dockerfile index 6f80b08be..5df6cfe46 100644 --- a/api/Dockerfile +++ b/api/Dockerfile @@ -65,6 +65,9 @@ RUN version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \ COPY --from=composer:latest /usr/bin/composer /usr/bin/composer COPY docker/php/php.ini /usr/local/etc/php/php.ini +# Workaround to allow using PHPUnit 8 with Symfony 4.3 +ENV SYMFONY_PHPUNIT_VERSION=8.3 + # https://getcomposer.org/doc/03-cli.md#composer-allow-superuser ENV COMPOSER_ALLOW_SUPERUSER=1 # install Symfony Flex globally to speed up download of Composer packages (parallelized prefetching) diff --git a/api/behat.yml.dist b/api/behat.yml.dist deleted file mode 100644 index cef64fb60..000000000 --- a/api/behat.yml.dist +++ /dev/null @@ -1,48 +0,0 @@ -default: - calls: - error_reporting: 16383 # E_ALL & ~E_USER_DREPRECATED - suites: - default: - contexts: - - FeatureContext: { doctrine: "@doctrine" } - - BookContext: { doctrine: "@doctrine" } - - Behat\MinkExtension\Context\MinkContext - - Behatch\Context\RestContext - - Behatch\Context\JsonContext - - extensions: - Behat\Symfony2Extension: - kernel: - bootstrap: features/bootstrap/bootstrap.php - class: App\Kernel - Behat\MinkExtension: - base_url: "https://localhost/" - sessions: - default: - symfony2: ~ - Behatch\Extension: ~ - -coverage: - calls: - error_reporting: 16383 # E_ALL & ~E_USER_DREPRECATED - suites: - default: - contexts: - - FeatureContext: { doctrine: "@doctrine" } - - BookContext: { doctrine: "@doctrine" } - - Behat\MinkExtension\Context\MinkContext - - Behatch\Context\RestContext - - Behatch\Context\JsonContext - - CoverageContext - - extensions: - Behat\Symfony2Extension: - kernel: - bootstrap: features/bootstrap/bootstrap.php - class: App\Kernel - Behat\MinkExtension: - base_url: "https://localhost/" - sessions: - default: - symfony2: ~ - Behatch\Extension: ~ diff --git a/api/bin/phpunit b/api/bin/phpunit new file mode 100755 index 000000000..4d1ed05d3 --- /dev/null +++ b/api/bin/phpunit @@ -0,0 +1,13 @@ +#!/usr/bin/env php +=5.3.3", - "psr/container": "^1.0", - "symfony/class-loader": "~2.1||~3.0", - "symfony/config": "~2.3||~3.0||~4.0", - "symfony/console": "~2.7.40||^2.8.33||~3.3.15||^3.4.3||^4.0.3", - "symfony/dependency-injection": "~2.1||~3.0||~4.0", - "symfony/event-dispatcher": "~2.1||~3.0||~4.0", - "symfony/translation": "~2.3||~3.0||~4.0", - "symfony/yaml": "~2.1||~3.0||~4.0" + "php": "^5.3.2 || ^7.0" }, "require-dev": { - "herrera-io/box": "~1.6.1", - "phpunit/phpunit": "^4.8.36|^6.3", - "symfony/process": "~2.5|~3.0|~4.0" + "phpunit/phpunit": "^4.5 || ^5.0.5", + "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" }, - "bin": [ - "bin/behat" - ], "type": "library", "extra": { "branch-alias": { - "dev-master": "3.5.x-dev" + "dev-master": "1.x-dev" } }, "autoload": { - "psr-0": { - "Behat\\Behat": "src/", - "Behat\\Testwork": "src/" + "psr-4": { + "Composer\\Semver\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -6211,63 +6193,55 @@ ], "authors": [ { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" } ], - "description": "Scenario-oriented BDD framework for PHP 5.3", - "homepage": "http://behat.org/", + "description": "Semver library that offers utilities, version constraint parsing and validation.", "keywords": [ - "Agile", - "BDD", - "ScenarioBDD", - "Scrum", - "StoryBDD", - "User story", - "business", - "development", - "documentation", - "examples", - "symfony", - "testing" + "semantic", + "semver", + "validation", + "versioning" ], - "time": "2018-08-10T18:56:51+00:00" + "time": "2019-03-19T17:25:45+00:00" }, { - "name": "behat/gherkin", - "version": "v4.6.0", + "name": "composer/xdebug-handler", + "version": "1.3.3", "source": { "type": "git", - "url": "https://github.com/Behat/Gherkin.git", - "reference": "ab0a02ea14893860bca00f225f5621d351a3ad07" + "url": "https://github.com/composer/xdebug-handler.git", + "reference": "46867cbf8ca9fb8d60c506895449eb799db1184f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Behat/Gherkin/zipball/ab0a02ea14893860bca00f225f5621d351a3ad07", - "reference": "ab0a02ea14893860bca00f225f5621d351a3ad07", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/46867cbf8ca9fb8d60c506895449eb799db1184f", + "reference": "46867cbf8ca9fb8d60c506895449eb799db1184f", "shasum": "" }, "require": { - "php": ">=5.3.1" + "php": "^5.3.2 || ^7.0", + "psr/log": "^1.0" }, "require-dev": { - "phpunit/phpunit": "~4.5|~5", - "symfony/phpunit-bridge": "~2.7|~3|~4", - "symfony/yaml": "~2.3|~3|~4" - }, - "suggest": { - "symfony/yaml": "If you want to parse features, represented in YAML files" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.4-dev" - } - }, "autoload": { - "psr-0": { - "Behat\\Gherkin": "src/" + "psr-4": { + "Composer\\XdebugHandler\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -6276,59 +6250,58 @@ ], "authors": [ { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" + "name": "John Stevenson", + "email": "john-stevenson@blueyonder.co.uk" } ], - "description": "Gherkin DSL parser for PHP 5.3", - "homepage": "http://behat.org/", + "description": "Restarts a process without xdebug.", "keywords": [ - "BDD", - "Behat", - "Cucumber", - "DSL", - "gherkin", - "parser" + "Xdebug", + "performance" ], - "time": "2019-01-16T14:22:17+00:00" + "time": "2019-05-27T17:52:04+00:00" }, { - "name": "behat/mink", - "version": "v1.7.1", + "name": "doctrine/data-fixtures", + "version": "v1.3.2", "source": { "type": "git", - "url": "https://github.com/minkphp/Mink.git", - "reference": "e6930b9c74693dff7f4e58577e1b1743399f3ff9" + "url": "https://github.com/doctrine/data-fixtures.git", + "reference": "09b16943b27f3d80d63988d100ff256148c2f78b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/minkphp/Mink/zipball/e6930b9c74693dff7f4e58577e1b1743399f3ff9", - "reference": "e6930b9c74693dff7f4e58577e1b1743399f3ff9", + "url": "https://api.github.com/repos/doctrine/data-fixtures/zipball/09b16943b27f3d80d63988d100ff256148c2f78b", + "reference": "09b16943b27f3d80d63988d100ff256148c2f78b", "shasum": "" }, "require": { - "php": ">=5.3.1", - "symfony/css-selector": "~2.1|~3.0" + "doctrine/common": "~2.2", + "php": "^7.1" + }, + "conflict": { + "doctrine/phpcr-odm": "<1.3.0" }, "require-dev": { - "symfony/phpunit-bridge": "~2.7|~3.0" + "doctrine/dbal": "^2.5.4", + "doctrine/orm": "^2.5.4", + "phpunit/phpunit": "^7.0" }, "suggest": { - "behat/mink-browserkit-driver": "extremely fast headless driver for Symfony\\Kernel-based apps (Sf2, Silex)", - "behat/mink-goutte-driver": "fast headless driver for any app without JS emulation", - "behat/mink-selenium2-driver": "slow, but JS-enabled driver for any app (requires Selenium2)", - "behat/mink-zombie-driver": "fast and JS-enabled headless driver for any app (requires node.js)" + "alcaeus/mongo-php-adapter": "For using MongoDB ODM with PHP 7", + "doctrine/mongodb-odm": "For loading MongoDB ODM fixtures", + "doctrine/orm": "For loading ORM fixtures", + "doctrine/phpcr-odm": "For loading PHPCR ODM fixtures" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.7.x-dev" + "dev-master": "1.3.x-dev" } }, "autoload": { "psr-4": { - "Behat\\Mink\\": "src/" + "Doctrine\\Common\\DataFixtures\\": "lib/Doctrine/Common/DataFixtures" } }, "notification-url": "https://packagist.org/downloads/", @@ -6337,54 +6310,88 @@ ], "authors": [ { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" } ], - "description": "Browser controller/emulator abstraction for PHP", - "homepage": "http://mink.behat.org/", + "description": "Data Fixtures for all Doctrine Object Managers", + "homepage": "http://www.doctrine-project.org", "keywords": [ - "browser", - "testing", - "web" + "database" ], - "time": "2016-03-05T08:26:18+00:00" + "time": "2019-07-10T18:30:35+00:00" }, { - "name": "behat/mink-browserkit-driver", - "version": "1.3.3", + "name": "friendsofphp/php-cs-fixer", + "version": "v2.15.3", "source": { "type": "git", - "url": "https://github.com/minkphp/MinkBrowserKitDriver.git", - "reference": "1b9a7ce903cfdaaec5fb32bfdbb26118343662eb" + "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", + "reference": "705490b0f282f21017d73561e9498d2b622ee34c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/minkphp/MinkBrowserKitDriver/zipball/1b9a7ce903cfdaaec5fb32bfdbb26118343662eb", - "reference": "1b9a7ce903cfdaaec5fb32bfdbb26118343662eb", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/705490b0f282f21017d73561e9498d2b622ee34c", + "reference": "705490b0f282f21017d73561e9498d2b622ee34c", "shasum": "" }, "require": { - "behat/mink": "^1.7.1@dev", - "php": ">=5.3.6", - "symfony/browser-kit": "~2.3|~3.0|~4.0", - "symfony/dom-crawler": "~2.3|~3.0|~4.0" + "composer/semver": "^1.4", + "composer/xdebug-handler": "^1.2", + "doctrine/annotations": "^1.2", + "ext-json": "*", + "ext-tokenizer": "*", + "php": "^5.6 || ^7.0", + "php-cs-fixer/diff": "^1.3", + "symfony/console": "^3.4.17 || ^4.1.6", + "symfony/event-dispatcher": "^3.0 || ^4.0", + "symfony/filesystem": "^3.0 || ^4.0", + "symfony/finder": "^3.0 || ^4.0", + "symfony/options-resolver": "^3.0 || ^4.0", + "symfony/polyfill-php70": "^1.0", + "symfony/polyfill-php72": "^1.4", + "symfony/process": "^3.0 || ^4.0", + "symfony/stopwatch": "^3.0 || ^4.0" }, "require-dev": { - "mink/driver-testsuite": "dev-master", - "symfony/http-kernel": "~2.3|~3.0|~4.0" + "johnkary/phpunit-speedtrap": "^1.1 || ^2.0 || ^3.0", + "justinrainbow/json-schema": "^5.0", + "keradus/cli-executor": "^1.2", + "mikey179/vfsstream": "^1.6", + "php-coveralls/php-coveralls": "^2.1", + "php-cs-fixer/accessible-object": "^1.0", + "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.1", + "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.1", + "phpunit/phpunit": "^5.7.27 || ^6.5.14 || ^7.1", + "phpunitgoodpractices/traits": "^1.8", + "symfony/phpunit-bridge": "^4.3", + "symfony/yaml": "^3.0 || ^4.0" }, - "type": "mink-driver", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } + "suggest": { + "ext-mbstring": "For handling non-UTF8 characters in cache signature.", + "php-cs-fixer/phpunit-constraint-isidenticalstring": "For IsIdenticalString constraint.", + "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "For XmlMatchesXsd constraint.", + "symfony/polyfill-mbstring": "When enabling `ext-mbstring` is not possible." }, + "bin": [ + "php-cs-fixer" + ], + "type": "application", "autoload": { "psr-4": { - "Behat\\Mink\\Driver\\": "src/" - } + "PhpCsFixer\\": "src/" + }, + "classmap": [ + "tests/Test/AbstractFixerTestCase.php", + "tests/Test/AbstractIntegrationCaseFactory.php", + "tests/Test/AbstractIntegrationTestCase.php", + "tests/Test/Assert/AssertTokensTrait.php", + "tests/Test/IntegrationCase.php", + "tests/Test/IntegrationCaseFactory.php", + "tests/Test/IntegrationCaseFactoryInterface.php", + "tests/Test/InternalIntegrationCaseFactory.php", + "tests/TestCase.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -6392,54 +6399,48 @@ ], "authors": [ { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Dariusz Rumiński", + "email": "dariusz.ruminski@gmail.com" } ], - "description": "Symfony2 BrowserKit driver for Mink framework", - "homepage": "http://mink.behat.org/", - "keywords": [ - "Mink", - "Symfony2", - "browser", - "testing" - ], - "time": "2018-05-02T09:25:31+00:00" + "description": "A tool to automatically fix PHP code style", + "time": "2019-08-31T12:51:54+00:00" }, { - "name": "behat/mink-extension", - "version": "2.3.1", + "name": "fzaninotto/faker", + "version": "v1.8.0", "source": { "type": "git", - "url": "https://github.com/Behat/MinkExtension.git", - "reference": "80f7849ba53867181b7e412df9210e12fba50177" + "url": "https://github.com/fzaninotto/Faker.git", + "reference": "f72816b43e74063c8b10357394b6bba8cb1c10de" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Behat/MinkExtension/zipball/80f7849ba53867181b7e412df9210e12fba50177", - "reference": "80f7849ba53867181b7e412df9210e12fba50177", + "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/f72816b43e74063c8b10357394b6bba8cb1c10de", + "reference": "f72816b43e74063c8b10357394b6bba8cb1c10de", "shasum": "" }, "require": { - "behat/behat": "^3.0.5", - "behat/mink": "^1.5", - "php": ">=5.3.2", - "symfony/config": "^2.7|^3.0|^4.0" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "behat/mink-goutte-driver": "^1.1", - "phpspec/phpspec": "^2.0" + "ext-intl": "*", + "phpunit/phpunit": "^4.8.35 || ^5.7", + "squizlabs/php_codesniffer": "^1.5" }, - "type": "behat-extension", + "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1.x-dev" + "dev-master": "1.8-dev" } }, "autoload": { - "psr-0": { - "Behat\\MinkExtension": "src/" + "psr-4": { + "Faker\\": "src/Faker/" } }, "notification-url": "https://packagist.org/downloads/", @@ -6448,60 +6449,58 @@ ], "authors": [ { - "name": "Christophe Coevoet", - "email": "stof@notk.org" - }, - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com" + "name": "François Zaninotto" } ], - "description": "Mink extension for Behat", - "homepage": "http://extensions.behat.org/mink", + "description": "Faker is a PHP library that generates fake data for you.", "keywords": [ - "browser", - "gui", - "test", - "web" + "data", + "faker", + "fixtures" ], - "time": "2018-02-06T15:36:30+00:00" + "time": "2018-07-12T10:23:15+00:00" }, { - "name": "behat/symfony2-extension", - "version": "2.1.5", + "name": "hautelook/alice-bundle", + "version": "v2.5.1", "source": { "type": "git", - "url": "https://github.com/Behat/Symfony2Extension.git", - "reference": "d7c834487426a784665f9c1e61132274dbf2ea26" + "url": "https://github.com/hautelook/AliceBundle.git", + "reference": "a4d25ba319b551d14082cd7e9916f5ddcd8bc0f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Behat/Symfony2Extension/zipball/d7c834487426a784665f9c1e61132274dbf2ea26", - "reference": "d7c834487426a784665f9c1e61132274dbf2ea26", + "url": "https://api.github.com/repos/hautelook/AliceBundle/zipball/a4d25ba319b551d14082cd7e9916f5ddcd8bc0f2", + "reference": "a4d25ba319b551d14082cd7e9916f5ddcd8bc0f2", "shasum": "" }, "require": { - "behat/behat": "^3.4.3", - "php": ">=5.3.3", - "symfony/framework-bundle": "~2.0|~3.0|~4.0" + "doctrine/data-fixtures": "^1.2", + "doctrine/doctrine-bundle": "^1.8", + "doctrine/orm": "^2.5.11", + "php": "^7.1", + "psr/log": "^1.0", + "symfony/finder": "^3.4 || ^4.0", + "symfony/framework-bundle": "^3.4 || ^4.0", + "theofidry/alice-data-fixtures": "^1.0" }, "require-dev": { - "behat/mink": "~1.7@dev", - "behat/mink-browserkit-driver": "~1.3@dev", - "behat/mink-extension": "~2.0", - "phpspec/phpspec": "~2.0|~3.0|~4.0", - "phpunit/phpunit": "~4.0|~5.0", - "symfony/symfony": "~2.1|~3.0|~4.0" - }, - "type": "behat-extension", + "doctrine/persistence": "^1.0", + "phpspec/prophecy": "^1.7", + "phpunit/phpunit": "^7.0", + "symfony/phpunit-bridge": "^3.4 || ^4.0" + }, + "type": "symfony-bundle", "extra": { "branch-alias": { - "dev-master": "2.1.x-dev" - } + "dev-master": "2.x-dev" + }, + "bin-dir": "bin", + "sort-packages": true }, "autoload": { - "psr-0": { - "Behat\\Symfony2Extension": "src/" + "psr-4": { + "Hautelook\\AliceBundle\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -6510,471 +6509,163 @@ ], "authors": [ { - "name": "Christophe Coevoet", - "email": "stof@notk.org" + "name": "Baldur Rensch", + "email": "brensch@gmail.com" }, { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com" + "name": "Théo FIDRY", + "email": "theo.fidry@gmail.com", + "homepage": "https://github.com/theofidry" } ], - "description": "Symfony2 framework extension for Behat", - "homepage": "http://behat.org", + "description": "Symfony bundle to manage fixtures with Alice and Faker.", "keywords": [ - "BDD", - "framework", + "Fixture", + "alice", + "faker", + "orm", "symfony" ], - "time": "2018-04-20T15:48:23+00:00" + "time": "2019-08-04T18:39:27+00:00" }, { - "name": "behat/transliterator", - "version": "v1.2.0", + "name": "justinrainbow/json-schema", + "version": "5.2.8", "source": { "type": "git", - "url": "https://github.com/Behat/Transliterator.git", - "reference": "826ce7e9c2a6664c0d1f381cbb38b1fb80a7ee2c" + "url": "https://github.com/justinrainbow/json-schema.git", + "reference": "dcb6e1006bb5fd1e392b4daa68932880f37550d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Behat/Transliterator/zipball/826ce7e9c2a6664c0d1f381cbb38b1fb80a7ee2c", - "reference": "826ce7e9c2a6664c0d1f381cbb38b1fb80a7ee2c", + "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/dcb6e1006bb5fd1e392b4daa68932880f37550d4", + "reference": "dcb6e1006bb5fd1e392b4daa68932880f37550d4", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { - "chuyskywalker/rolling-curl": "^3.1", - "php-yaoi/php-yaoi": "^1.0" + "friendsofphp/php-cs-fixer": "~2.2.20", + "json-schema/json-schema-test-suite": "1.2.0", + "phpunit/phpunit": "^4.8.35" }, + "bin": [ + "bin/validate-json" + ], "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2-dev" + "dev-master": "5.0.x-dev" } }, "autoload": { - "psr-0": { - "Behat\\Transliterator": "src/" + "psr-4": { + "JsonSchema\\": "src/JsonSchema/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "Artistic-1.0" + "MIT" + ], + "authors": [ + { + "name": "Bruno Prieto Reis", + "email": "bruno.p.reis@gmail.com" + }, + { + "name": "Justin Rainbow", + "email": "justin.rainbow@gmail.com" + }, + { + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" + }, + { + "name": "Robert Schönthal", + "email": "seroscho@googlemail.com" + } ], - "description": "String transliterator", + "description": "A library to validate a json schema.", + "homepage": "https://github.com/justinrainbow/json-schema", "keywords": [ - "i18n", - "slug", - "transliterator" + "json", + "schema" ], - "time": "2017-04-04T11:38:05+00:00" + "time": "2019-01-14T23:55:14+00:00" }, { - "name": "behatch/contexts", - "version": "3.2.0", + "name": "myclabs/deep-copy", + "version": "1.9.3", "source": { "type": "git", - "url": "https://github.com/Behatch/contexts.git", - "reference": "cbda31e1f83423f267ebb56d0d45e849ecac6dc2" + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Behatch/contexts/zipball/cbda31e1f83423f267ebb56d0d45e849ecac6dc2", - "reference": "cbda31e1f83423f267ebb56d0d45e849ecac6dc2", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/007c053ae6f31bba39dfa19a7726f56e9763bbea", + "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea", "shasum": "" }, "require": { - "behat/behat": "^3.0.13", - "behat/mink-extension": "^2.3.1", - "justinrainbow/json-schema": "^5.0", - "php": ">=5.5", - "symfony/dom-crawler": "^2.4|^3.0|^4.0", - "symfony/http-foundation": "^2.3|^3.0|^4.0", - "symfony/property-access": "^2.3|^3.0|^4.0" + "php": "^7.1" }, "replace": { - "sanpi/behatch-contexts": "self.version" + "myclabs/deep-copy": "self.version" }, "require-dev": { - "atoum/atoum": "^2.8|^3.0", - "behat/mink-goutte-driver": "^1.1", - "behat/mink-selenium2-driver": "^1.3", - "fabpot/goutte": "^3.2", - "guzzlehttp/guzzle": "^6.3" + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^7.1" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, "autoload": { "psr-4": { - "Behatch\\": "src/" - } + "DeepCopy\\": "src/DeepCopy/" + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "beerware" + "MIT" ], - "description": "Behatch contexts", + "description": "Create deep copies (clones) of your objects", "keywords": [ - "BDD", - "Behat", - "Context", - "Symfony2" + "clone", + "copy", + "duplicate", + "object", + "object graph" ], - "time": "2018-08-13T16:31:50+00:00" + "time": "2019-08-09T12:45:53+00:00" }, { - "name": "container-interop/container-interop", - "version": "1.2.0", + "name": "nelmio/alice", + "version": "v3.5.7", "source": { "type": "git", - "url": "https://github.com/container-interop/container-interop.git", - "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8" + "url": "https://github.com/nelmio/alice.git", + "reference": "8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/container-interop/container-interop/zipball/79cbf1341c22ec75643d841642dd5d6acd83bdb8", - "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8", + "url": "https://api.github.com/repos/nelmio/alice/zipball/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce", + "reference": "8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce", "shasum": "" }, "require": { - "psr/container": "^1.0" + "fzaninotto/faker": "^1.6", + "myclabs/deep-copy": "^1.5.2", + "php": "^7.1", + "sebastian/comparator": "^3.0", + "symfony/property-access": "^2.8 || ^3.4 || ^4.0", + "symfony/yaml": "^2.8 || ^3.4 || ^4.0" }, - "type": "library", - "autoload": { - "psr-4": { - "Interop\\Container\\": "src/Interop/Container/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", - "homepage": "https://github.com/container-interop/container-interop", - "time": "2017-02-14T19:40:03+00:00" - }, - { - "name": "doctrine/data-fixtures", - "version": "v1.3.2", - "source": { - "type": "git", - "url": "https://github.com/doctrine/data-fixtures.git", - "reference": "09b16943b27f3d80d63988d100ff256148c2f78b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/data-fixtures/zipball/09b16943b27f3d80d63988d100ff256148c2f78b", - "reference": "09b16943b27f3d80d63988d100ff256148c2f78b", - "shasum": "" - }, - "require": { - "doctrine/common": "~2.2", - "php": "^7.1" - }, - "conflict": { - "doctrine/phpcr-odm": "<1.3.0" - }, - "require-dev": { - "doctrine/dbal": "^2.5.4", - "doctrine/orm": "^2.5.4", - "phpunit/phpunit": "^7.0" - }, - "suggest": { - "alcaeus/mongo-php-adapter": "For using MongoDB ODM with PHP 7", - "doctrine/mongodb-odm": "For loading MongoDB ODM fixtures", - "doctrine/orm": "For loading ORM fixtures", - "doctrine/phpcr-odm": "For loading PHPCR ODM fixtures" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Common\\DataFixtures\\": "lib/Doctrine/Common/DataFixtures" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - } - ], - "description": "Data Fixtures for all Doctrine Object Managers", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "database" - ], - "time": "2019-07-10T18:30:35+00:00" - }, - { - "name": "fzaninotto/faker", - "version": "v1.8.0", - "source": { - "type": "git", - "url": "https://github.com/fzaninotto/Faker.git", - "reference": "f72816b43e74063c8b10357394b6bba8cb1c10de" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/f72816b43e74063c8b10357394b6bba8cb1c10de", - "reference": "f72816b43e74063c8b10357394b6bba8cb1c10de", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "ext-intl": "*", - "phpunit/phpunit": "^4.8.35 || ^5.7", - "squizlabs/php_codesniffer": "^1.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.8-dev" - } - }, - "autoload": { - "psr-4": { - "Faker\\": "src/Faker/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "François Zaninotto" - } - ], - "description": "Faker is a PHP library that generates fake data for you.", - "keywords": [ - "data", - "faker", - "fixtures" - ], - "time": "2018-07-12T10:23:15+00:00" - }, - { - "name": "hautelook/alice-bundle", - "version": "v2.5.1", - "source": { - "type": "git", - "url": "https://github.com/hautelook/AliceBundle.git", - "reference": "a4d25ba319b551d14082cd7e9916f5ddcd8bc0f2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/hautelook/AliceBundle/zipball/a4d25ba319b551d14082cd7e9916f5ddcd8bc0f2", - "reference": "a4d25ba319b551d14082cd7e9916f5ddcd8bc0f2", - "shasum": "" - }, - "require": { - "doctrine/data-fixtures": "^1.2", - "doctrine/doctrine-bundle": "^1.8", - "doctrine/orm": "^2.5.11", - "php": "^7.1", - "psr/log": "^1.0", - "symfony/finder": "^3.4 || ^4.0", - "symfony/framework-bundle": "^3.4 || ^4.0", - "theofidry/alice-data-fixtures": "^1.0" - }, - "require-dev": { - "doctrine/persistence": "^1.0", - "phpspec/prophecy": "^1.7", - "phpunit/phpunit": "^7.0", - "symfony/phpunit-bridge": "^3.4 || ^4.0" - }, - "type": "symfony-bundle", - "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - }, - "bin-dir": "bin", - "sort-packages": true - }, - "autoload": { - "psr-4": { - "Hautelook\\AliceBundle\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Baldur Rensch", - "email": "brensch@gmail.com" - }, - { - "name": "Théo FIDRY", - "email": "theo.fidry@gmail.com", - "homepage": "https://github.com/theofidry" - } - ], - "description": "Symfony bundle to manage fixtures with Alice and Faker.", - "keywords": [ - "Fixture", - "alice", - "faker", - "orm", - "symfony" - ], - "time": "2019-08-04T18:39:27+00:00" - }, - { - "name": "justinrainbow/json-schema", - "version": "5.2.8", - "source": { - "type": "git", - "url": "https://github.com/justinrainbow/json-schema.git", - "reference": "dcb6e1006bb5fd1e392b4daa68932880f37550d4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/dcb6e1006bb5fd1e392b4daa68932880f37550d4", - "reference": "dcb6e1006bb5fd1e392b4daa68932880f37550d4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "~2.2.20", - "json-schema/json-schema-test-suite": "1.2.0", - "phpunit/phpunit": "^4.8.35" - }, - "bin": [ - "bin/validate-json" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "JsonSchema\\": "src/JsonSchema/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bruno Prieto Reis", - "email": "bruno.p.reis@gmail.com" - }, - { - "name": "Justin Rainbow", - "email": "justin.rainbow@gmail.com" - }, - { - "name": "Igor Wiedler", - "email": "igor@wiedler.ch" - }, - { - "name": "Robert Schönthal", - "email": "seroscho@googlemail.com" - } - ], - "description": "A library to validate a json schema.", - "homepage": "https://github.com/justinrainbow/json-schema", - "keywords": [ - "json", - "schema" - ], - "time": "2019-01-14T23:55:14+00:00" - }, - { - "name": "myclabs/deep-copy", - "version": "1.9.3", - "source": { - "type": "git", - "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/007c053ae6f31bba39dfa19a7726f56e9763bbea", - "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "replace": { - "myclabs/deep-copy": "self.version" - }, - "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^7.1" - }, - "type": "library", - "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, - "files": [ - "src/DeepCopy/deep_copy.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Create deep copies (clones) of your objects", - "keywords": [ - "clone", - "copy", - "duplicate", - "object", - "object graph" - ], - "time": "2019-08-09T12:45:53+00:00" - }, - { - "name": "nelmio/alice", - "version": "v3.5.7", - "source": { - "type": "git", - "url": "https://github.com/nelmio/alice.git", - "reference": "8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nelmio/alice/zipball/8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce", - "reference": "8bb64f0fe13f6675f0d07ca11ce5c3676f02a9ce", - "shasum": "" - }, - "require": { - "fzaninotto/faker": "^1.6", - "myclabs/deep-copy": "^1.5.2", - "php": "^7.1", - "sebastian/comparator": "^3.0", - "symfony/property-access": "^2.8 || ^3.4 || ^4.0", - "symfony/yaml": "^2.8 || ^3.4 || ^4.0" - }, - "conflict": { - "symfony/framework-bundle": "<3.4" + "conflict": { + "symfony/framework-bundle": "<3.4" }, "require-dev": { "bamarni/composer-bin-plugin": "^1.1.0", @@ -7082,6 +6773,57 @@ ], "time": "2019-09-01T07:51:21+00:00" }, + { + "name": "php-cs-fixer/diff", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/PHP-CS-Fixer/diff.git", + "reference": "78bb099e9c16361126c86ce82ec4405ebab8e756" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/78bb099e9c16361126c86ce82ec4405ebab8e756", + "reference": "78bb099e9c16361126c86ce82ec4405ebab8e756", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7.23 || ^6.4.3", + "symfony/process": "^3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "SpacePossum" + } + ], + "description": "sebastian/diff v2 backport support for PHP5.6", + "homepage": "https://github.com/PHP-CS-Fixer", + "keywords": [ + "diff" + ], + "time": "2018-02-15T16:58:55+00:00" + }, { "name": "phpunit/php-code-coverage", "version": "7.0.8", @@ -7726,38 +7468,31 @@ "time": "2019-08-26T08:26:39+00:00" }, { - "name": "symfony/class-loader", - "version": "v3.4.31", + "name": "symfony/css-selector", + "version": "v4.3.4", "source": { "type": "git", - "url": "https://github.com/symfony/class-loader.git", - "reference": "e212b06996819a2bce026a63da03b7182d05a690" + "url": "https://github.com/symfony/css-selector.git", + "reference": "c6e5e2a00db768c92c3ae131532af4e1acc7bd03" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/class-loader/zipball/e212b06996819a2bce026a63da03b7182d05a690", - "reference": "e212b06996819a2bce026a63da03b7182d05a690", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/c6e5e2a00db768c92c3ae131532af4e1acc7bd03", + "reference": "c6e5e2a00db768c92c3ae131532af4e1acc7bd03", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" - }, - "require-dev": { - "symfony/finder": "~2.8|~3.0|~4.0", - "symfony/polyfill-apcu": "~1.1" - }, - "suggest": { - "symfony/polyfill-apcu": "For using ApcClassLoader on HHVM" + "php": "^7.1.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "4.3-dev" } }, "autoload": { "psr-4": { - "Symfony\\Component\\ClassLoader\\": "" + "Symfony\\Component\\CssSelector\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -7772,59 +7507,10 @@ "name": "Fabien Potencier", "email": "fabien@symfony.com" }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony ClassLoader Component", - "homepage": "https://symfony.com", - "time": "2019-08-20T13:31:17+00:00" - }, - { - "name": "symfony/css-selector", - "version": "v3.4.21", - "source": { - "type": "git", - "url": "https://github.com/symfony/css-selector.git", - "reference": "12f86295c46c36af9896cf21db6b6b8a1465315d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/12f86295c46c36af9896cf21db6b6b8a1465315d", - "reference": "12f86295c46c36af9896cf21db6b6b8a1465315d", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\CssSelector\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ { "name": "Jean-François Simon", "email": "jeanfrancois.simon@sensiolabs.com" }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" @@ -7832,7 +7518,7 @@ ], "description": "Symfony CssSelector Component", "homepage": "https://symfony.com", - "time": "2019-01-02T09:30:52+00:00" + "time": "2019-08-20T14:07:54+00:00" }, { "name": "symfony/dom-crawler", @@ -7963,6 +7649,174 @@ ], "time": "2019-08-18T17:34:03+00:00" }, + { + "name": "symfony/options-resolver", + "version": "v4.3.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/options-resolver.git", + "reference": "81c2e120522a42f623233968244baebd6b36cb6a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/81c2e120522a42f623233968244baebd6b36cb6a", + "reference": "81c2e120522a42f623233968244baebd6b36cb6a", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\OptionsResolver\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony OptionsResolver Component", + "homepage": "https://symfony.com", + "keywords": [ + "config", + "configuration", + "options" + ], + "time": "2019-08-08T09:29:19+00:00" + }, + { + "name": "symfony/phpunit-bridge", + "version": "v4.3.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/phpunit-bridge.git", + "reference": "3b1ab2e027d7c5af0e693c4a5b4ba5d407f1814d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/3b1ab2e027d7c5af0e693c4a5b4ba5d407f1814d", + "reference": "3b1ab2e027d7c5af0e693c4a5b4ba5d407f1814d", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "conflict": { + "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0" + }, + "suggest": { + "symfony/debug": "For tracking deprecated interfaces usages at runtime with DebugClassLoader" + }, + "bin": [ + "bin/simple-phpunit" + ], + "type": "symfony-bridge", + "extra": { + "branch-alias": { + "dev-master": "4.3-dev" + }, + "thanks": { + "name": "phpunit/phpunit", + "url": "https://github.com/sebastianbergmann/phpunit" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Bridge\\PhpUnit\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony PHPUnit Bridge", + "homepage": "https://symfony.com", + "time": "2019-08-20T14:27:59+00:00" + }, + { + "name": "symfony/process", + "version": "v4.3.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "e89969c00d762349f078db1128506f7f3dcc0d4a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/e89969c00d762349f078db1128506f7f3dcc0d4a", + "reference": "e89969c00d762349f078db1128506f7f3dcc0d4a", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Process Component", + "homepage": "https://symfony.com", + "time": "2019-08-26T08:26:39+00:00" + }, { "name": "symfony/profiler-pack", "version": "v1.0.4", @@ -7991,6 +7845,34 @@ "description": "A pack for the Symfony web profiler", "time": "2018-12-10T12:11:44+00:00" }, + { + "name": "symfony/test-pack", + "version": "v1.0.6", + "source": { + "type": "git", + "url": "https://github.com/symfony/test-pack.git", + "reference": "ff87e800a67d06c423389f77b8209bc9dc469def" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/test-pack/zipball/ff87e800a67d06c423389f77b8209bc9dc469def", + "reference": "ff87e800a67d06c423389f77b8209bc9dc469def", + "shasum": "" + }, + "require": { + "php": "^7.0", + "symfony/browser-kit": "*", + "symfony/css-selector": "*", + "symfony/phpunit-bridge": "*" + }, + "type": "symfony-pack", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A pack for functional and end-to-end testing within a Symfony app", + "time": "2019-06-21T06:27:32+00:00" + }, { "name": "symfony/var-dumper", "version": "v4.3.4", diff --git a/api/config/bootstrap.php b/api/config/bootstrap.php index f6afb4042..1ba3a57a9 100644 --- a/api/config/bootstrap.php +++ b/api/config/bootstrap.php @@ -13,7 +13,7 @@ throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.'); } else { // load all the .env files - (new Dotenv())->loadEnv(dirname(__DIR__).'/.env'); + (new Dotenv(true))->loadEnv(dirname(__DIR__).'/.env'); } $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev'; diff --git a/api/config/packages/security.yaml b/api/config/packages/security.yaml index ad4b34039..a81d05d38 100755 --- a/api/config/packages/security.yaml +++ b/api/config/packages/security.yaml @@ -1,7 +1,7 @@ security: encoders: App\Entity\User: - algorithm: argon2i + algorithm: auto # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers providers: diff --git a/api/features/books.feature b/api/features/books.feature deleted file mode 100644 index dfefd8f47..000000000 --- a/api/features/books.feature +++ /dev/null @@ -1,28 +0,0 @@ -Feature: Manage books and their reviews - In order to manage books and their reviews - As a client software developer - I need to be able to retrieve, create, update and delete them trough the API. - - Scenario: Create a book - When I create a book - Then I see a book - - Scenario: Retrieve the book list - Given there is a book - When I get a list of books - Then I see a list of books - - Scenario: Throw errors when a post is invalid - Given there is a book - When I create a book with invalid data - Then the request is invalid - - Scenario: Add a review - Given there is a book - When I create a review - Then I see a review - - Scenario: Get reviews by book - Given there is a book with a review - When I get a list of reviews filtered by book - Then I see a list of reviews diff --git a/api/features/bootstrap/BookContext.php b/api/features/bootstrap/BookContext.php deleted file mode 100644 index 63cebaa82..000000000 --- a/api/features/bootstrap/BookContext.php +++ /dev/null @@ -1,472 +0,0 @@ -doctrine = $doctrine; - } - - /** - * @BeforeScenario - */ - public function gatherContexts(BeforeScenarioScope $scope) - { - $this->restContext = $scope->getEnvironment()->getContext(RestContext::class); - $this->minkContext = $scope->getEnvironment()->getContext(MinkContext::class); - $this->jsonContext = $scope->getEnvironment()->getContext(JsonContext::class); - } - - /** - * @When I create a book - */ - public function sendPostRequestToBooks(string $data = null) - { - $this->restContext->iAddHeaderEqualTo('Content-Type', 'application/ld+json'); - $this->restContext->iAddHeaderEqualTo('Accept', 'application/ld+json'); - if (null === $data) { - $data = <<<'JSON' -{ - "isbn": "9781782164104", - "title": "Persistence in PHP with the Doctrine ORM", - "description": "This book is designed for PHP developers and architects who want to modernize their skills through better understanding of Persistence and ORM.", - "author": "Kévin Dunglas", - "publicationDate": "2013-12-01" -} -JSON; - } - $this->restContext->iSendARequestToWithBody('POST', '/books', new PyStringNode([$data], 0)); - } - - /** - * @When I create a book with invalid data - */ - public function sendPostRequestToBooksWithInvalidData() - { - $this->sendPostRequestToBooks(<<<'JSON' -{ - "isbn": "1312", - "title": "", - "description": "This book is designed for PHP developers and architects who want to modernize their skills through better understanding of Persistence and ORM.", - "author": "Kévin Dunglas", - "publicationDate": "2013-12-01" -} -JSON - ); - } - - /** - * @Then I see a book - */ - public function checkPostBooksResponse() - { - $this->minkContext->assertResponseStatus(201); - $this->jsonContext->theResponseShouldBeInJson(); - $this->restContext->theHeaderShouldBeEqualTo('Content-Type', 'application/ld+json; charset=utf-8'); - $this->jsonContext->theJsonShouldBeValidAccordingToThisSchema(new PyStringNode([<<<'JSON' -{ - "type": "object", - "properties": { - "@context": {"pattern": "^/contexts/Book$"}, - "@id": {"pattern": "^/books/[\\w\\-;=]+$"}, - "@type": {"pattern": "^http://schema.org/Book$"}, - "isbn": {"pattern": "^9781782164104$"}, - "title": {"pattern": "^Persistence in PHP with the Doctrine ORM$"}, - "description": {"pattern": "^This book is designed for PHP developers and architects who want to modernize their skills through better understanding of Persistence and ORM.$"}, - "author": {"pattern": "^Kévin Dunglas$"}, - "publicationDate": {"pattern": "^2013\\-12\\-01T00:00:00\\+00:00$"}, - "reviews": { - "type": "array", - "minItems": 0, - "maxItems": 0 - } - } -} -JSON - ], 0)); - } - - /** - * @Then the request is invalid - */ - public function requestIsInvalid() - { - $this->minkContext->assertResponseStatus(400); - $this->jsonContext->theResponseShouldBeInJson(); - $this->restContext->theHeaderShouldBeEqualTo('Content-Type', 'application/ld+json; charset=utf-8'); - $this->jsonContext->theJsonShouldBeEqualTo(new PyStringNode([<<<'JSON' -{ - "@context": "/contexts/ConstraintViolationList", - "@type": "ConstraintViolationList", - "hydra:title": "An error occurred", - "hydra:description": "isbn: This value is neither a valid ISBN-10 nor a valid ISBN-13.\ntitle: This value should not be blank.", - "violations": [ - { - "propertyPath": "isbn", - "message": "This value is neither a valid ISBN-10 nor a valid ISBN-13." - }, - { - "propertyPath": "title", - "message": "This value should not be blank." - } - ] -} -JSON - ], 0)); - } - - /** - * @Given there is a book - */ - public function createBook(bool $persist = true) - { - $book = new Book(); - $book->isbn = '9781782164104'; - $book->title = 'Persistence in PHP with the Doctrine ORM'; - $book->description = 'This book is designed for PHP developers and architects who want to modernize their skills through better understanding of Persistence and ORM.'; - $book->author = 'Kévin Dunglas'; - $book->publicationDate = new \DateTime('2013-12-01'); - - if (true === $persist) { - $em = $this->doctrine->getManager(); - $em->persist($book); - $em->flush(); - } - - return $book; - } - - /** - * @When I get a list of books - */ - public function sendGetRequestToBooks() - { - $this->restContext->iAddHeaderEqualTo('Accept', 'application/ld+json'); - $this->restContext->iSendARequestTo('GET', '/books'); - } - - /** - * @Then I see a list of books - */ - public function checkGetBooksResponse() - { - $this->minkContext->assertResponseStatus(200); - $this->jsonContext->theResponseShouldBeInJson(); - $this->restContext->theHeaderShouldBeEqualTo('Content-Type', 'application/ld+json; charset=utf-8'); - $this->jsonContext->theJsonShouldBeValidAccordingToThisSchema(new PyStringNode([<<<'JSON' -{ - "type": "object", - "properties": { - "@context": {"pattern": "^/contexts/Book$"}, - "@id": {"pattern": "^/books$"}, - "@type": {"pattern": "^hydra:Collection"}, - "hydra:member": { - "type": "array", - "minItems": 1, - "maxItems": 1, - "items": [ - { - "type": "object", - "properties": { - "@id": {"pattern": "^/books/[\\w\\-;=]+$"}, - "@type": {"pattern": "^http://schema.org/Book$"}, - "isbn": {"pattern": "^9781782164104$"}, - "title": {"pattern": "^Persistence in PHP with the Doctrine ORM$"}, - "description": {"pattern": "^This book is designed for PHP developers and architects who want to modernize their skills through better understanding of Persistence and ORM.$"}, - "author": {"pattern": "^Kévin Dunglas$"}, - "publicationDate": {"pattern": "^2013\\-12\\-01T00:00:00\\+00:00$"}, - "reviews": { - "type": "array", - "minItems": 0, - "maxItems": 0 - } - } - } - ] - }, - "hydra:totalItems": {"type": "integer"}, - "hydra:search": { - "type": "object", - "properties": { - "@type": {"pattern": "^hydra:IriTemplate$"}, - "hydra:template": {"pattern": "^/books\\{\\?properties\\[\\]\\,order\\[id\\],order\\[title\\],order\\[author\\],order\\[isbn\\],order\\[publicationDate\\],title,author}$"}, - "hydra:variableRepresentation": {"pattern": "^BasicRepresentation$"}, - "hydra:mapping": { - "type": "array", - "minItems": 8, - "maxItems": 8, - "items": [ - { - "@type": {"pattern": "^IriTemplateMapping$"}, - "variable": {"pattern": "^properties\\[\\]$"}, - "property": {"type": "null"}, - "required": false - }, - { - "@type": {"pattern": "^IriTemplateMapping$"}, - "variable": {"pattern": "^order\\[id\\]$"}, - "property": {"pattern": "^id$"}, - "required": false - }, - { - "@type": {"pattern": "^IriTemplateMapping$"}, - "variable": {"pattern": "^order\\[title\\]$"}, - "property": {"pattern": "^title$"}, - "required": false - }, - { - "@type": {"pattern": "^IriTemplateMapping$"}, - "variable": {"pattern": "^order\\[author\\]$"}, - "property": {"pattern": "^author$"}, - "required": false - }, - { - "@type": {"pattern": "^IriTemplateMapping$"}, - "variable": {"pattern": "^order\\[isbn\\]$"}, - "property": {"pattern": "^isbn$"}, - "required": false - }, - { - "@type": {"pattern": "^IriTemplateMapping$"}, - "variable": {"pattern": "^order\\[publicationDate\\]$"}, - "property": {"pattern": "^publicationDate$"}, - "required": false - }, - { - "@type": {"pattern": "^IriTemplateMapping$"}, - "variable": {"pattern": "^title$"}, - "property": {"pattern": "^title$"}, - "required": false - }, - { - "@type": {"pattern": "^IriTemplateMapping$"}, - "variable": {"pattern": "^author$"}, - "property": {"pattern": "^author$"}, - "required": false - } - ] - } - } - } - } -} -JSON - ], 0)); - } - - /** - * @When I create a review - */ - public function sendPostRequestToReviews() - { - /** @var Book $book */ - $book = $this->doctrine->getRepository(Book::class)->findOneBy([]); - - $this->restContext->iAddHeaderEqualTo('Content-Type', 'application/ld+json'); - $this->restContext->iAddHeaderEqualTo('Accept', 'application/ld+json'); - $this->restContext->iSendARequestToWithBody('POST', '/reviews', new PyStringNode([\sprintf(<<<'JSON' -{ - "rating": 5, - "body": "Must have!", - "author": "Foo Bar", - "publicationDate": "2016-01-01", - "book": "/books/%s" -} -JSON - , $book->getId())], 0)); - } - - /** - * @Then I see a review - */ - public function checkPostReviewssResponse() - { - $this->minkContext->assertResponseStatus(201); - $this->jsonContext->theResponseShouldBeInJson(); - $this->restContext->theHeaderShouldBeEqualTo('Content-Type', 'application/ld+json; charset=utf-8'); - $this->jsonContext->theJsonShouldBeValidAccordingToThisSchema(new PyStringNode([<<<'JSON' -{ - "type": "object", - "properties": { - "@context": {"pattern": "^/contexts/Review$"}, - "@id": {"pattern": "^/reviews/[\\w\\-;=]+$"}, - "@type": {"pattern": "^http://schema.org/Review$"}, - "body": {"pattern": "^Must have!$"}, - "rating": {"type": "integer"}, - "letter": {"type": "null"}, - "author": {"pattern": "^Foo Bar$"}, - "publicationDate": {"pattern": "^2016\\-01\\-01T00:00:00\\+00:00$"}, - "book": { - "type": "object", - "properties": { - "@id": {"pattern": "^/books/[\\w\\-;=]+$"}, - "@type": {"pattern": "^http://schema.org/Book$"}, - "title": {"pattern": "^Persistence in PHP with the Doctrine ORM$"} - } - } - } -} -JSON - ], 0)); - } - - /** - * @Given there is a book with a review - */ - public function createReview() - { - $book = $this->createBook(false); - - $review = new Review(); - $review->setBook($book); - $review->rating = 5; - $review->body = 'Must have!'; - $review->author = 'Foo Bar'; - $review->publicationDate = new \DateTime('2016-01-01'); - - $em = $this->doctrine->getManager(); - $em->persist($review); - $em->persist($book); - $em->flush(); - } - - /** - * @When I get a list of reviews filtered by book - */ - public function sendGetRequestToReviewsFilteredByBook() - { - /** @var Book $book */ - $book = $this->doctrine->getRepository(Book::class)->findOneBy([]); - - $this->restContext->iAddHeaderEqualTo('Accept', 'application/ld+json'); - $this->restContext->iSendARequestTo('GET', '/reviews?book=/books/'.$book->getId()); - } - - /** - * @Then I see a list of reviews - */ - public function checkGetReviewsResponse() - { - $this->minkContext->assertResponseStatus(200); - $this->jsonContext->theResponseShouldBeInJson(); - $this->restContext->theHeaderShouldBeEqualTo('Content-Type', 'application/ld+json; charset=utf-8'); - $this->jsonContext->theJsonShouldBeValidAccordingToThisSchema(new PyStringNode([<<<'JSON' -{ - "type": "object", - "properties": { - "@context": {"pattern": "^/contexts/Review$"}, - "@id": {"pattern": "^/reviews$"}, - "@type": {"pattern": "^hydra:Collection"}, - "hydra:member": { - "type": "array", - "minItems": 1, - "maxItems": 1, - "items": [ - { - "type": "object", - "properties": { - "@id": {"pattern": "^/reviews/[\\w\\-;=]+$"}, - "@type": {"pattern": "^http://schema.org/Review$"}, - "body": {"pattern": "^Must have!$"}, - "rating": {"type": "integer"}, - "letter": {"type": "null"}, - "author": {"pattern": "^Foo Bar$"}, - "publicationDate": {"pattern": "^2016\\-01\\-01T00:00:00\\+00:00$"}, - "book": { - "type": "object", - "properties": { - "@id": {"pattern": "^/books/[\\w\\-;=]+$"}, - "@type": {"pattern": "^http://schema.org/Book$"}, - "title": {"pattern": "^Persistence in PHP with the Doctrine ORM$"} - } - } - } - } - ] - }, - "hydra:totalItems": {"type": "integer"}, - "hydra:view": { - "type": "object", - "properties": { - "@id": {"pattern": "^/reviews\\?book=%2Fbooks%2F[\\w\\-;=]+$"}, - "@type": {"pattern": "^hydra:PartialCollectionView$"} - } - }, - "hydra:search": { - "type": "object", - "properties": { - "@type": {"pattern": "^hydra:IriTemplate$"}, - "hydra:template": {"pattern": "^/reviews{\\?order\\[id\\],order\\[publicationDate\\],book,book\\[\\]}$"}, - "hydra:variableRepresentation": {"pattern": "^BasicRepresentation$"}, - "hydra:mapping": { - "type": "array", - "minItems": 4, - "maxItems": 4, - "items": [ - { - "@type": {"pattern": "^IriTemplateMapping$"}, - "variable": {"pattern": "^order\\[id\\]$"}, - "property": {"pattern": "^id$"}, - "required": false - }, - { - "@type": {"pattern": "^IriTemplateMapping$"}, - "variable": {"pattern": "^order\\[publicationDate\\]$"}, - "property": {"pattern": "^publicationDate$"}, - "required": false - }, - { - "@type": {"pattern": "^IriTemplateMapping$"}, - "variable": {"pattern": "^book$"}, - "property": {"pattern": "^book$"}, - "required": false - }, - { - "@type": {"pattern": "^IriTemplateMapping$"}, - "variable": {"pattern": "^book\\[\\]$"}, - "property": {"pattern": "^book$"}, - "required": false - } - ] - } - } - } - } -} -JSON - ], 0)); - } -} diff --git a/api/features/bootstrap/CoverageContext.php b/api/features/bootstrap/CoverageContext.php deleted file mode 100644 index d2911f892..000000000 --- a/api/features/bootstrap/CoverageContext.php +++ /dev/null @@ -1,59 +0,0 @@ - - * @author Vincent Chalamon - * @copyright Adapted from https://gist.github.com/eliecharra/9c8b3ba57998b50e14a6 - */ -final class CoverageContext implements Context -{ - /** - * @var CodeCoverage - */ - private static $coverage; - - /** - * @BeforeSuite - */ - public static function setup() - { - $filter = new Filter(); - $filter->addDirectoryToWhitelist(__DIR__.'/../../src'); - self::$coverage = new CodeCoverage(null, $filter); - } - - /** - * @AfterSuite - */ - public static function tearDown() - { - (new Facade())->process(self::$coverage, __DIR__.'/../../coverage'); - (new Clover())->process(self::$coverage, __DIR__.'/../../coverage/'.(getenv('FEATURE') ?: 'behat').'.xml'); - } - - /** - * @BeforeScenario - */ - public function startCoverage(BeforeScenarioScope $scope) - { - self::$coverage->start("{$scope->getFeature()->getTitle()}::{$scope->getScenario()->getTitle()}"); - } - - /** - * @AfterScenario - */ - public function stopCoverage() - { - self::$coverage->stop(); - } -} diff --git a/api/features/bootstrap/FeatureContext.php b/api/features/bootstrap/FeatureContext.php deleted file mode 100644 index 5b4865840..000000000 --- a/api/features/bootstrap/FeatureContext.php +++ /dev/null @@ -1,73 +0,0 @@ -doctrine = $doctrine; - $manager = $doctrine->getManager(); - $this->schemaTool = new SchemaTool($manager); - $this->classes = $manager->getMetadataFactory()->getAllMetadata(); - } - - /** - * @BeforeScenario - */ - public function gatherContexts(BeforeScenarioScope $scope) - { - $this->minkContext = $scope->getEnvironment()->getContext(MinkContext::class); - $this->minkContext->getSession()->getDriver()->getClient()->disableReboot(); - } - - /** - * @BeforeScenario - */ - public function createTransaction() - { - $this->doctrine->getConnection()->beginTransaction(); - } - - /** - * @AfterScenario - */ - public function rollbackTransaction() - { - $this->doctrine->getConnection()->rollback(); - } -} diff --git a/api/features/bootstrap/bootstrap.php b/api/features/bootstrap/bootstrap.php deleted file mode 100644 index 0f3ad18d3..000000000 --- a/api/features/bootstrap/bootstrap.php +++ /dev/null @@ -1,4 +0,0 @@ - + + + + + + + + + + + + + + tests + + + + + + src + + + + + + + diff --git a/api/src/Entity/Book.php b/api/src/Entity/Book.php index 2c701ac80..d6f2c7451 100644 --- a/api/src/Entity/Book.php +++ b/api/src/Entity/Book.php @@ -5,6 +5,7 @@ use ApiPlatform\Core\Annotation\ApiFilter; use ApiPlatform\Core\Annotation\ApiProperty; use ApiPlatform\Core\Annotation\ApiResource; +use ApiPlatform\Core\Annotation\ApiSubresource; use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter; use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter; use ApiPlatform\Core\Serializer\Filter\PropertyFilter; @@ -29,7 +30,7 @@ * "get", * "put", * "patch", - * "delete"={"access_control"="is_granted('ROLE_ADMIN')"}, + * "delete"={"security"="is_granted('ROLE_ADMIN')"}, * }, * ) * @ApiFilter(PropertyFilter::class) @@ -92,7 +93,7 @@ class Book /** * @var \DateTimeInterface The date on which the CreativeWork was created or the item was added to a DataFeed * - * @Assert\Date + * @Assert\Type(\DateTimeInterface::class) * @Assert\NotNull * @ORM\Column(type="date") * @Groups("book:read") @@ -106,6 +107,7 @@ class Book * @ORM\OneToMany(targetEntity=Review::class, mappedBy="book", orphanRemoval=true, cascade={"persist", "remove"}) * @Groups("book:read") * @ApiProperty(iri="http://schema.org/reviews") + * @ApiSubresource */ private $reviews; diff --git a/api/symfony.lock b/api/symfony.lock index f239d8a01..fc2fd536c 100644 --- a/api/symfony.lock +++ b/api/symfony.lock @@ -16,48 +16,14 @@ "src/Entity/.gitignore" ] }, - "behat/behat": { - "version": "v3.5.0" - }, - "behat/gherkin": { - "version": "v4.6.0" - }, - "behat/mink": { - "version": "v1.7.1" - }, - "behat/mink-browserkit-driver": { - "version": "1.3.3" - }, - "behat/mink-extension": { - "version": "2.3.1" - }, - "behat/symfony2-extension": { - "version": "2.1", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "master", - "version": "2.1", - "ref": "ff944fc5f8dc1d1c9602968c2c12646c557adbbc" - }, - "files": [ - "behat.yml.dist", - "config/bootstrap.php", - "features/bootstrap/FeatureContext.php", - "features/bootstrap/bootstrap.php", - "features/demo.feature" - ] - }, - "behat/transliterator": { - "version": "v1.2.0" - }, - "behatch/contexts": { - "version": "3.2.0" - }, "composer/ca-bundle": { "version": "1.1.4" }, - "container-interop/container-interop": { - "version": "1.2.0" + "composer/semver": { + "version": "1.5.0" + }, + "composer/xdebug-handler": { + "version": "1.3.3" }, "doctrine/annotations": { "version": "1.0", @@ -137,6 +103,18 @@ "fig/link-util": { "version": "1.0.0" }, + "friendsofphp/php-cs-fixer": { + "version": "2.2", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "master", + "version": "2.2", + "ref": "cc05ab6abf6894bddb9bbd6a252459010ebe040b" + }, + "files": [ + ".php_cs.dist" + ] + }, "fzaninotto/faker": { "version": "v1.8.0" }, @@ -224,6 +202,9 @@ "ocramius/proxy-manager": { "version": "2.2.2" }, + "php-cs-fixer/diff": { + "version": "v1.3.0" + }, "phpdocumentor/reflection-common": { "version": "1.0.1" }, @@ -312,7 +293,7 @@ "version": "v4.2.4" }, "symfony/browser-kit": { - "version": "v4.2.4" + "version": "v4.3.4" }, "symfony/cache": { "version": "v4.2.8" @@ -320,9 +301,6 @@ "symfony/cache-contracts": { "version": "v1.1.5" }, - "symfony/class-loader": { - "version": "v3.4.23" - }, "symfony/config": { "version": "v4.2.4" }, @@ -340,7 +318,7 @@ ] }, "symfony/css-selector": { - "version": "v3.4.21" + "version": "v4.3.4" }, "symfony/debug": { "version": "v4.2.4" @@ -352,7 +330,7 @@ "version": "v4.2.4" }, "symfony/dom-crawler": { - "version": "v4.2.4" + "version": "v4.3.4" }, "symfony/dotenv": { "version": "v4.2.4" @@ -442,6 +420,25 @@ "symfony/mime": { "version": "v4.3.2" }, + "symfony/options-resolver": { + "version": "v4.3.4" + }, + "symfony/phpunit-bridge": { + "version": "4.3", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "master", + "version": "4.3", + "ref": "b0582341f1df39aaf3a9a866cdbe49937da35984" + }, + "files": [ + ".env.test", + "bin/phpunit", + "config/bootstrap.php", + "phpunit.xml.dist", + "tests/.gitignore" + ] + }, "symfony/polyfill-ctype": { "version": "v1.8.0" }, @@ -454,6 +451,9 @@ "symfony/polyfill-php73": { "version": "v1.11.0" }, + "symfony/process": { + "version": "v4.3.4" + }, "symfony/profiler-pack": { "version": "v1.0.4" }, @@ -514,6 +514,9 @@ "symfony/stopwatch": { "version": "v4.2.4" }, + "symfony/test-pack": { + "version": "v1.0.6" + }, "symfony/translation": { "version": "3.3", "recipe": { diff --git a/api/tests/.gitignore b/api/tests/.gitignore new file mode 100644 index 000000000..e69de29bb diff --git a/api/tests/BooksTest.php b/api/tests/BooksTest.php new file mode 100644 index 000000000..7960881d3 --- /dev/null +++ b/api/tests/BooksTest.php @@ -0,0 +1,132 @@ +request('GET', '/books'); + + $this->assertResponseIsSuccessful(); + $this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8'); + + $this->assertJsonContains([ + '@context' => '/contexts/Book', + '@id' => '/books', + '@type' => 'hydra:Collection', + 'hydra:totalItems' => 100, + 'hydra:view' => [ + '@id' => '/books?page=1', + '@type' => 'hydra:PartialCollectionView', + 'hydra:first' => '/books?page=1', + 'hydra:last' => '/books?page=4', + 'hydra:next' => '/books?page=2', + ], + ]); + + // It works because the API returns test fixtures loaded by Alice + $this->assertCount(30, $response->toArray()['hydra:member']); + + // Checks that the returned JSON is validated by the JSON Schema generated for this API Resource by API Platform + // This JSON Schema is also used in the generated OpenAPI spec + $this->assertMatchesResourceCollectionJsonSchema(Book::class); + } + + public function testCreateBook(): void + { + $response = static::createClient()->request('POST', '/books', ['json' => [ + 'isbn' => '0099740915', + 'title' => 'The Handmaid\'s Tale', + 'description' => 'Brilliantly conceived and executed, this powerful evocation of twenty-first century America gives full rein to Margaret Atwood\'s devastating irony, wit and astute perception.', + 'author' => 'Margaret Atwood', + 'publicationDate' => '1985-07-31T00:00:00+00:00', + ]]); + + $this->assertResponseStatusCodeSame(201); + $this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8'); + $this->assertJsonContains([ + '@context' => '/contexts/Book', + '@type' => 'http://schema.org/Book', + 'isbn' => '0099740915', + 'title' => 'The Handmaid\'s Tale', + 'description' => 'Brilliantly conceived and executed, this powerful evocation of twenty-first century America gives full rein to Margaret Atwood\'s devastating irony, wit and astute perception.', + 'author' => 'Margaret Atwood', + 'publicationDate' => '1985-07-31T00:00:00+00:00', + 'reviews' => [], + ]); + $this->assertRegExp('~^/books/[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}$~', $response->toArray()['@id']); + $this->assertMatchesResourceItemJsonSchema(Book::class); + } + + public function testCreateInvalidBook(): void + { + static::createClient()->request('POST', '/books', ['json' => [ + 'isbn' => 'invalid', + ]]); + + $this->assertResponseStatusCodeSame(400); + $this->assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8'); + + $this->assertJsonContains([ + '@context' => '/contexts/ConstraintViolationList', + '@type' => 'ConstraintViolationList', + 'hydra:title' => 'An error occurred', + 'hydra:description' => 'isbn: This value is neither a valid ISBN-10 nor a valid ISBN-13. +title: This value should not be blank. +description: This value should not be blank. +author: This value should not be blank. +publicationDate: This value should not be null.', + ]); + } + + public function testUpdateBook(): void + { + $client = static::createClient(); + $iri = static::findIriBy(Book::class, ['isbn' => '9786644879585']); + + $client->request('PUT', $iri, ['json' => [ + 'title' => 'updated title', + ]]); + + $this->assertResponseIsSuccessful(); + $this->assertJsonContains([ + '@id' => $iri, + 'isbn' => '9786644879585', + 'title' => 'updated title', + ]); + } + + public function testDeleteBook(): void + { + $token = $this->login(); + $client = static::createClient(); + $iri = static::findIriBy(Book::class, ['isbn' => '9786644879585']); + + $client->request('DELETE', $iri, ['auth_bearer' => $token]); + + $this->assertResponseStatusCodeSame(204); + $this->assertNull( + // Through the container, you can access all your services from the tests, including the ORM, the mailer, remote API clients... + static::$container->get('doctrine')->getRepository(Book::class)->findOneBy(['isbn' => '9786644879585']) + ); + } + + private function login(): string + { + $response = static::createClient()->request('POST', '/authentication_token', ['json' => [ + 'email' => 'admin@example.com', + 'password' => 'admin', + ]]); + + return $response->toArray()['token']; + } +} diff --git a/api/tests/ReviewsTest.php b/api/tests/ReviewsTest.php new file mode 100644 index 000000000..ae8a37a09 --- /dev/null +++ b/api/tests/ReviewsTest.php @@ -0,0 +1,32 @@ + '9786644879585']); + + $response = $client->request('GET', "/reviews?book=$iri"); + $this->assertCount(2, $response->toArray()['hydra:member']); + } + + public function testBookSubresource(): void + { + $client = static::createClient(); + $iri = static::findIriBy(Book::class, ['isbn' => '9786644879585']); + + $response = $client->request('GET', "$iri/reviews"); + $this->assertCount(2, $response->toArray()['hydra:member']); + } +} diff --git a/ci/test b/ci/test index aa1d56434..42af34ffb 100755 --- a/ci/test +++ b/ci/test @@ -14,7 +14,7 @@ docker-compose exec php bin/console hautelook:fixtures:load -n docker-compose exec php bin/console doctrine:schema:drop --env=test --force docker-compose exec php bin/console doctrine:schema:create --env=test docker-compose exec php bin/console cache:warmup --env=test -docker-compose exec php vendor/bin/behat --format=progress --no-interaction +docker-compose exec php vendor/bin/simple-phpunit docker-compose exec client yarn install --pure-lockfile docker-compose exec client yarn jest --ci --reporters=default --reporters=jest-junit --passWithNoTests docker-compose exec client yarn eslint src