diff --git a/LICENSE.md b/LICENSE.md index 82cd6c7..9907c6b 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,4 +1,4 @@ -Copyright (c) 2015-2017, Zend Technologies USA, Inc. +Copyright (c) 2015-2018, Zend Technologies USA, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, diff --git a/composer.json b/composer.json index be6accf..717544d 100644 --- a/composer.json +++ b/composer.json @@ -50,6 +50,9 @@ "dev-master": "2.1.x-dev", "dev-develop": "2.2.x-dev", "dev-release-3.0.0": "3.0.x-dev" + }, + "zf": { + "config-provider": "Zend\\Expressive\\Router\\AuraRouter\\ConfigProvider" } }, "scripts": { diff --git a/composer.lock b/composer.lock index c5f2382..606f625 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "f9f2c2000427b17fc82777bbbc852eb7", + "content-hash": "0ca54cf1da40c0ef2b44f6909d6341cb", "packages": [ { "name": "aura/router", @@ -106,22 +106,21 @@ "time": "2017-02-09T16:10:21+00:00" }, { - "name": "http-interop/http-server-handler", - "version": "1.0.0", + "name": "psr/http-message", + "version": "1.0.1", "source": { "type": "git", - "url": "https://github.com/http-interop/http-server-handler.git", - "reference": "931a6495fb1b6005c9b4abc4dd11fb12a2a8103b" + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/http-interop/http-server-handler/zipball/931a6495fb1b6005c9b4abc4dd11fb12a2a8103b", - "reference": "931a6495fb1b6005c9b4abc4dd11fb12a2a8103b", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", "shasum": "" }, "require": { - "php": ">=7.0", - "psr/http-message": "^1.0" + "php": ">=5.3.0" }, "type": "library", "extra": { @@ -131,7 +130,7 @@ }, "autoload": { "psr-4": { - "Interop\\Http\\Server\\": "src/" + "Psr\\Http\\Message\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -144,41 +143,36 @@ "homepage": "http://www.php-fig.org/" } ], - "description": "Common interface for HTTP server-side request handler", + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", "keywords": [ - "handler", "http", + "http-message", "psr", - "psr-15", "psr-7", "request", - "response", - "server" + "response" ], - "time": "2017-11-09T18:35:22+00:00" + "time": "2016-08-06T14:39:51+00:00" }, { - "name": "http-interop/http-server-middleware", - "version": "1.0.1", + "name": "psr/http-server-handler", + "version": "1.0.0", "source": { "type": "git", - "url": "https://github.com/http-interop/http-server-middleware.git", - "reference": "e605a7f47a002e857a3b9bb992010e2f859e4560" + "url": "https://github.com/php-fig/http-server-handler.git", + "reference": "439d92054dc06097f2406ec074a2627839955a02" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/http-interop/http-server-middleware/zipball/e605a7f47a002e857a3b9bb992010e2f859e4560", - "reference": "e605a7f47a002e857a3b9bb992010e2f859e4560", + "url": "https://api.github.com/repos/php-fig/http-server-handler/zipball/439d92054dc06097f2406ec074a2627839955a02", + "reference": "439d92054dc06097f2406ec074a2627839955a02", "shasum": "" }, "require": { - "http-interop/http-server-handler": "^1.0", "php": ">=7.0", "psr/http-message": "^1.0" }, - "replace": { - "http-interop/http-middleware": ">=0.5" - }, "type": "library", "extra": { "branch-alias": { @@ -187,7 +181,7 @@ }, "autoload": { "psr-4": { - "Interop\\Http\\Server\\": "src/" + "Psr\\Http\\Server\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -200,34 +194,38 @@ "homepage": "http://www.php-fig.org/" } ], - "description": "Common interface for HTTP server-side middleware", + "description": "Common interface for HTTP server-side request handler", "keywords": [ + "handler", "http", - "middleware", + "http-interop", "psr", "psr-15", "psr-7", "request", - "response" + "response", + "server" ], - "time": "2017-11-09T21:42:30+00:00" + "time": "2018-01-22T17:04:15+00:00" }, { - "name": "psr/http-message", - "version": "1.0.1", + "name": "psr/http-server-middleware", + "version": "1.0.0", "source": { "type": "git", - "url": "https://github.com/php-fig/http-message.git", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + "url": "https://github.com/php-fig/http-server-middleware.git", + "reference": "ea17eb1fb2c8df6db919cc578451a8013c6a0ae5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "url": "https://api.github.com/repos/php-fig/http-server-middleware/zipball/ea17eb1fb2c8df6db919cc578451a8013c6a0ae5", + "reference": "ea17eb1fb2c8df6db919cc578451a8013c6a0ae5", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=7.0", + "psr/http-message": "^1.0", + "psr/http-server-handler": "^1.0" }, "type": "library", "extra": { @@ -237,7 +235,7 @@ }, "autoload": { "psr-4": { - "Psr\\Http\\Message\\": "src/" + "Psr\\Http\\Server\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -250,17 +248,18 @@ "homepage": "http://www.php-fig.org/" } ], - "description": "Common interface for HTTP messages", - "homepage": "https://github.com/php-fig/http-message", + "description": "Common interface for HTTP server-side middleware", "keywords": [ "http", - "http-message", + "http-interop", + "middleware", "psr", + "psr-15", "psr-7", "request", "response" ], - "time": "2016-08-06T14:39:51+00:00" + "time": "2018-01-22T17:08:31+00:00" }, { "name": "psr/log", @@ -315,29 +314,29 @@ "source": { "type": "git", "url": "https://github.com/zendframework/zend-expressive-router.git", - "reference": "57ebf529def0743ab9e781040e2a3c5b5aeb7533" + "reference": "9ecd970f1e6a0b670de62cb28314189b2e17465d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-expressive-router/zipball/57ebf529def0743ab9e781040e2a3c5b5aeb7533", - "reference": "57ebf529def0743ab9e781040e2a3c5b5aeb7533", + "url": "https://api.github.com/repos/zendframework/zend-expressive-router/zipball/9ecd970f1e6a0b670de62cb28314189b2e17465d", + "reference": "9ecd970f1e6a0b670de62cb28314189b2e17465d", "shasum": "" }, "require": { "fig/http-message-util": "^1.1.2", - "http-interop/http-server-middleware": "^1.0.1", "php": "^7.1", - "psr/http-message": "^1.0.1" + "psr/http-message": "^1.0.1", + "psr/http-server-middleware": "^1.0" }, "require-dev": { - "malukenho/docheader": "^0.1.5", - "phpunit/phpunit": "^6.4.4", + "malukenho/docheader": "^0.1.6", + "phpunit/phpunit": "^6.5.5", "zendframework/zend-coding-standard": "~1.0.0" }, "suggest": { - "zendframework/zend-expressive-aurarouter": "^1.0 to use the Aura.Router routing adapter", - "zendframework/zend-expressive-fastroute": "^1.2 to use the FastRoute routing adapter", - "zendframework/zend-expressive-zendrouter": "^1.2 to use the zend-router routing adapter" + "zendframework/zend-expressive-aurarouter": "^3.0 to use the Aura.Router routing adapter", + "zendframework/zend-expressive-fastroute": "^3.0 to use the FastRoute routing adapter", + "zendframework/zend-expressive-zendrouter": "^3.0 to use the zend-router routing adapter" }, "type": "library", "extra": { @@ -367,7 +366,7 @@ "zend-expressive", "zf" ], - "time": "2017-12-07T17:39:11+00:00" + "time": "2018-01-24T20:51:48+00:00" } ], "packages-dev": [ @@ -427,22 +426,22 @@ }, { "name": "malukenho/docheader", - "version": "0.1.6", + "version": "0.1.7", "source": { "type": "git", "url": "https://github.com/malukenho/docheader.git", - "reference": "b3857387fe5e6b0928b67875ea09ebb5745d5b8b" + "reference": "3eb59f0621125c0dc40775f1bcc3206c37993703" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/malukenho/docheader/zipball/b3857387fe5e6b0928b67875ea09ebb5745d5b8b", - "reference": "b3857387fe5e6b0928b67875ea09ebb5745d5b8b", + "url": "https://api.github.com/repos/malukenho/docheader/zipball/3eb59f0621125c0dc40775f1bcc3206c37993703", + "reference": "3eb59f0621125c0dc40775f1bcc3206c37993703", "shasum": "" }, "require": { "php": "~5.5|^7.0", - "symfony/console": "~2.0|^3.0", - "symfony/finder": "~2.0|^3.0" + "symfony/console": "~2.0 || ^3.0 || ^4.0", + "symfony/finder": "~2.0 || ^3.0 || ^4.0" }, "require-dev": { "phpunit/phpunit": "^4.7", @@ -474,7 +473,7 @@ "code standard", "license" ], - "time": "2017-05-03T05:22:55+00:00" + "time": "2017-12-18T09:16:11+00:00" }, { "name": "myclabs/deep-copy", @@ -1089,16 +1088,16 @@ }, { "name": "phpunit/phpunit", - "version": "6.5.3", + "version": "6.5.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "882e886cc928a0abd3c61282b2a64026237d14a4" + "reference": "83d27937a310f2984fd575686138597147bdc7df" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/882e886cc928a0abd3c61282b2a64026237d14a4", - "reference": "882e886cc928a0abd3c61282b2a64026237d14a4", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/83d27937a310f2984fd575686138597147bdc7df", + "reference": "83d27937a310f2984fd575686138597147bdc7df", "shasum": "" }, "require": { @@ -1116,7 +1115,7 @@ "phpunit/php-file-iterator": "^1.4.3", "phpunit/php-text-template": "^1.2.1", "phpunit/php-timer": "^1.0.9", - "phpunit/phpunit-mock-objects": "^5.0.4", + "phpunit/phpunit-mock-objects": "^5.0.5", "sebastian/comparator": "^2.1", "sebastian/diff": "^2.0", "sebastian/environment": "^3.1", @@ -1169,27 +1168,27 @@ "testing", "xunit" ], - "time": "2017-12-06T09:42:03+00:00" + "time": "2017-12-17T06:31:19+00:00" }, { "name": "phpunit/phpunit-mock-objects", - "version": "5.0.4", + "version": "5.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "16b50f4167e5e85e81ca8a3dd105d0a5fd32009a" + "reference": "33fd41a76e746b8fa96d00b49a23dadfa8334cdf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/16b50f4167e5e85e81ca8a3dd105d0a5fd32009a", - "reference": "16b50f4167e5e85e81ca8a3dd105d0a5fd32009a", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/33fd41a76e746b8fa96d00b49a23dadfa8334cdf", + "reference": "33fd41a76e746b8fa96d00b49a23dadfa8334cdf", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.5", "php": "^7.0", "phpunit/php-text-template": "^1.2.1", - "sebastian/exporter": "^3.0" + "sebastian/exporter": "^3.1" }, "conflict": { "phpunit/phpunit": "<6.0" @@ -1228,7 +1227,7 @@ "mock", "xunit" ], - "time": "2017-12-02T05:31:19+00:00" + "time": "2018-01-06T05:45:45+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -1277,16 +1276,16 @@ }, { "name": "sebastian/comparator", - "version": "2.1.0", + "version": "2.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "1174d9018191e93cb9d719edec01257fc05f8158" + "reference": "11c07feade1d65453e06df3b3b90171d6d982087" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1174d9018191e93cb9d719edec01257fc05f8158", - "reference": "1174d9018191e93cb9d719edec01257fc05f8158", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/11c07feade1d65453e06df3b3b90171d6d982087", + "reference": "11c07feade1d65453e06df3b3b90171d6d982087", "shasum": "" }, "require": { @@ -1337,7 +1336,7 @@ "compare", "equality" ], - "time": "2017-11-03T07:16:52+00:00" + "time": "2018-01-12T06:34:42+00:00" }, { "name": "sebastian/diff", @@ -1869,21 +1868,20 @@ }, { "name": "symfony/console", - "version": "v3.4.1", + "version": "v4.0.3", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "2cdef78de8f54f68ff16a857e710e7302b47d4c7" + "reference": "fe0e69d7162cba0885791cf7eea5f0d7bc0f897e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/2cdef78de8f54f68ff16a857e710e7302b47d4c7", - "reference": "2cdef78de8f54f68ff16a857e710e7302b47d4c7", + "url": "https://api.github.com/repos/symfony/console/zipball/fe0e69d7162cba0885791cf7eea5f0d7bc0f897e", + "reference": "fe0e69d7162cba0885791cf7eea5f0d7bc0f897e", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/debug": "~2.8|~3.0|~4.0", + "php": "^7.1.3", "symfony/polyfill-mbstring": "~1.0" }, "conflict": { @@ -1892,11 +1890,11 @@ }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~3.3|~4.0", + "symfony/config": "~3.4|~4.0", "symfony/dependency-injection": "~3.4|~4.0", - "symfony/event-dispatcher": "~2.8|~3.0|~4.0", + "symfony/event-dispatcher": "~3.4|~4.0", "symfony/lock": "~3.4|~4.0", - "symfony/process": "~3.3|~4.0" + "symfony/process": "~3.4|~4.0" }, "suggest": { "psr/log": "For using the console logger", @@ -1907,7 +1905,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -1934,85 +1932,29 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2017-12-02T18:20:11+00:00" - }, - { - "name": "symfony/debug", - "version": "v4.0.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/debug.git", - "reference": "26a15dab86c3820473716be4f846eac774ad4ad9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/26a15dab86c3820473716be4f846eac774ad4ad9", - "reference": "26a15dab86c3820473716be4f846eac774ad4ad9", - "shasum": "" - }, - "require": { - "php": "^7.1.3", - "psr/log": "~1.0" - }, - "conflict": { - "symfony/http-kernel": "<3.4" - }, - "require-dev": { - "symfony/http-kernel": "~3.4|~4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Debug\\": "" - }, - "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 Debug Component", - "homepage": "https://symfony.com", - "time": "2017-11-21T09:27:49+00:00" + "time": "2018-01-03T07:38:00+00:00" }, { "name": "symfony/finder", - "version": "v3.4.1", + "version": "v4.0.3", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "dac8d7db537bac7ad8143eb11360a8c2231f251a" + "reference": "8b08180f2b7ccb41062366b9ad91fbc4f1af8601" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/dac8d7db537bac7ad8143eb11360a8c2231f251a", - "reference": "dac8d7db537bac7ad8143eb11360a8c2231f251a", + "url": "https://api.github.com/repos/symfony/finder/zipball/8b08180f2b7ccb41062366b9ad91fbc4f1af8601", + "reference": "8b08180f2b7ccb41062366b9ad91fbc4f1af8601", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": "^7.1.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -2039,7 +1981,7 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2017-11-05T16:10:10+00:00" + "time": "2018-01-03T07:38:00+00:00" }, { "name": "symfony/polyfill-mbstring", diff --git a/src/AuraRouter/ConfigProvider.php b/src/AuraRouter/ConfigProvider.php new file mode 100644 index 0000000..fc6486e --- /dev/null +++ b/src/AuraRouter/ConfigProvider.php @@ -0,0 +1,32 @@ + $this->getDependencies(), + ]; + } + + public function getDependencies() : array + { + return [ + 'factories' => [ + RouterInterface::class => AuraRouter::class, + ], + ]; + } +} diff --git a/test/AuraRouter/ConfigProviderTest.php b/test/AuraRouter/ConfigProviderTest.php new file mode 100644 index 0000000..88a386c --- /dev/null +++ b/test/AuraRouter/ConfigProviderTest.php @@ -0,0 +1,47 @@ +provider = new ConfigProvider(); + } + + public function testInvocationReturnsArray() : array + { + $config = ($this->provider)(); + $this->assertInternalType('array', $config); + + return $config; + } + + /** + * @depends testInvocationReturnsArray + */ + public function testReturnedArrayContainsDependencies(array $config) : void + { + $this->assertArrayHasKey('dependencies', $config); + $this->assertInternalType('array', $config['dependencies']); + $this->assertArrayHasKey('factories', $config['dependencies']); + $this->assertInternalType('array', $config['dependencies']['factories']); + $this->assertArrayHasKey(RouterInterface::class, $config['dependencies']['factories']); + } +}