diff --git a/composer.json b/composer.json index d4e4d3c..0779295 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,10 @@ "config": { "optimize-autoloader": true, "preferred-install": "dist", - "sort-packages": true + "sort-packages": true, + "platform": { + "php": "7.1.33" + } }, "autoload": { "files": [ @@ -46,7 +49,7 @@ }, "require-dev": { "phpstan/phpstan": "^0.11.5", - "symfony/browser-kit": "^4.4", - "phpunit/phpunit": "7.5" + "phpunit/phpunit": "7.5", + "symfony/dom-crawler": "^4.4" } } diff --git a/composer.lock b/composer.lock index 6734fbb..424066c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "11bc581c5e40efe7f2494be71ff6cac0", + "content-hash": "b0ae51edb8908e4a3507ca248e514d7a", "packages": [ { "name": "aws/aws-sdk-php", - "version": "3.155.3", + "version": "3.156.0", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "da40d5d22acbe542f37c44c78ee520005a6c81a2" + "reference": "994831c4560d8c309882f5d5b9adafb85748f0e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/da40d5d22acbe542f37c44c78ee520005a6c81a2", - "reference": "da40d5d22acbe542f37c44c78ee520005a6c81a2", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/994831c4560d8c309882f5d5b9adafb85748f0e8", + "reference": "994831c4560d8c309882f5d5b9adafb85748f0e8", "shasum": "" }, "require": { @@ -89,7 +89,7 @@ "s3", "sdk" ], - "time": "2020-09-25T18:12:28+00:00" + "time": "2020-09-29T18:17:44+00:00" }, { "name": "erusev/parsedown", @@ -445,6 +445,16 @@ "Guzzle-Factory", "http" ], + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/graham-campbell/guzzle-factory", + "type": "tidelift" + } + ], "time": "2020-05-02T14:45:48+00:00" }, { @@ -516,23 +526,23 @@ }, { "name": "guzzlehttp/promises", - "version": "v1.3.1", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" + "reference": "60d379c243457e073cff02bc323a2a86cb355631" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "url": "https://api.github.com/repos/guzzle/promises/zipball/60d379c243457e073cff02bc323a2a86cb355631", + "reference": "60d379c243457e073cff02bc323a2a86cb355631", "shasum": "" }, "require": { - "php": ">=5.5.0" + "php": ">=5.5" }, "require-dev": { - "phpunit/phpunit": "^4.0" + "symfony/phpunit-bridge": "^4.4 || ^5.1" }, "type": "library", "extra": { @@ -563,20 +573,20 @@ "keywords": [ "promise" ], - "time": "2016-12-20T10:07:11+00:00" + "time": "2020-09-30T07:37:28+00:00" }, { "name": "guzzlehttp/psr7", - "version": "1.6.1", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "239400de7a173fe9901b9ac7c06497751f00727a" + "reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a", - "reference": "239400de7a173fe9901b9ac7c06497751f00727a", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/53330f47520498c0ae1f61f7e2c90f55690c06a3", + "reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3", "shasum": "" }, "require": { @@ -589,15 +599,15 @@ }, "require-dev": { "ext-zlib": "*", - "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10" }, "suggest": { - "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses" + "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.6-dev" + "dev-master": "1.7-dev" } }, "autoload": { @@ -634,7 +644,7 @@ "uri", "url" ], - "time": "2019-07-01T23:21:34+00:00" + "time": "2020-09-30T07:37:11+00:00" }, { "name": "http-interop/http-factory-guzzle", @@ -757,30 +767,88 @@ "time": "2019-11-02T09:15:47+00:00" }, { - "name": "league/flysystem", - "version": "1.1.3", + "name": "jeremeamia/superclosure", + "version": "2.4.0", "source": { "type": "git", - "url": "https://github.com/thephpleague/flysystem.git", - "reference": "9be3b16c877d477357c015cec057548cf9b2a14a" + "url": "https://github.com/jeremeamia/super_closure.git", + "reference": "5707d5821b30b9a07acfb4d76949784aaa0e9ce9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/9be3b16c877d477357c015cec057548cf9b2a14a", - "reference": "9be3b16c877d477357c015cec057548cf9b2a14a", + "url": "https://api.github.com/repos/jeremeamia/super_closure/zipball/5707d5821b30b9a07acfb4d76949784aaa0e9ce9", + "reference": "5707d5821b30b9a07acfb4d76949784aaa0e9ce9", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^1.2|^2.0|^3.0|^4.0", + "php": ">=5.4", + "symfony/polyfill-php56": "^1.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0|^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "psr-4": { + "SuperClosure\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jeremy Lindblom", + "email": "jeremeamia@gmail.com", + "homepage": "https://github.com/jeremeamia", + "role": "Developer" + } + ], + "description": "Serialize Closure objects, including their context and binding", + "homepage": "https://github.com/jeremeamia/super_closure", + "keywords": [ + "closure", + "function", + "lambda", + "parser", + "serializable", + "serialize", + "tokenizer" + ], + "abandoned": "opis/closure", + "time": "2018-03-21T22:21:57+00:00" + }, + { + "name": "league/flysystem", + "version": "1.0.70", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/flysystem.git", + "reference": "585824702f534f8d3cf7fab7225e8466cc4b7493" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/585824702f534f8d3cf7fab7225e8466cc4b7493", + "reference": "585824702f534f8d3cf7fab7225e8466cc4b7493", "shasum": "" }, "require": { "ext-fileinfo": "*", - "league/mime-type-detection": "^1.3", - "php": "^7.2.5 || ^8.0" + "php": ">=5.5.9" }, "conflict": { "league/flysystem-sftp": "<1.0.6" }, "require-dev": { - "phpspec/prophecy": "^1.11.1", - "phpunit/phpunit": "^8.5.8" + "phpspec/phpspec": "^3.4 || ^4.0 || ^5.0 || ^6.0", + "phpunit/phpunit": "^5.7.26" }, "suggest": { "ext-fileinfo": "Required for MimeType", @@ -839,7 +907,13 @@ "sftp", "storage" ], - "time": "2020-08-23T07:39:11+00:00" + "funding": [ + { + "url": "https://offset.earth/frankdejonge", + "type": "other" + } + ], + "time": "2020-07-26T07:20:36+00:00" }, { "name": "league/flysystem-aws-s3-v3", @@ -929,47 +1003,6 @@ ], "time": "2019-06-07T20:42:16+00:00" }, - { - "name": "league/mime-type-detection", - "version": "1.5.0", - "source": { - "type": "git", - "url": "https://github.com/thephpleague/mime-type-detection.git", - "reference": "ea2fbfc988bade315acd5967e6d02274086d0f28" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/ea2fbfc988bade315acd5967e6d02274086d0f28", - "reference": "ea2fbfc988bade315acd5967e6d02274086d0f28", - "shasum": "" - }, - "require": { - "ext-fileinfo": "*", - "php": "^7.2 || ^8.0" - }, - "require-dev": { - "phpstan/phpstan": "^0.12.36", - "phpunit/phpunit": "^8.5.8" - }, - "type": "library", - "autoload": { - "psr-4": { - "League\\MimeTypeDetection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Frank de Jonge", - "email": "info@frankdejonge.nl" - } - ], - "description": "Mime-type detection for Flysystem", - "time": "2020-09-21T18:10:53+00:00" - }, { "name": "maennchen/zipstream-php", "version": "2.1.0", @@ -1029,6 +1062,12 @@ "stream", "zip" ], + "funding": [ + { + "url": "https://opencollective.com/zipstream", + "type": "open_collective" + } + ], "time": "2020-05-30T13:11:16+00:00" }, { @@ -1194,6 +1233,16 @@ "logging", "psr-3" ], + "funding": [ + { + "url": "https://github.com/Seldaek", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/monolog/monolog", + "type": "tidelift" + } + ], "time": "2020-07-23T08:35:51+00:00" }, { @@ -1346,65 +1395,56 @@ "time": "2018-02-13T20:26:39+00:00" }, { - "name": "opis/closure", - "version": "3.5.7", + "name": "nikic/php-parser", + "version": "v4.10.2", "source": { "type": "git", - "url": "https://github.com/opis/closure.git", - "reference": "4531e53afe2fc660403e76fb7644e95998bff7bf" + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "658f1be311a230e0907f5dfe0213742aff0596de" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opis/closure/zipball/4531e53afe2fc660403e76fb7644e95998bff7bf", - "reference": "4531e53afe2fc660403e76fb7644e95998bff7bf", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/658f1be311a230e0907f5dfe0213742aff0596de", + "reference": "658f1be311a230e0907f5dfe0213742aff0596de", "shasum": "" }, "require": { - "php": "^5.4 || ^7.0" + "ext-tokenizer": "*", + "php": ">=7.0" }, "require-dev": { - "jeremeamia/superclosure": "^2.0", - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" }, + "bin": [ + "bin/php-parse" + ], "type": "library", "extra": { "branch-alias": { - "dev-master": "3.5.x-dev" + "dev-master": "4.9-dev" } }, "autoload": { "psr-4": { - "Opis\\Closure\\": "src/" - }, - "files": [ - "functions.php" - ] + "PhpParser\\": "lib/PhpParser" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Marius Sarca", - "email": "marius.sarca@gmail.com" - }, - { - "name": "Sorin Sarca", - "email": "sarca_sorin@hotmail.com" + "name": "Nikita Popov" } ], - "description": "A library that can be used to serialize closures (anonymous functions) and arbitrary objects.", - "homepage": "https://opis.io/closure", + "description": "A PHP parser written in PHP", "keywords": [ - "anonymous functions", - "closure", - "function", - "serializable", - "serialization", - "serialize" + "parser", + "php" ], - "time": "2020-09-06T17:02:15+00:00" + "time": "2020-09-26T10:30:38+00:00" }, { "name": "paragonie/random_compat", @@ -1453,25 +1493,24 @@ }, { "name": "php-di/invoker", - "version": "2.1.0", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/PHP-DI/Invoker.git", - "reference": "6a6f8f276d2680e77d06294b9fd67b4881b1f82d" + "reference": "540c27c86f663e20fe39a24cd72fa76cdb21d41a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-DI/Invoker/zipball/6a6f8f276d2680e77d06294b9fd67b4881b1f82d", - "reference": "6a6f8f276d2680e77d06294b9fd67b4881b1f82d", + "url": "https://api.github.com/repos/PHP-DI/Invoker/zipball/540c27c86f663e20fe39a24cd72fa76cdb21d41a", + "reference": "540c27c86f663e20fe39a24cd72fa76cdb21d41a", "shasum": "" }, "require": { - "php": ">=7.3", "psr/container": "~1.0" }, "require-dev": { "athletic/athletic": "~0.1.8", - "phpunit/phpunit": "^9.0" + "phpunit/phpunit": "~4.5" }, "type": "library", "autoload": { @@ -1493,25 +1532,26 @@ "invoke", "invoker" ], - "time": "2020-08-01T15:36:25+00:00" + "time": "2017-03-20T19:28:22+00:00" }, { "name": "php-di/php-di", - "version": "6.2.3", + "version": "6.0.11", "source": { "type": "git", "url": "https://github.com/PHP-DI/PHP-DI.git", - "reference": "63c444646f5f41d84818af1c780abed8ebcc082c" + "reference": "9bdcc2f41f5fb700ddd01bc4fa8d5bd7b3f94620" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-DI/PHP-DI/zipball/63c444646f5f41d84818af1c780abed8ebcc082c", - "reference": "63c444646f5f41d84818af1c780abed8ebcc082c", + "url": "https://api.github.com/repos/PHP-DI/PHP-DI/zipball/9bdcc2f41f5fb700ddd01bc4fa8d5bd7b3f94620", + "reference": "9bdcc2f41f5fb700ddd01bc4fa8d5bd7b3f94620", "shasum": "" }, "require": { - "opis/closure": "^3.5.5", - "php": ">=7.2.0", + "jeremeamia/superclosure": "^2.0", + "nikic/php-parser": "^2.0|^3.0|^4.0", + "php": ">=7.0.0", "php-di/invoker": "^2.0", "php-di/phpdoc-reader": "^2.0.1", "psr/container": "^1.0" @@ -1522,10 +1562,10 @@ "require-dev": { "doctrine/annotations": "~1.2", "friendsofphp/php-cs-fixer": "^2.4", - "mnapoli/phpunit-easymock": "^1.2", + "mnapoli/phpunit-easymock": "~1.0", "ocramius/proxy-manager": "~2.0.2", - "phpstan/phpstan": "^0.12", - "phpunit/phpunit": "^8.5" + "phpstan/phpstan": "^0.9.2", + "phpunit/phpunit": "~6.4" }, "suggest": { "doctrine/annotations": "Install it if you want to use annotations (version ~1.2)", @@ -1545,7 +1585,7 @@ "MIT" ], "description": "The dependency injection container for humans", - "homepage": "https://php-di.org/", + "homepage": "http://php-di.org/", "keywords": [ "PSR-11", "container", @@ -1555,7 +1595,7 @@ "ioc", "psr11" ], - "time": "2020-09-24T12:21:43+00:00" + "time": "2019-12-12T07:58:02+00:00" }, { "name": "php-di/phpdoc-reader", @@ -2067,54 +2107,52 @@ }, { "name": "slim/slim", - "version": "4.5.0", + "version": "4.3.0", "source": { "type": "git", "url": "https://github.com/slimphp/Slim.git", - "reference": "5613cbb521081ed676d5d7eb3e44f2b80a818c24" + "reference": "26020e9a099e69b0b12918115894f7106364dcb7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slimphp/Slim/zipball/5613cbb521081ed676d5d7eb3e44f2b80a818c24", - "reference": "5613cbb521081ed676d5d7eb3e44f2b80a818c24", + "url": "https://api.github.com/repos/slimphp/Slim/zipball/26020e9a099e69b0b12918115894f7106364dcb7", + "reference": "26020e9a099e69b0b12918115894f7106364dcb7", "shasum": "" }, "require": { "ext-json": "*", "nikic/fast-route": "^1.3", - "php": "^7.2", + "php": "^7.1", "psr/container": "^1.0", "psr/http-factory": "^1.0", "psr/http-message": "^1.0", "psr/http-server-handler": "^1.0", - "psr/http-server-middleware": "^1.0", - "psr/log": "^1.1" + "psr/http-server-middleware": "^1.0" }, "require-dev": { - "adriansuter/php-autoload-override": "^1.0", "ext-simplexml": "*", "guzzlehttp/psr7": "^1.5", "http-interop/http-factory-guzzle": "^1.0", - "laminas/laminas-diactoros": "^2.1", "nyholm/psr7": "^1.1", "nyholm/psr7-server": "^0.3.0", - "phpspec/prophecy": "^1.10", + "phpspec/prophecy": "^1.8", "phpstan/phpstan": "^0.11.5", - "phpunit/phpunit": "^8.5", - "slim/http": "^1.0", - "slim/psr7": "^1.0", - "squizlabs/php_codesniffer": "^3.5" + "phpunit/phpunit": "^7.5", + "slim/http": "^0.7", + "slim/psr7": "^0.3", + "squizlabs/php_codesniffer": "^3.4.2", + "zendframework/zend-diactoros": "^2.1" }, "suggest": { "ext-simplexml": "Needed to support XML format in BodyParsingMiddleware", "ext-xml": "Needed to support XML format in BodyParsingMiddleware", - "php-di/php-di": "PHP-DI is the recommended container library to be used with Slim", - "slim/psr7": "Slim PSR-7 implementation. See https://www.slimframework.com/docs/v4/start/installation.html for more information." + "slim/psr7": "Slim PSR-7 implementation. See http://www.slimframework.com/docs/v4/start/installation.html for more information." }, "type": "library", "autoload": { "psr-4": { - "Slim\\": "Slim" + "Slim\\": "Slim", + "Slim\\Tests\\": "tests" } }, "notification-url": "https://packagist.org/downloads/", @@ -2156,7 +2194,7 @@ "micro", "router" ], - "time": "2020-04-14T20:49:48+00:00" + "time": "2019-10-05T21:24:58+00:00" }, { "name": "spatie/dropbox-api", @@ -2374,6 +2412,20 @@ "polyfill", "portable" ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], "time": "2020-07-14T12:35:20+00:00" }, { @@ -2445,6 +2497,20 @@ "portable", "shim" ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], "time": "2020-08-04T06:02:08+00:00" }, { @@ -2512,6 +2578,20 @@ "portable", "shim" ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], "time": "2020-07-14T12:35:20+00:00" }, { @@ -2575,6 +2655,94 @@ "portable", "shim" ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-07-14T12:35:20+00:00" + }, + { + "name": "symfony/polyfill-php56", + "version": "v1.18.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php56.git", + "reference": "13df84e91cd168f247c2f2ec82cc0fa24901c011" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/13df84e91cd168f247c2f2ec82cc0fa24901c011", + "reference": "13df84e91cd168f247c2f2ec82cc0fa24901c011", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "symfony/polyfill-util": "~1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.18-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php56\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "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 polyfill backporting some PHP 5.6+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], "time": "2020-07-14T12:35:20+00:00" }, { @@ -2638,6 +2806,20 @@ "portable", "shim" ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], "time": "2020-07-14T12:35:20+00:00" }, { @@ -2697,6 +2879,90 @@ "portable", "shim" ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-07-14T12:35:20+00:00" + }, + { + "name": "symfony/polyfill-util", + "version": "v1.18.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-util.git", + "reference": "46b910c71e9828f8ec2aa7a0314de1130d9b295a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-util/zipball/46b910c71e9828f8ec2aa7a0314de1130d9b295a", + "reference": "46b910c71e9828f8ec2aa7a0314de1130d9b295a", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.18-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Util\\": "" + } + }, + "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 utilities for portability of PHP codes", + "homepage": "https://symfony.com", + "keywords": [ + "compat", + "compatibility", + "polyfill", + "shim" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], "time": "2020-07-14T12:35:20+00:00" }, { @@ -2762,6 +3028,16 @@ "keywords": [ "templating" ], + "funding": [ + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/twig/twig", + "type": "tidelift" + } + ], "time": "2020-08-05T15:09:04+00:00" } ], @@ -2819,6 +3095,20 @@ } ], "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], "time": "2020-08-25T05:50:16+00:00" }, { @@ -2863,6 +3153,20 @@ "Xdebug", "performance" ], + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], "time": "2020-08-19T10:27:58+00:00" }, { @@ -2919,6 +3223,20 @@ "constructor", "instantiate" ], + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", + "type": "tidelift" + } + ], "time": "2020-05-29T17:27:14+00:00" }, { @@ -3018,6 +3336,12 @@ "object", "object graph" ], + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], "time": "2020-06-29T13:22:24+00:00" }, { @@ -3554,58 +3878,6 @@ ], "time": "2020-08-07T10:34:21+00:00" }, - { - "name": "nikic/php-parser", - "version": "v4.10.2", - "source": { - "type": "git", - "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "658f1be311a230e0907f5dfe0213742aff0596de" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/658f1be311a230e0907f5dfe0213742aff0596de", - "reference": "658f1be311a230e0907f5dfe0213742aff0596de", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=7.0" - }, - "require-dev": { - "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" - }, - "bin": [ - "bin/php-parse" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.9-dev" - } - }, - "autoload": { - "psr-4": { - "PhpParser\\": "lib/PhpParser" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Nikita Popov" - } - ], - "description": "A PHP parser written in PHP", - "keywords": [ - "parser", - "php" - ], - "time": "2020-09-26T10:30:38+00:00" - }, { "name": "phar-io/manifest", "version": "1.0.3", @@ -3710,25 +3982,25 @@ }, { "name": "phpdocumentor/reflection-common", - "version": "2.2.0", + "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" + "reference": "6568f4687e5b41b054365f9ae03fcb1ed5f2069b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/6568f4687e5b41b054365f9ae03fcb1ed5f2069b", + "reference": "6568f4687e5b41b054365f9ae03fcb1ed5f2069b", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0" + "php": ">=7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-2.x": "2.x-dev" + "dev-master": "2.x-dev" } }, "autoload": { @@ -3755,42 +4027,45 @@ "reflection", "static analysis" ], - "time": "2020-06-27T09:03:43+00:00" + "time": "2020-04-27T09:25:28+00:00" }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.1.0", + "version": "4.3.4", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e" + "reference": "da3fd972d6bafd628114f7e7e036f45944b62e9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", - "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/da3fd972d6bafd628114f7e7e036f45944b62e9c", + "reference": "da3fd972d6bafd628114f7e7e036f45944b62e9c", "shasum": "" }, "require": { - "ext-filter": "^7.1", - "php": "^7.2", - "phpdocumentor/reflection-common": "^2.0", - "phpdocumentor/type-resolver": "^1.0", - "webmozart/assert": "^1" + "php": "^7.0", + "phpdocumentor/reflection-common": "^1.0.0 || ^2.0.0", + "phpdocumentor/type-resolver": "~0.4 || ^1.0.0", + "webmozart/assert": "^1.0" }, "require-dev": { - "doctrine/instantiator": "^1", - "mockery/mockery": "^1" + "doctrine/instantiator": "^1.0.5", + "mockery/mockery": "^1.0", + "phpdocumentor/type-resolver": "0.4.*", + "phpunit/phpunit": "^6.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.x-dev" + "dev-master": "4.x-dev" } }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": "src" + "phpDocumentor\\Reflection\\": [ + "src/" + ] } }, "notification-url": "https://packagist.org/downloads/", @@ -3801,40 +4076,38 @@ { "name": "Mike van Riel", "email": "me@mikevanriel.com" - }, - { - "name": "Jaap van Otterdijk", - "email": "account@ijaap.nl" } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2020-02-22T12:28:44+00:00" + "time": "2019-12-28T18:55:12+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "1.4.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0" + "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", + "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0", + "php": "^7.1", "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "ext-tokenizer": "*" + "ext-tokenizer": "^7.1", + "mockery/mockery": "~1", + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-1.x": "1.x-dev" + "dev-master": "1.x-dev" } }, "autoload": { @@ -3853,37 +4126,37 @@ } ], "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "time": "2020-09-17T18:55:26+00:00" + "time": "2019-08-22T18:11:29+00:00" }, { "name": "phpspec/prophecy", - "version": "1.11.1", + "version": "v1.10.3", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "b20034be5efcdab4fb60ca3a29cba2949aead160" + "reference": "451c3cd1418cf640de218914901e51b064abb093" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/b20034be5efcdab4fb60ca3a29cba2949aead160", - "reference": "b20034be5efcdab4fb60ca3a29cba2949aead160", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/451c3cd1418cf640de218914901e51b064abb093", + "reference": "451c3cd1418cf640de218914901e51b064abb093", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.2", - "php": "^7.2", - "phpdocumentor/reflection-docblock": "^5.0", - "sebastian/comparator": "^3.0 || ^4.0", - "sebastian/recursion-context": "^3.0 || ^4.0" + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", + "sebastian/comparator": "^1.2.3|^2.0|^3.0|^4.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0|^4.0" }, "require-dev": { - "phpspec/phpspec": "^6.0", - "phpunit/phpunit": "^8.0" + "phpspec/phpspec": "^2.5 || ^3.2", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.11.x-dev" + "dev-master": "1.10.x-dev" } }, "autoload": { @@ -3916,7 +4189,7 @@ "spy", "stub" ], - "time": "2020-07-08T12:44:21+00:00" + "time": "2020-03-05T15:02:03+00:00" }, { "name": "phpstan/phpdoc-parser", @@ -4943,77 +5216,18 @@ "homepage": "https://github.com/sebastianbergmann/version", "time": "2016-10-03T07:35:21+00:00" }, - { - "name": "symfony/browser-kit", - "version": "v4.4.13", - "source": { - "type": "git", - "url": "https://github.com/symfony/browser-kit.git", - "reference": "f53310646af9901292488b2ff36e26ea10f545f5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/browser-kit/zipball/f53310646af9901292488b2ff36e26ea10f545f5", - "reference": "f53310646af9901292488b2ff36e26ea10f545f5", - "shasum": "" - }, - "require": { - "php": ">=7.1.3", - "symfony/dom-crawler": "^3.4|^4.0|^5.0" - }, - "require-dev": { - "symfony/css-selector": "^3.4|^4.0|^5.0", - "symfony/http-client": "^4.3|^5.0", - "symfony/mime": "^4.3|^5.0", - "symfony/process": "^3.4|^4.0|^5.0" - }, - "suggest": { - "symfony/process": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\BrowserKit\\": "" - }, - "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 BrowserKit Component", - "homepage": "https://symfony.com", - "time": "2020-05-22T17:28:00+00:00" - }, { "name": "symfony/console", - "version": "v4.4.13", + "version": "v4.4.14", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "b39fd99b9297b67fb7633b7d8083957a97e1e727" + "reference": "90933b39c7b312fc3ceaa1ddeac7eb48cb953124" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/b39fd99b9297b67fb7633b7d8083957a97e1e727", - "reference": "b39fd99b9297b67fb7633b7d8083957a97e1e727", + "url": "https://api.github.com/repos/symfony/console/zipball/90933b39c7b312fc3ceaa1ddeac7eb48cb953124", + "reference": "90933b39c7b312fc3ceaa1ddeac7eb48cb953124", "shasum": "" }, "require": { @@ -5077,34 +5291,47 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2020-09-02T07:07:21+00:00" + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-09-15T07:58:55+00:00" }, { "name": "symfony/dom-crawler", - "version": "v5.1.5", + "version": "v4.4.14", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "3ac31ffbc596e41ca081037b7d78fc7a853c0315" + "reference": "69690afed0881bb53f85dc1637e6b85416a1cd33" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/3ac31ffbc596e41ca081037b7d78fc7a853c0315", - "reference": "3ac31ffbc596e41ca081037b7d78fc7a853c0315", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/69690afed0881bb53f85dc1637e6b85416a1cd33", + "reference": "69690afed0881bb53f85dc1637e6b85416a1cd33", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=7.1.3", "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "^1.15" + "symfony/polyfill-mbstring": "~1.0" }, "conflict": { "masterminds/html5": "<2.6" }, "require-dev": { "masterminds/html5": "^2.6", - "symfony/css-selector": "^4.4|^5.0" + "symfony/css-selector": "^3.4|^4.0|^5.0" }, "suggest": { "symfony/css-selector": "" @@ -5112,7 +5339,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.1-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -5139,20 +5366,34 @@ ], "description": "Symfony DomCrawler Component", "homepage": "https://symfony.com", - "time": "2020-08-12T08:45:47+00:00" + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-09-02T16:08:58+00:00" }, { "name": "symfony/finder", - "version": "v4.4.13", + "version": "v4.4.14", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "2a78590b2c7e3de5c429628457c47541c58db9c7" + "reference": "5ef0f6c609c1a36f723880dfe78301199bc96868" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/2a78590b2c7e3de5c429628457c47541c58db9c7", - "reference": "2a78590b2c7e3de5c429628457c47541c58db9c7", + "url": "https://api.github.com/repos/symfony/finder/zipball/5ef0f6c609c1a36f723880dfe78301199bc96868", + "reference": "5ef0f6c609c1a36f723880dfe78301199bc96868", "shasum": "" }, "require": { @@ -5188,7 +5429,21 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2020-08-17T09:56:45+00:00" + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-09-02T16:08:58+00:00" }, { "name": "symfony/polyfill-php73", @@ -5250,6 +5505,20 @@ "portable", "shim" ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], "time": "2020-07-14T12:35:20+00:00" }, { @@ -5316,24 +5585,38 @@ "portable", "shim" ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], "time": "2020-07-14T12:35:20+00:00" }, { "name": "symfony/service-contracts", - "version": "v2.2.0", + "version": "v1.1.9", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1" + "reference": "b776d18b303a39f56c63747bcb977ad4b27aca26" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/d15da7ba4957ffb8f1747218be9e1a121fd298a1", - "reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/b776d18b303a39f56c63747bcb977ad4b27aca26", + "reference": "b776d18b303a39f56c63747bcb977ad4b27aca26", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=7.1.3", "psr/container": "^1.0" }, "suggest": { @@ -5342,7 +5625,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2-dev" + "dev-master": "1.1-dev" }, "thanks": { "name": "symfony/contracts", @@ -5378,27 +5661,41 @@ "interoperability", "standards" ], - "time": "2020-09-07T11:33:47+00:00" + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-07-06T13:19:58+00:00" }, { "name": "theseer/tokenizer", - "version": "1.2.0", + "version": "1.1.3", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "75a63c33a8577608444246075ea0af0d052e452a" + "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/75a63c33a8577608444246075ea0af0d052e452a", - "reference": "75a63c33a8577608444246075ea0af0d052e452a", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/11336f6f84e16a720dae9d8e6ed5019efa85a0f9", + "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9", "shasum": "" }, "require": { "ext-dom": "*", "ext-tokenizer": "*", "ext-xmlwriter": "*", - "php": "^7.2 || ^8.0" + "php": "^7.0" }, "type": "library", "autoload": { @@ -5418,7 +5715,7 @@ } ], "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "time": "2020-07-12T23:59:07+00:00" + "time": "2019-06-13T22:48:21+00:00" }, { "name": "webmozart/assert", @@ -5482,5 +5779,9 @@ "ext-pdo": "*", "ext-zip": "*" }, - "platform-dev": [] + "platform-dev": [], + "platform-overrides": { + "php": "7.1.33" + }, + "plugin-api-version": "1.1.0" } diff --git a/tests/BootApplication.php b/tests/BootApplication.php deleted file mode 100644 index d30d7f9..0000000 --- a/tests/BootApplication.php +++ /dev/null @@ -1,26 +0,0 @@ -app !== null) { - return $this->app; - } - - /** @var \Slim\App $app */ - $this->app = require BASE_DIR.'bootstrap/app.php'; - - $migrator = new Migrator($this->app->getContainer()->get('database'), BASE_DIR.'resources/schemas'); - $migrator->migrate(); - - return $this->app; - } -} diff --git a/tests/Feature/LoginControllerTest.php b/tests/Feature/LoginControllerTest.php index bcdb3f1..08cea4c 100644 --- a/tests/Feature/LoginControllerTest.php +++ b/tests/Feature/LoginControllerTest.php @@ -22,24 +22,45 @@ class LoginControllerTest extends TestCase $response = $this->post(route('login.show')); $this->assertSame(302, $response->getStatusCode()); - $this->assertSame(route('login.show'), $response->getHeader('Location')); + $this->assertSame(route('login.show'), $response->getHeaderLine('Location')); } -// /** @test */ -// public function it_login_with_correct_data() -// { -// $this->database()->query("INSERT INTO `users` (`email`, `username`, `password`, `is_admin`, `user_code`) VALUES ('admin@example.com', 'admin', ?, 1, ?)", [password_hash('admin', PASSWORD_DEFAULT), humanRandomString(5)]); -// -// $loginPage = $this->client->request('GET', route('login.show')); -// $form = $loginPage->selectButton('Login')->form([ -// 'username' => 'admin@example.com', -// 'password' => 'admin', -// ], 'POST'); -// -// $this->client->submit($form); -// $this->client->followRedirect(); -// dd($this->client->getResponse()); -// -// -// } + /** @test */ + public function it_login_with_correct_data() + { + $this->database()->query("INSERT INTO `users` (`email`, `username`, `password`, `is_admin`, `user_code`) VALUES ('admin@example.com', 'admin', ?, 1, ?)", [password_hash('admin', PASSWORD_DEFAULT), humanRandomString(5)]); + + $response = $this->get(route('login.show')); + $form = $this->getCrawler($response) + ->selectButton('Login') + ->form([ + 'username' => 'admin@example.com', + 'password' => 'admin', + ], 'POST'); + + $response = $this->submitForm($form); + $this->assertSame(302, $response->getStatusCode()); + $this->assertSame(route('home'), $response->getHeaderLine('Location')); + + $response = $this->get(route('home')); + $this->assertSame(200, $response->getStatusCode()); + } + + /** @test */ + public function it_hide_register_by_default() + { + $response = $this->get(route('login.show')); + $this->assertSame(200, $response->getStatusCode()); + $this->assertStringNotContainsString('Register', $this->getCrawler($response)->text()); + } + + /** @test */ + public function it_show_register_when_enabled() + { + $this->database()->query("INSERT INTO `settings`(`key`, `value`) VALUES ('register_enabled', 'on')"); + + $response = $this->get(route('login.show')); + $this->assertSame(200, $response->getStatusCode()); + $this->assertStringContainsString('Register', $this->getCrawler($response)->text()); + } } diff --git a/tests/TestCase.php b/tests/TestCase.php index 507171a..3d86e77 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -2,50 +2,16 @@ namespace Tests; -use App\Database\DB; use PHPUnit\Framework\TestCase as BaseTestCase; -use Symfony\Component\BrowserKit\Response; abstract class TestCase extends BaseTestCase { - use BootApplication; - - /** @var Client */ - protected $client; + use WithApplication; protected function setUp() { - $this->client = new Client($this->createApplication()); - $this->client->followRedirects(false); - } - - /** - * @param string $uri - * @param array $parameters - * @return object|Response - */ - public function get(string $uri, array $parameters = []) - { - $this->client->request('GET', $uri, $parameters); - return $this->client->getResponse(); - } - - /** - * @param string $uri - * @param array $parameters - * @return object|Response - */ - public function post(string $uri, array $parameters = []) - { - $this->client->request('POST', $uri, $parameters); - return $this->client->getResponse(); - } - - /** - * @return DB - */ - public function database() - { - return $this->app->getContainer()->get('database'); + parent::setUp(); + $_SESSION = []; // ugly workaround to the the session superglobal between tests + $this->createApplication(); } } diff --git a/tests/WithApplication.php b/tests/WithApplication.php new file mode 100644 index 0000000..3c45a8b --- /dev/null +++ b/tests/WithApplication.php @@ -0,0 +1,107 @@ +app = require BASE_DIR . 'bootstrap/app.php'; + + $migrator = new Migrator($this->app->getContainer()->get('database'), BASE_DIR . 'resources/schemas'); + $migrator->migrate(); + + return $this->app; + } + + /** + * @param $method + * @param $uri + * @param array $parameters + * @param array $headers + * @param null $body + * @param array $cookies + * @param array $files + * @return ResponseInterface + */ + public function request($method, $uri, $parameters = [], $headers = [], $body = null, $cookies = [], $files = []) + { + $request = (new ServerRequest($method, $uri, $headers, $body)) + ->withParsedBody($parameters) + ->withQueryParams($parameters) + ->withUploadedFiles(ServerRequest::normalizeFiles($files)) + ->withCookieParams($cookies); + + $response = $this->app->handle($request); + + if ($response->getBody()->isSeekable()) { + $response->getBody()->rewind(); + } + + return $response; + } + + /** + * @param string $uri + * @param array $parameters + * @param array $cookies + * @param array $headers + * @return ResponseInterface + */ + public function get(string $uri, array $parameters = [], $cookies = [], $headers = [], $files = []) + { + return $this->request('GET', $uri, $parameters, $headers, null, $cookies, $files); + } + + /** + * @param string $uri + * @param array $parameters + * @param array $cookies + * @param array $headers + * @param array $files + * @return ResponseInterface + */ + public function post(string $uri, array $parameters = [], $cookies = [], $headers = [], $files = []) + { + return $this->request('POST', $uri, $parameters, $headers, http_build_query($parameters), $cookies, $files); + } + + /** + * @param Form $form + * @param array $headers + * @param array $cookies + * @return ResponseInterface + */ + public function submitForm(Form $form, $headers = [], $cookies = []) + { + return $this->request($form->getMethod(), $form->getUri(), $form->getValues(), $headers, http_build_query($form->getValues()), $cookies, $form->getFiles()); + } + + /** + * @return DB + */ + public function database() + { + return $this->app->getContainer()->get('database'); + } + + /** + * @param ResponseInterface $response + * @return Crawler + */ + public function getCrawler($response) + { + return new Crawler($response->getBody()->getContents()); + } +}