From 3cc786c8c7dac22be1610ea2f13de1f9a5909665 Mon Sep 17 00:00:00 2001 From: Stavros Papadakis <spapad@gmail.com> Date: Fri, 17 Feb 2017 12:56:13 +0200 Subject: [PATCH] WIP: Transition to SLIM app --- academic-id/README.md | 32 +- academic-id/{ => barebone}/.gitignore | 0 academic-id/{ => barebone}/.htaccess | 0 academic-id/barebone/README.md | 30 + academic-id/{ => barebone}/index.php | 1 + academic-id/{ => barebone}/settings.php.dist | 0 academic-id/slim-app/.gitignore | 3 + academic-id/slim-app/README.md | 1 + academic-id/slim-app/composer.json | 37 + academic-id/slim-app/composer.lock | 1740 +++++++++++++++++ academic-id/slim-app/logs/README.md | 1 + academic-id/slim-app/phpunit.xml | 7 + academic-id/slim-app/public/.htaccess | 10 + academic-id/slim-app/public/index.php | 42 + academic-id/slim-app/src/.gitignore | 1 + academic-id/slim-app/src/dependencies.php | 28 + academic-id/slim-app/src/middleware.php | 9 + academic-id/slim-app/src/osteam/App.php | 128 ++ .../src/osteam/AuthorizationGuard.php | 75 + academic-id/slim-app/src/osteam/BaseApp.php | 120 ++ academic-id/slim-app/src/osteam/Client.php | 144 ++ .../slim-app/src/osteam/Handlers/Error.php | 32 + .../slim-app/src/osteam/Handlers/NotFound.php | 30 + academic-id/slim-app/src/routes.php | 15 + academic-id/slim-app/src/settings.php.dist | 26 + academic-id/slim-app/templates/index.phtml | 38 + .../tests/Functional/BaseTestCase.php | 77 + .../tests/Functional/HomepageTest.php | 40 + 28 files changed, 2640 insertions(+), 27 deletions(-) rename academic-id/{ => barebone}/.gitignore (100%) rename academic-id/{ => barebone}/.htaccess (100%) create mode 100644 academic-id/barebone/README.md rename academic-id/{ => barebone}/index.php (98%) rename academic-id/{ => barebone}/settings.php.dist (100%) create mode 100644 academic-id/slim-app/.gitignore create mode 100644 academic-id/slim-app/README.md create mode 100644 academic-id/slim-app/composer.json create mode 100644 academic-id/slim-app/composer.lock create mode 100644 academic-id/slim-app/logs/README.md create mode 100644 academic-id/slim-app/phpunit.xml create mode 100644 academic-id/slim-app/public/.htaccess create mode 100644 academic-id/slim-app/public/index.php create mode 100644 academic-id/slim-app/src/.gitignore create mode 100644 academic-id/slim-app/src/dependencies.php create mode 100644 academic-id/slim-app/src/middleware.php create mode 100644 academic-id/slim-app/src/osteam/App.php create mode 100644 academic-id/slim-app/src/osteam/AuthorizationGuard.php create mode 100644 academic-id/slim-app/src/osteam/BaseApp.php create mode 100644 academic-id/slim-app/src/osteam/Client.php create mode 100644 academic-id/slim-app/src/osteam/Handlers/Error.php create mode 100644 academic-id/slim-app/src/osteam/Handlers/NotFound.php create mode 100644 academic-id/slim-app/src/routes.php create mode 100644 academic-id/slim-app/src/settings.php.dist create mode 100644 academic-id/slim-app/templates/index.phtml create mode 100644 academic-id/slim-app/tests/Functional/BaseTestCase.php create mode 100644 academic-id/slim-app/tests/Functional/HomepageTest.php diff --git a/academic-id/README.md b/academic-id/README.md index 469b15c..1eb6395 100644 --- a/academic-id/README.md +++ b/academic-id/README.md @@ -1,30 +1,8 @@ -# Web Service Client ΟΞ΅ PHP +# Ξ ΟΞΏΞ³ΟάμμαΟΞ± ΞΊΞ±ΟανάλΟΟΞ·Ο academic id API -Ξ₯λοΟΞΏΞΉΞ�ΞΈΞ·ΞΊΞ΅ ΞΞ½Ξ±Ο Ξ±ΟΞ»ΟΟ web service client ΞΊΞ±ΞΉ ΟΞ΅ PHP Ξ³ΞΉΞ± Ξ½Ξ± ΟΟΞ±Ξ³ΞΌΞ±ΟΞΏΟοιΡί ΟΞΉΟ ΞΊΞ»Ξ�ΟΞ΅ΞΉΟ ΟΟΞΏ Ξ΅ΟΞ―ΟΞ·ΞΌΞΏ web service ΞΌΞΟΟ php curl. -ΞΞΉ λΡιΟΞΏΟ ΟΞ³Ξ―Ξ΅Ο ΟΞΏΟ Ξ΅Ξ―Ξ½Ξ±ΞΉ: +΀α ΟΞ±ΟΞ±ΞΊΞ¬ΟΟ ΟΟΞΏΞ³ΟάμμαΟΞ± - βιβλιοθΞ�ΞΊΞ΅Ο ΞΊΞ±ΟΞ±Ξ½Ξ±Ξ»ΟΞ½ΞΏΟ Ξ½ ΟΞΏ academic id API. -* queryID, ΟΞΏΟ Ξ΅ΟΞΉΟΟΟΞΟΡι ΟΞ·Ξ½ Ξ±ΟάνΟΞ·ΟΞ· ΟΞΏΟ Ξ΅ΟΞ―ΟΞ·ΞΌΞΏΟ web service, ΞΌΞ΅ ΟΞ±ΟΞ±ΞΌΞΟΟΞΏΟ Ο: - * username ΟΟΞΏΞ΅ΟΞ±ΞΉΟΞΉΞΊΟ, ΟΞΏ username Ξ³ΞΉΞ± ΟΞΏ web service - * password ΟΟΞΏΞ΅ΟΞ±ΞΉΟΞΉΞΊΟ, ΟΞΏ password Ξ³ΞΉΞ± ΟΞΏ web service - * identity Ο ΟΞΏΟΟΞ΅ΟΟΞΉΞΊΟ, ΟΞΏ academic id Ξ³ΞΉΞ± ΞλΡγΟΞΏ -* queryIDis ΟΞΏΟ Ξ΅ΟΞΉΟΟΟΞΟΡι κΡίμΡνο isStudent:[true,false] ΟΟΟΟ ΟΟΞΏΞΊΟΟΟΡι Ξ±ΟΟ ΟΞΏ Ξ΅ΟΞ―ΟΞ·ΞΌΞΏ web service, ΞΌΞ΅ ΟΞ±ΟΞ±ΞΌΞΟΟΞΏΟ Ο: - * username ΟΟΞΏΞ΅ΟΞ±ΞΉΟΞΉΞΊΟ, ΟΞΏ username Ξ³ΞΉΞ± ΟΞΏ web service - * password ΟΟΞΏΞ΅ΟΞ±ΞΉΟΞΉΞΊΟ, ΟΞΏ password Ξ³ΞΉΞ± ΟΞΏ web service - * identity Ο ΟΞΏΟΟΞ΅ΟΟΞΉΞΊΟ, ΟΞΏ academic id Ξ³ΞΉΞ± ΞλΡγΟΞΏ -* echo, ΟΞΏΟ Ξ΅ΟΞΉΟΟΟΞΟΡι ΟΞΏ query_string, ΞΌΞ΅ ΞΏΟΞΏΞΉΞ±Ξ΄Ξ�ΟΞΏΟΞ΅ ΟΞ±ΟάμΡΟΟΞΏ +Ξ Ξ΅ΟΞΉΞΟΞΏΞ½ΟΞ±ΞΉ δΡίγμαΟΞ± ΞΊΟδικα ΞΊΞ±ΞΉ βιβλιοθΞ�ΞΊΞ΅Ο ΞΊΞ±ΟανάλΟΟΞ·Ο ΟΟΞΉΟ Ξ΅ΞΎΞ�Ο ΟΞ±ΟαλλαγΞΟ: -ΞΞΉ λΡιΟΞΏΟ ΟΞ³Ξ―Ξ΅Ο Ξ΄Ξ―Ξ½ΞΏΞ½ΟΞ±ΞΉ ΟΟ ΟΞ±ΟάμΡΟΟΞΏΟ ΞΊΞ±ΟΞ¬ ΟΞ·Ξ½ ΞΊΞ»Ξ�ΟΞ·. ΞΞΉΞ± ΟΞ±ΟάδΡιγμα: - -* http://local.dev/academic-id/wrapper.php?identity=123456789012 (default is queryID) -* http://local.dev/academic-id/wrapper.php?username=spapad&identity=123456789012&operation=queryIDis -* http://local.dev/academic-id/wrapper.php?operation=echo&identity=123456789012 - -ΞΞ³ΞΉΞ½Ξ±Ξ½ αλλαγΞΟ ΟΟΞΏΞ½ ΞΊΟδικα PHP Ξ³ΞΉΞ± Ξ½Ξ± Ρίναι 1-1 Ξ±Ξ½ΟΞ―ΟΟΞΏΞΉΟΞ΅Ο ΞΏΞΉ λΡιΟΞΏΟ ΟΞ³Ξ―Ξ΅Ο ΞΌΞ΅ ΟΞ·Ξ½ Ο Ξ»ΞΏΟΞΏΞ―Ξ·ΟΞ· ΟΞ΅ java (http://ostmgmt.minedu.gov.gr/projects/wos2_esb/wiki/Pilot_service_Academic_ID) - -ΞΞΉ Ξ½ΞΞ΅Ο Ξ»Ξ΅ΞΉΟΞΏΟ ΟΞ³Ξ―Ξ΅Ο Ξ΅Ξ―Ξ½Ξ±ΞΉ: - -* testServiceStatus -* queryIDnoCD -* queryID - -ΞΟΞ―ΟΞ·Ο ΟΞ±ΟΞ¬ΟΞΈΞ·ΞΊΞ΅ [htaccess](.htaccess) Ξ±ΟΟΡίο Ξ³ΞΉΞ± Ξ½Ξ± δίνονΟΞ±ΞΉ Ξ±ΞΊΟΞΉΞ²ΟΟ Ξ―Ξ΄ΞΉΞ± endpoints. +* [ΞΟΞ±ΟΞΌΞΏΞ³Ξ� διαδικΟΟΞΏΟ Ξ±Ξ½Ξ±ΟΟΟ Ξ³ΞΌΞΞ½Ξ· ΟΞ΅ SLIM framework](./slim-app/) +* [ΞΟΞ±ΟΞΌΞΏΞ³Ξ� διαδικΟΟΞΏΟ Ξ±Ξ½Ξ±ΟΟΟ Ξ³ΞΌΞΞ½Ξ· ΟΞ΅ PHP](./barebone/) diff --git a/academic-id/.gitignore b/academic-id/barebone/.gitignore similarity index 100% rename from academic-id/.gitignore rename to academic-id/barebone/.gitignore diff --git a/academic-id/.htaccess b/academic-id/barebone/.htaccess similarity index 100% rename from academic-id/.htaccess rename to academic-id/barebone/.htaccess diff --git a/academic-id/barebone/README.md b/academic-id/barebone/README.md new file mode 100644 index 0000000..469b15c --- /dev/null +++ b/academic-id/barebone/README.md @@ -0,0 +1,30 @@ +# Web Service Client ΟΞ΅ PHP + +Ξ₯λοΟΞΏΞΉΞ�ΞΈΞ·ΞΊΞ΅ ΞΞ½Ξ±Ο Ξ±ΟΞ»ΟΟ web service client ΞΊΞ±ΞΉ ΟΞ΅ PHP Ξ³ΞΉΞ± Ξ½Ξ± ΟΟΞ±Ξ³ΞΌΞ±ΟΞΏΟοιΡί ΟΞΉΟ ΞΊΞ»Ξ�ΟΞ΅ΞΉΟ ΟΟΞΏ Ξ΅ΟΞ―ΟΞ·ΞΌΞΏ web service ΞΌΞΟΟ php curl. +ΞΞΉ λΡιΟΞΏΟ ΟΞ³Ξ―Ξ΅Ο ΟΞΏΟ Ξ΅Ξ―Ξ½Ξ±ΞΉ: + +* queryID, ΟΞΏΟ Ξ΅ΟΞΉΟΟΟΞΟΡι ΟΞ·Ξ½ Ξ±ΟάνΟΞ·ΟΞ· ΟΞΏΟ Ξ΅ΟΞ―ΟΞ·ΞΌΞΏΟ web service, ΞΌΞ΅ ΟΞ±ΟΞ±ΞΌΞΟΟΞΏΟ Ο: + * username ΟΟΞΏΞ΅ΟΞ±ΞΉΟΞΉΞΊΟ, ΟΞΏ username Ξ³ΞΉΞ± ΟΞΏ web service + * password ΟΟΞΏΞ΅ΟΞ±ΞΉΟΞΉΞΊΟ, ΟΞΏ password Ξ³ΞΉΞ± ΟΞΏ web service + * identity Ο ΟΞΏΟΟΞ΅ΟΟΞΉΞΊΟ, ΟΞΏ academic id Ξ³ΞΉΞ± ΞλΡγΟΞΏ +* queryIDis ΟΞΏΟ Ξ΅ΟΞΉΟΟΟΞΟΡι κΡίμΡνο isStudent:[true,false] ΟΟΟΟ ΟΟΞΏΞΊΟΟΟΡι Ξ±ΟΟ ΟΞΏ Ξ΅ΟΞ―ΟΞ·ΞΌΞΏ web service, ΞΌΞ΅ ΟΞ±ΟΞ±ΞΌΞΟΟΞΏΟ Ο: + * username ΟΟΞΏΞ΅ΟΞ±ΞΉΟΞΉΞΊΟ, ΟΞΏ username Ξ³ΞΉΞ± ΟΞΏ web service + * password ΟΟΞΏΞ΅ΟΞ±ΞΉΟΞΉΞΊΟ, ΟΞΏ password Ξ³ΞΉΞ± ΟΞΏ web service + * identity Ο ΟΞΏΟΟΞ΅ΟΟΞΉΞΊΟ, ΟΞΏ academic id Ξ³ΞΉΞ± ΞλΡγΟΞΏ +* echo, ΟΞΏΟ Ξ΅ΟΞΉΟΟΟΞΟΡι ΟΞΏ query_string, ΞΌΞ΅ ΞΏΟΞΏΞΉΞ±Ξ΄Ξ�ΟΞΏΟΞ΅ ΟΞ±ΟάμΡΟΟΞΏ + +ΞΞΉ λΡιΟΞΏΟ ΟΞ³Ξ―Ξ΅Ο Ξ΄Ξ―Ξ½ΞΏΞ½ΟΞ±ΞΉ ΟΟ ΟΞ±ΟάμΡΟΟΞΏΟ ΞΊΞ±ΟΞ¬ ΟΞ·Ξ½ ΞΊΞ»Ξ�ΟΞ·. ΞΞΉΞ± ΟΞ±ΟάδΡιγμα: + +* http://local.dev/academic-id/wrapper.php?identity=123456789012 (default is queryID) +* http://local.dev/academic-id/wrapper.php?username=spapad&identity=123456789012&operation=queryIDis +* http://local.dev/academic-id/wrapper.php?operation=echo&identity=123456789012 + +ΞΞ³ΞΉΞ½Ξ±Ξ½ αλλαγΞΟ ΟΟΞΏΞ½ ΞΊΟδικα PHP Ξ³ΞΉΞ± Ξ½Ξ± Ρίναι 1-1 Ξ±Ξ½ΟΞ―ΟΟΞΏΞΉΟΞ΅Ο ΞΏΞΉ λΡιΟΞΏΟ ΟΞ³Ξ―Ξ΅Ο ΞΌΞ΅ ΟΞ·Ξ½ Ο Ξ»ΞΏΟΞΏΞ―Ξ·ΟΞ· ΟΞ΅ java (http://ostmgmt.minedu.gov.gr/projects/wos2_esb/wiki/Pilot_service_Academic_ID) + +ΞΞΉ Ξ½ΞΞ΅Ο Ξ»Ξ΅ΞΉΟΞΏΟ ΟΞ³Ξ―Ξ΅Ο Ξ΅Ξ―Ξ½Ξ±ΞΉ: + +* testServiceStatus +* queryIDnoCD +* queryID + +ΞΟΞ―ΟΞ·Ο ΟΞ±ΟΞ¬ΟΞΈΞ·ΞΊΞ΅ [htaccess](.htaccess) Ξ±ΟΟΡίο Ξ³ΞΉΞ± Ξ½Ξ± δίνονΟΞ±ΞΉ Ξ±ΞΊΟΞΉΞ²ΟΟ Ξ―Ξ΄ΞΉΞ± endpoints. diff --git a/academic-id/index.php b/academic-id/barebone/index.php similarity index 98% rename from academic-id/index.php rename to academic-id/barebone/index.php index 24801c2..4f85146 100644 --- a/academic-id/index.php +++ b/academic-id/barebone/index.php @@ -59,6 +59,7 @@ function wscall($params) $payload = json_encode(array("SubmissionCode" => $params['identity'])); curl_setopt($ch, CURLOPT_URL, "https://academicidapp.grnet.gr/admin/web/ws/users/inspectAcademicID"); + // curl_setopt($ch, CURLOPT_URL, "https://academicidapp.grnet.gr/admin/web/ws/users/inspectAMKA"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); curl_setopt($ch, CURLOPT_HTTPHEADER, [ diff --git a/academic-id/settings.php.dist b/academic-id/barebone/settings.php.dist similarity index 100% rename from academic-id/settings.php.dist rename to academic-id/barebone/settings.php.dist diff --git a/academic-id/slim-app/.gitignore b/academic-id/slim-app/.gitignore new file mode 100644 index 0000000..adf1997 --- /dev/null +++ b/academic-id/slim-app/.gitignore @@ -0,0 +1,3 @@ +/vendor/ +/logs/* +!/logs/README.md diff --git a/academic-id/slim-app/README.md b/academic-id/slim-app/README.md new file mode 100644 index 0000000..4640904 --- /dev/null +++ b/academic-id/slim-app/README.md @@ -0,0 +1 @@ +# TODO diff --git a/academic-id/slim-app/composer.json b/academic-id/slim-app/composer.json new file mode 100644 index 0000000..c163956 --- /dev/null +++ b/academic-id/slim-app/composer.json @@ -0,0 +1,37 @@ +{ + "name": "minedu-osteam/amka-api-slim-app", + "description": "A Slim Framework application for consuming the GUNET amka api", + "keywords": ["rest", "minedu"], + "homepage": "https://git.minedu.gov.gr/spapad/samples", + "license": "EUPL", + "authors": [ + { + "name": "MINEDU OPEN SOURCE TEAM", + "email": "osteam@minedu.gov.gr", + "homepage": "http://ostmgmt.minedu.gov.gr/" + }, + { + "name": "Stavros Papadakis", + "email": "spapad@gmail.com" + } + ], + "require": { + "php": ">=5.5.0", + "slim/slim": "^3.1", + "slim/php-view": "^2.0", + "monolog/monolog": "^1.17" + }, + "require-dev": { + "phpunit/phpunit": ">=4.8 < 6.0" + }, + "autoload-dev": { + "psr-4": { + "Tests\\": "tests/" + } + }, + "scripts": { + "start": "php -S 0.0.0.0:8080 -t public public/index.php", + "test": "phpunit" + } + +} diff --git a/academic-id/slim-app/composer.lock b/academic-id/slim-app/composer.lock new file mode 100644 index 0000000..3d0919b --- /dev/null +++ b/academic-id/slim-app/composer.lock @@ -0,0 +1,1740 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "879428115fc13a8594452b5562652f72", + "content-hash": "5f27dd39567b5d1d746fb58863702d06", + "packages": [ + { + "name": "container-interop/container-interop", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/container-interop/container-interop.git", + "reference": "fc08354828f8fd3245f77a66b9e23a6bca48297e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/container-interop/container-interop/zipball/fc08354828f8fd3245f77a66b9e23a6bca48297e", + "reference": "fc08354828f8fd3245f77a66b9e23a6bca48297e", + "shasum": "" + }, + "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.)", + "time": "2014-12-30 15:22:37" + }, + { + "name": "monolog/monolog", + "version": "1.22.0", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/monolog.git", + "reference": "bad29cb8d18ab0315e6c477751418a82c850d558" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/bad29cb8d18ab0315e6c477751418a82c850d558", + "reference": "bad29cb8d18ab0315e6c477751418a82c850d558", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/log": "~1.0" + }, + "provide": { + "psr/log-implementation": "1.0.0" + }, + "require-dev": { + "aws/aws-sdk-php": "^2.4.9 || ^3.0", + "doctrine/couchdb": "~1.0@dev", + "graylog2/gelf-php": "~1.0", + "jakub-onderka/php-parallel-lint": "0.9", + "php-amqplib/php-amqplib": "~2.4", + "php-console/php-console": "^3.1.3", + "phpunit/phpunit": "~4.5", + "phpunit/phpunit-mock-objects": "2.3.0", + "ruflin/elastica": ">=0.90 <3.0", + "sentry/sentry": "^0.13", + "swiftmailer/swiftmailer": "~5.3" + }, + "suggest": { + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-mongo": "Allow sending log messages to a MongoDB server", + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "php-console/php-console": "Allow sending log messages to Google Chrome", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server", + "sentry/sentry": "Allow sending log messages to a Sentry server" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Monolog\\": "src/Monolog" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "homepage": "http://github.com/Seldaek/monolog", + "keywords": [ + "log", + "logging", + "psr-3" + ], + "time": "2016-11-26 00:15:39" + }, + { + "name": "nikic/fast-route", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/nikic/FastRoute.git", + "reference": "b5f95749071c82a8e0f58586987627054400cdf6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/FastRoute/zipball/b5f95749071c82a8e0f58586987627054400cdf6", + "reference": "b5f95749071c82a8e0f58586987627054400cdf6", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "FastRoute\\": "src/" + }, + "files": [ + "src/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov", + "email": "nikic@php.net" + } + ], + "description": "Fast request router for PHP", + "keywords": [ + "router", + "routing" + ], + "time": "2017-01-19 11:35:12" + }, + { + "name": "pimple/pimple", + "version": "v3.0.2", + "source": { + "type": "git", + "url": "https://github.com/silexphp/Pimple.git", + "reference": "a30f7d6e57565a2e1a316e1baf2a483f788b258a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/silexphp/Pimple/zipball/a30f7d6e57565a2e1a316e1baf2a483f788b258a", + "reference": "a30f7d6e57565a2e1a316e1baf2a483f788b258a", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Pimple": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Pimple, a simple Dependency Injection Container", + "homepage": "http://pimple.sensiolabs.org", + "keywords": [ + "container", + "dependency injection" + ], + "time": "2015-09-11 15:10:35" + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2016-08-06 14:39:51" + }, + { + "name": "psr/log", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-10-10 12:19:37" + }, + { + "name": "slim/php-view", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/slimphp/PHP-View.git", + "reference": "122ed121a8d9cf91a94020814d2a3ee6c836754f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/slimphp/PHP-View/zipball/122ed121a8d9cf91a94020814d2a3ee6c836754f", + "reference": "122ed121a8d9cf91a94020814d2a3ee6c836754f", + "shasum": "" + }, + "require": { + "psr/http-message": "^1.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8", + "slim/slim": "^3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Slim\\Views\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Glenn Eggleton", + "email": "geggleto@gmail.com" + } + ], + "description": "Render PHP view scripts into a PSR-7 Response object.", + "keywords": [ + "framework", + "php", + "phtml", + "renderer", + "slim", + "template", + "view" + ], + "time": "2016-10-11 07:43:08" + }, + { + "name": "slim/slim", + "version": "3.7.0", + "source": { + "type": "git", + "url": "https://github.com/slimphp/Slim.git", + "reference": "4254e40d81559e35cdf856bcbaca5f3af468b7ef" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/slimphp/Slim/zipball/4254e40d81559e35cdf856bcbaca5f3af468b7ef", + "reference": "4254e40d81559e35cdf856bcbaca5f3af468b7ef", + "shasum": "" + }, + "require": { + "container-interop/container-interop": "^1.1", + "nikic/fast-route": "^1.0", + "php": ">=5.5.0", + "pimple/pimple": "^3.0", + "psr/http-message": "^1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0", + "squizlabs/php_codesniffer": "^2.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Slim\\": "Slim" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Rob Allen", + "email": "rob@akrabat.com", + "homepage": "http://akrabat.com" + }, + { + "name": "Josh Lockhart", + "email": "hello@joshlockhart.com", + "homepage": "https://joshlockhart.com" + }, + { + "name": "Gabriel Manricks", + "email": "gmanricks@me.com", + "homepage": "http://gabrielmanricks.com" + }, + { + "name": "Andrew Smith", + "email": "a.smith@silentworks.co.uk", + "homepage": "http://silentworks.co.uk" + } + ], + "description": "Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs", + "homepage": "https://slimframework.com", + "keywords": [ + "api", + "framework", + "micro", + "router" + ], + "time": "2016-12-20 20:30:47" + } + ], + "packages-dev": [ + { + "name": "doctrine/instantiator", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "shasum": "" + }, + "require": { + "php": ">=5.3,<8.0-DEV" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/doctrine/instantiator", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2015-06-14 21:17:01" + }, + { + "name": "myclabs/deep-copy", + "version": "1.6.0", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "5a5a9fc8025a08d8919be87d6884d5a92520cefe" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/5a5a9fc8025a08d8919be87d6884d5a92520cefe", + "reference": "5a5a9fc8025a08d8919be87d6884d5a92520cefe", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "doctrine/collections": "1.*", + "phpunit/phpunit": "~4.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "homepage": "https://github.com/myclabs/DeepCopy", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "time": "2017-01-26 22:05:40" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "1.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "time": "2015-12-27 11:43:31" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "3.1.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e", + "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e", + "shasum": "" + }, + "require": { + "php": ">=5.5", + "phpdocumentor/reflection-common": "^1.0@dev", + "phpdocumentor/type-resolver": "^0.2.0", + "webmozart/assert": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^4.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2016-09-30 07:12:33" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "0.2.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", + "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", + "shasum": "" + }, + "require": { + "php": ">=5.5", + "phpdocumentor/reflection-common": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^5.2||^4.8.24" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "time": "2016-11-25 06:54:22" + }, + { + "name": "phpspec/prophecy", + "version": "v1.6.2", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "6c52c2722f8460122f96f86346600e1077ce22cb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/6c52c2722f8460122f96f86346600e1077ce22cb", + "reference": "6c52c2722f8460122f96f86346600e1077ce22cb", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", + "sebastian/comparator": "^1.1", + "sebastian/recursion-context": "^1.0|^2.0" + }, + "require-dev": { + "phpspec/phpspec": "^2.0", + "phpunit/phpunit": "^4.8 || ^5.6.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6.x-dev" + } + }, + "autoload": { + "psr-0": { + "Prophecy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "time": "2016-11-21 14:58:47" + }, + { + "name": "phpunit/php-code-coverage", + "version": "4.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "c19cfc7cbb0e9338d8c469c7eedecc2a428b0971" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c19cfc7cbb0e9338d8c469c7eedecc2a428b0971", + "reference": "c19cfc7cbb0e9338d8c469c7eedecc2a428b0971", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0", + "phpunit/php-file-iterator": "~1.3", + "phpunit/php-text-template": "~1.2", + "phpunit/php-token-stream": "^1.4.2", + "sebastian/code-unit-reverse-lookup": "~1.0", + "sebastian/environment": "^1.3.2 || ^2.0", + "sebastian/version": "~1.0|~2.0" + }, + "require-dev": { + "ext-xdebug": ">=2.1.4", + "phpunit/phpunit": "^5.4" + }, + "suggest": { + "ext-dom": "*", + "ext-xdebug": ">=2.4.0", + "ext-xmlwriter": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "time": "2017-01-20 15:06:43" + }, + { + "name": "phpunit/php-file-iterator", + "version": "1.4.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5", + "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2016-10-03 07:40:28" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "time": "2015-06-21 13:50:34" + }, + { + "name": "phpunit/php-timer", + "version": "1.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260", + "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4|~5" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2016-05-12 18:03:57" + }, + { + "name": "phpunit/php-token-stream", + "version": "1.4.9", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "3b402f65a4cc90abf6e1104e388b896ce209631b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3b402f65a4cc90abf6e1104e388b896ce209631b", + "reference": "3b402f65a4cc90abf6e1104e388b896ce209631b", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "time": "2016-11-15 14:06:22" + }, + { + "name": "phpunit/phpunit", + "version": "5.7.12", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "944600e244f80a5252679878553b95c63dbf978b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/944600e244f80a5252679878553b95c63dbf978b", + "reference": "944600e244f80a5252679878553b95c63dbf978b", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "myclabs/deep-copy": "~1.3", + "php": "^5.6 || ^7.0", + "phpspec/prophecy": "^1.6.2", + "phpunit/php-code-coverage": "^4.0.4", + "phpunit/php-file-iterator": "~1.4", + "phpunit/php-text-template": "~1.2", + "phpunit/php-timer": "^1.0.6", + "phpunit/phpunit-mock-objects": "^3.2", + "sebastian/comparator": "^1.2.4", + "sebastian/diff": "~1.2", + "sebastian/environment": "^1.3.4 || ^2.0", + "sebastian/exporter": "~2.0", + "sebastian/global-state": "^1.1", + "sebastian/object-enumerator": "~2.0", + "sebastian/resource-operations": "~1.0", + "sebastian/version": "~1.0|~2.0", + "symfony/yaml": "~2.1|~3.0" + }, + "conflict": { + "phpdocumentor/reflection-docblock": "3.0.2" + }, + "require-dev": { + "ext-pdo": "*" + }, + "suggest": { + "ext-xdebug": "*", + "phpunit/php-invoker": "~1.1" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.7.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2017-02-08 05:54:05" + }, + { + "name": "phpunit/phpunit-mock-objects", + "version": "3.4.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "3ab72b65b39b491e0c011e2e09bb2206c2aa8e24" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/3ab72b65b39b491e0c011e2e09bb2206c2aa8e24", + "reference": "3ab72b65b39b491e0c011e2e09bb2206c2aa8e24", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.6 || ^7.0", + "phpunit/php-text-template": "^1.2", + "sebastian/exporter": "^1.2 || ^2.0" + }, + "conflict": { + "phpunit/phpunit": "<5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.4" + }, + "suggest": { + "ext-soap": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Mock Object library for PHPUnit", + "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "keywords": [ + "mock", + "xunit" + ], + "time": "2016-12-08 20:27:08" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "c36f5e7cfce482fde5bf8d10d41a53591e0198fe" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/c36f5e7cfce482fde5bf8d10d41a53591e0198fe", + "reference": "c36f5e7cfce482fde5bf8d10d41a53591e0198fe", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "phpunit/phpunit": "~5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "time": "2016-02-13 06:45:14" + }, + { + "name": "sebastian/comparator", + "version": "1.2.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/diff": "~1.2", + "sebastian/exporter": "~1.2 || ~2.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "http://www.github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2017-01-29 09:50:25" + }, + { + "name": "sebastian/diff", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", + "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "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" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff" + ], + "time": "2015-12-08 07:14:41" + }, + { + "name": "sebastian/environment", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac", + "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "time": "2016-11-26 07:53:53" + }, + { + "name": "sebastian/exporter", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", + "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/recursion-context": "~2.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2016-11-19 08:54:04" + }, + { + "name": "sebastian/global-state", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "time": "2015-10-12 03:26:01" + }, + { + "name": "sebastian/object-enumerator", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "96f8a3f257b69e8128ad74d3a7fd464bcbaa3b35" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/96f8a3f257b69e8128ad74d3a7fd464bcbaa3b35", + "reference": "96f8a3f257b69e8128ad74d3a7fd464bcbaa3b35", + "shasum": "" + }, + "require": { + "php": ">=5.6", + "sebastian/recursion-context": "~2.0" + }, + "require-dev": { + "phpunit/phpunit": "~5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "time": "2016-11-19 07:35:10" + }, + { + "name": "sebastian/recursion-context", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2c3ba150cbec723aa057506e73a8d33bdb286c9a", + "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2016-11-19 07:33:16" + }, + { + "name": "sebastian/resource-operations", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "shasum": "" + }, + "require": { + "php": ">=5.6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "time": "2015-07-28 20:34:47" + }, + { + "name": "sebastian/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2016-10-03 07:35:21" + }, + { + "name": "symfony/yaml", + "version": "v3.2.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "e1718c6bf57e1efbb8793ada951584b2ab27775b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/e1718c6bf57e1efbb8793ada951584b2ab27775b", + "reference": "e1718c6bf57e1efbb8793ada951584b2ab27775b", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "require-dev": { + "symfony/console": "~2.8|~3.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "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 Yaml Component", + "homepage": "https://symfony.com", + "time": "2017-01-21 17:06:35" + }, + { + "name": "webmozart/assert", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f", + "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2016-11-23 20:04:58" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.5.0" + }, + "platform-dev": [] +} diff --git a/academic-id/slim-app/logs/README.md b/academic-id/slim-app/logs/README.md new file mode 100644 index 0000000..d4a602e --- /dev/null +++ b/academic-id/slim-app/logs/README.md @@ -0,0 +1 @@ +Your Slim Framework application's log files will be written to this directory. diff --git a/academic-id/slim-app/phpunit.xml b/academic-id/slim-app/phpunit.xml new file mode 100644 index 0000000..e01fc6f --- /dev/null +++ b/academic-id/slim-app/phpunit.xml @@ -0,0 +1,7 @@ +<phpunit bootstrap="vendor/autoload.php"> + <testsuites> + <testsuite name="SampleApp"> + <directory>tests</directory> + </testsuite> + </testsuites> +</phpunit> \ No newline at end of file diff --git a/academic-id/slim-app/public/.htaccess b/academic-id/slim-app/public/.htaccess new file mode 100644 index 0000000..c506092 --- /dev/null +++ b/academic-id/slim-app/public/.htaccess @@ -0,0 +1,10 @@ +RewriteEngine On + +# Some hosts may require you to use the `RewriteBase` directive. +# If you need to use the `RewriteBase` directive, it should be the +# absolute physical path to the directory that contains this htaccess file. +# +# RewriteBase / + +RewriteCond %{REQUEST_FILENAME} !-f +RewriteRule ^ index.php [QSA,L] diff --git a/academic-id/slim-app/public/index.php b/academic-id/slim-app/public/index.php new file mode 100644 index 0000000..c0d1d62 --- /dev/null +++ b/academic-id/slim-app/public/index.php @@ -0,0 +1,42 @@ +<?php +if (PHP_SAPI == 'cli-server') { + // To help the built-in PHP dev server, check if the request was actually for + // something which should probably be served as a static file + $url = parse_url($_SERVER['REQUEST_URI']); + $file = __DIR__ . $url['path']; + if (is_file($file)) { + return false; + } +} + +$autoloader = require __DIR__ . '/../vendor/autoload.php'; + +session_name('MineduOsteamApp'); +session_start(); + +date_default_timezone_set('Europe/Athens'); + +// Instantiate the app +$settings_file = __DIR__ . '/../src/settings.php'; +if (is_readable($settings_file)) { + $settings = require($settings_file); +} else { + $settings = []; +} +$app = new \Slim\App($settings); +$container = $app->getContainer(); + +$container['autoloader'] = $autoloader; +$autoloader->addPsr4('Gr\Gov\Minedu\Osteam\Slim\\', __DIR__ . '/../src/osteam'); + +// Set up dependencies +require __DIR__ . '/../src/dependencies.php'; + +// Register routes +require __DIR__ . '/../src/routes.php'; + +// Register middleware +require __DIR__ . '/../src/middleware.php'; + +// Run app +$app->run(); diff --git a/academic-id/slim-app/src/.gitignore b/academic-id/slim-app/src/.gitignore new file mode 100644 index 0000000..edd8de6 --- /dev/null +++ b/academic-id/slim-app/src/.gitignore @@ -0,0 +1 @@ +settings.php diff --git a/academic-id/slim-app/src/dependencies.php b/academic-id/slim-app/src/dependencies.php new file mode 100644 index 0000000..ea5a0b8 --- /dev/null +++ b/academic-id/slim-app/src/dependencies.php @@ -0,0 +1,28 @@ +<?php + +// DIC configuration + +$container = $app->getContainer(); + +// view renderer +// $container['renderer'] = function ($c) { +// $settings = $c->get('settings')['renderer']; +// return new Slim\Views\PhpRenderer($settings['template_path']); +// }; + +// monolog +$container['logger'] = function ($c) { + $settings = $c->get('settings')['logger']; + $logger = new Monolog\Logger($settings['name']); + $logger->pushProcessor(new Monolog\Processor\UidProcessor()); + $logger->pushHandler(new Monolog\Handler\StreamHandler($settings['path'], $settings['level'])); + return $logger; +}; + +$container['notFoundHandler'] = function ($c) { + return new Gr\Gov\Minedu\Osteam\Slim\Handlers\NotFound; +}; + +$container['errorHandler'] = function ($c) { + return new Gr\Gov\Minedu\Osteam\Slim\Handlers\Error; +}; diff --git a/academic-id/slim-app/src/middleware.php b/academic-id/slim-app/src/middleware.php new file mode 100644 index 0000000..a8012e2 --- /dev/null +++ b/academic-id/slim-app/src/middleware.php @@ -0,0 +1,9 @@ +<?php + +$settings = $app->getContainer()->get('settings'); +$username = isset($settings['app']['secure_endpoint_username']) ? $settings['app']['secure_endpoint_username'] : ''; +$password = isset($settings['app']['secure_endpoint_password']) ? $settings['app']['secure_endpoint_password'] : ''; + +// $app->getContainer()->get('router') +// ->getNamedRoute('queryID') +// ->add(new Gr\Gov\Minedu\Osteam\Slim\AuthorizationGuard($username, $password)); diff --git a/academic-id/slim-app/src/osteam/App.php b/academic-id/slim-app/src/osteam/App.php new file mode 100644 index 0000000..6284fe5 --- /dev/null +++ b/academic-id/slim-app/src/osteam/App.php @@ -0,0 +1,128 @@ +<?php + +namespace Gr\Gov\Minedu\Osteam\Slim; + +use Interop\Container\ContainerInterface; +use Slim\Http\Body; +use Gr\Gov\Minedu\Osteam\Slim\BaseApp; +use Gr\Gov\Minedu\Osteam\Slim\Client; + +/** + * Description of app + * + * @author spapad + */ +class App extends BaseApp +{ + private $urlAcademicId = ''; + private $urlAmka = ''; + + protected $username = ''; + protected $password = ''; + protected $secureEndpointUsername = ''; + protected $secureEndpointPassword = ''; + + public function __construct(ContainerInterface $ci) + { + parent::__construct($ci); + + $settings = $this->ci->get('settings'); + if (isset($settings['app'])) { + $this->username = (isset($settings['app']['username']) ? $settings['app']['username'] : ''); + $this->password = (isset($settings['app']['password']) ? $settings['app']['password'] : 0); + $this->secureEndpointUsername = (isset($settings['app']['secure_endpoint_username']) ? $settings['app']['secure_endpoint_username'] : ''); + $this->secureEndpointPassword = (isset($settings['app']['secure_endpoint_password']) ? $settings['app']['secure_endpoint_password'] : ''); + } + + $this->urlAcademicId = 'https://academicidapp.grnet.gr/admin/web/ws/users/inspectAcademicID'; + $this->urlAmka = 'https://academicidapp.grnet.gr/admin/web/ws/users/inspectAMKA'; + } + + protected function generateAuth() + { + $pass_md5 = md5($this->password); + return "Basic " . base64_encode("{$this->username}:{$pass_md5}"); + } + + /** + * + * @param Psr\Http\Message\ServerRequestInterface $req + * @param Psr\Http\Message\ResponseInterface $res + * @param $args + * @throws \Exception + * @return Response + */ + public function queryID($req, $res, $args) + { + $identity = $args['identity']; + if (preg_match('/^[0-9]{12}$/', $identity) !== 1) { + return $res->withJson(array_merge(BaseApp::coreResponseData(false), [ + 'message' => 'Error: Service call parameters error, academic id must be 12 digit number' + ]), 400); + } + + $data = json_encode([ + "SubmissionCode" => $identity + ]); + + $this->logger->info("queryID::{$identity}"); + + $auth = $this->generateAuth(); + $headers = [ + "Authorization: {$auth}", + 'Content-Type: application/json', + 'Accept: */*', + 'User-Agent: Academic ID SLIM Client/v1.0 osteam' + ]; + + $results = $this->client->post($this->urlAcademicId, $data, $headers); + if ($results['success'] === false) { + return $this->withJsonReady($res, $results['response'], $results['http_status']); + } + $result = $results['response']; + return $this->withJsonReady($res, $result); + } + + /** + * + * @param Psr\Http\Message\ServerRequestInterface $req + * @param Psr\Http\Message\ResponseInterface $res + * @param $args + * @throws \Exception + * @return Response + */ + public function student($req, $res, $args) + { + $identity = $args['identity']; + if (preg_match('/^[0-9]{11}$/', $identity) !== 1) { + return $res->withJson(array_merge(BaseApp::coreResponseData(false), [ + 'message' => 'Error: Service call parameters error, AMKA must be 11 digit number' + ]), 400); + } + + $data = json_encode([ + "AMKA" => $identity + ]); + + $this->logger->info("queryID::{$identity}"); + + $auth = $this->generateAuth(); + $headers = [ + "Authorization: {$auth}", + 'Content-Type: application/json', + 'Accept: */*', + 'User-Agent: Academic ID SLIM Client/v1.0 osteam' + ]; + + $results = $this->client->post($this->urlAmka, $data, $headers); + if ($results['success'] === false) { + return $this->withJsonReady($res, $results['response'], $results['http_status']); + } + $result = $results['response']; + return $this->withJsonReady($res, $result); + } + + + // queryIDnoCD + // testServiceStatus +} diff --git a/academic-id/slim-app/src/osteam/AuthorizationGuard.php b/academic-id/slim-app/src/osteam/AuthorizationGuard.php new file mode 100644 index 0000000..649a5d0 --- /dev/null +++ b/academic-id/slim-app/src/osteam/AuthorizationGuard.php @@ -0,0 +1,75 @@ +<?php + +namespace Gr\Gov\Minedu\Osteam\Slim; + +use Psr\Http\Message\RequestInterface; +use Psr\Http\Message\ResponseInterface; + +if (!function_exists('getallheaders')) +{ + function getallheaders() + { + $headers = ''; + foreach ($_SERVER as $name => $value) + { + if (substr($name, 0, 5) == 'HTTP_') + { + $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value; + } + } + return $headers; + } +} + +class AuthorizationGuard +{ + private $_username; + private $_password; + + public function __construct($username, $password) + { + $this->_username = $username; + $this->_password = $password; + } + + /** + * Check for authorization basic token + * + * @param \Psr\Http\Message\ServerRequestInterface $request PSR7 request + * @param \Psr\Http\Message\ResponseInterface $response PSR7 response + * @param callable $next Next middleware + * + * @return \Psr\Http\Message\ResponseInterface + */ + public function __invoke(RequestInterface $request, ResponseInterface $response, callable $next) + { + + $auth = true; + $headers = getallheaders(); + if (array_key_exists('Authorization', $headers)) { + $header = $headers['Authorization']; + $auth_parts = []; + if (preg_match('/^Basic (.+)$/', $header, $auth_parts) === 1) { + if ($auth_parts[1] !== base64_encode("{$this->_username}:{$this->_password}")) { + $auth = [ + "message" => "Error: Invalid Credentials" + ]; + } + } else { + $auth = [ + "message" => "Error: Mallformed Authorization Header" + ]; + } + } else { + $auth = [ + "message" => "Error: Missing Authorization Header" + ]; + } + + if ($auth !== true) { + return $response->withJson(array_merge(BaseApp::coreResponseData(false), $auth), 401); + } else { + return $next($request, $response); + } + } +} diff --git a/academic-id/slim-app/src/osteam/BaseApp.php b/academic-id/slim-app/src/osteam/BaseApp.php new file mode 100644 index 0000000..6910397 --- /dev/null +++ b/academic-id/slim-app/src/osteam/BaseApp.php @@ -0,0 +1,120 @@ +<?php + +namespace Gr\Gov\Minedu\Osteam\Slim; + +use Interop\Container\ContainerInterface; +use Slim\Http\Body; +use Gr\Gov\Minedu\Osteam\Slim\Client; + +/** + * Ξ Ξ±ΟΞΟΡι μΡθΟΞ΄ΞΏΟ Ο Ξ΅Ο ΞΊΞΏΞ»Ξ―Ξ±Ο Ξ³ΞΉΞ± ΟΞΉΟ Ξ΅ΟΞ±ΟΞΌΞΏΞ³ΞΟ. + * Ξ ΞΉΞΈΞ±Ξ½ΞΟ Ξ΅ΟΞ±ΟΞΌΞΏΞ³ΞΟ ΞΌΟΞΏΟΞΏΟΞ½ Ξ½Ξ± ΞΊΞ¬Ξ½ΞΏΟ Ξ½ etxend Ξ±Ο ΟΞ� ΟΞ·Ξ½ κλάΟΞ·. + * + * @author spapad + */ +class BaseApp +{ + + protected $ci = null; + protected $logger = null; + protected $debug = false; + protected $client = null; + + /** + * ΞΞ±ΟΞ±ΟΞΊΞ΅Ο Ξ� ΟΞ·Ο ΞΊΞ»Ξ¬ΟΞ·Ο ΞΊΞ±ΞΉ ΟΟλαξη ΟΞΏΟ container ΞΊΞ±ΞΉ ΟΞΏΟ logger. + */ + public function __construct(ContainerInterface $ci) + { + $this->ci = $ci; + if (($logger = $this->ci->get('logger')) != null) { + $this->logger = $logger; + } + $this->client = new Client([ + 'NO_SAFE_CURL' => (isset($settings['verify_ssl']) ? $settings['verify_ssl'] === false : false), + ]); + } + + /** + * Ξ Ξ±ΟΞΟΡι ΟΞΉΟ Ξ΅Ξ»Ξ¬ΟΞΉΟΟΞ΅Ο ΞΉΞ΄ΞΉΟΟΞ·ΟΞ΅Ο Ξ³ΞΉΞ± ΟΞΏ Ξ±ΟΞ±Ξ½ΟΞ·ΟΞΉΞΊΟ ΞΌΞ�Ξ½Ο ΞΌΞ±. + * success: true Ξ� false + * timestamp: date ΟΞ΅ ΞΌΞΏΟΟΞ� ISO8601 + * + * @param boolean $success ΞΟΞΉΟΟ ΟΞ�Ο Ξ� ΟΟΞΉ ΞΊΞ»Ξ�ΟΞ· + * @return array + */ + public static function coreResponseData($success) + { + return [ + 'success' => $success === true, + 'timestamp' => date('c') + ]; + } + + /** + * ΞΟΞΏΟΟΞΏΞ»Ξ� ΞΟΞΏΞΉΞΌΞΏΟ Ξ΄ΞΉΞ±ΞΌΞΏΟΟΟΞΌΞΞ½ΞΏΟ json response. + * + * @param Response $res + * @param mixed $data Ξ ΟοδιαμοΟΟΟΞΌΞΞ½ΞΏ json κΡίμΡνο + * @param int $status HTTP status code Ξ³ΞΉΞ± Ξ±ΟΞΏΟΟΞΏΞ»Ξ� + * @return response + */ + public function withJsonReady($res, $data, $status = null) + { + $response = $res->withBody(new Body(fopen('php://temp', 'r+'))); + $response->getBody()->write($data); + + $jsonResponse = $response->withHeader('Content-Type', 'application/json;charset=utf-8'); + if (isset($status)) { + return $jsonResponse->withStatus($status); + } + return $jsonResponse; + } + + /** + * ΞΟΞΏΟΟΞΏΞ»Ξ� response Ξ±ΟΞ»ΞΏΟ ΞΊΞ΅ΞΉΞΌΞΞ½ΞΏΟ . + * + * @param Response $res + * @param mixed $data ΀ο κΡίμΡνο ΟΟΞΏΟ Ξ±ΟΞΏΟΟΞΏΞ»Ξ� + * @param int $status HTTP status code Ξ³ΞΉΞ± Ξ±ΟΞΏΟΟΞΏΞ»Ξ� + * @return response + */ + public function withTextReady($res, $data, $status = null) + { + $response = $res->withBody(new Body(fopen('php://temp', 'r+'))); + $response->getBody()->write($data); + + $textResponse = $response->withHeader('Content-Type', 'text/plain'); + if (isset($status)) { + return $textResponse->withStatus($status); + } + return $textResponse; + } + + protected function log($msg) + { + if ($this->logger) { + $this->logger->info($msg); + } + } + + /** + * + */ + public function setDebug($debug = true) + { + $this->debug = ($debug === true); + } + + /** + * ΞλλαγΞ� ΟΞ±ΟΞ±ΞΊΟΞ�ΟΟΞ½ ΟΟΟΞ΅ ΟΞΏ ΟΞ½ΞΏΞΌΞ± ΟΞΏΟ ΟΞ±ΟΞΟΞ΅ΟΞ±ΞΉ Ξ½Ξ± Ρίναι Ξ±ΟΟΞ±Ξ»ΞΟ Ξ³ΞΉΞ± + * ΟΟΞ�ΟΞ· ΟΟ ΟΞ½ΞΏΞΌΞ± Ξ±ΟΟΞ΅Ξ―ΞΏΟ . + * + * @param string $filename + * @return string + */ + protected function sanitizeFilename($filename) + { + return mb_ereg_replace("([^\w\s\d\-_,.])", '_', $filename); + } + +} diff --git a/academic-id/slim-app/src/osteam/Client.php b/academic-id/slim-app/src/osteam/Client.php new file mode 100644 index 0000000..02bffc5 --- /dev/null +++ b/academic-id/slim-app/src/osteam/Client.php @@ -0,0 +1,144 @@ +<?php + +/* + * + */ + +namespace Gr\Gov\Minedu\Osteam\Slim; + +use Exception; + +/** + * Description of Client + * + * @author spapad + */ +class Client +{ + + private $_debug = false; + private $_settings = [ + 'base_uri' => '' // must set this + ]; + + public function __construct($settings = []) + { + $this->_settings = array_merge($this->_settings, $settings); + } + + protected function setCommonCurlOptions($ch, $uri, $headers) + { + curl_setopt($ch, CURLOPT_URL, $uri); + curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); + curl_setopt($ch, CURLOPT_USERAGENT, "OSTEAM SLIM client"); + if (isset($this->_settings['NO_SAFE_CURL']) && $this->_settings['NO_SAFE_CURL'] === true) { + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + } + + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); + curl_setopt($ch, CURLOPT_MAXREDIRS, 3); + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); + if ($this->_debug === true) { + curl_setopt($ch, CURLOPT_VERBOSE, true); + } + } + + public function put($uri, $payload, $headers = []) + { + $ch = curl_init(); + + $this->setCommonCurlOptions($ch, $uri, $headers); + + // curl_setopt($ch, CURLOPT_PUT, true); + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT"); + curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + + $result = curl_exec($ch); + + if (curl_errno($ch)) { + throw new Exception("ΞΞ¬ΞΈΞΏΟ ΞΊΞ±ΟΞ¬ ΟΞ·Ξ½ ΞΊΞ»Ξ�ΟΞ· ΟΞΏΟ {$uri}. Curl error: " . curl_error($ch) . " Curl info: " . var_export(curl_getinfo($ch), true)); + } + if (intval(($http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE)) / 100) != 2) { + // ΟΟΞ±Ξ³ΞΌΞ±ΟΞΏΟΞΏΞΉΞ�ΞΈΞ·ΞΊΞ΅ ΞΊΞ»Ξ�ΟΞ· αλλά δΡν Ξ�ΟΞ±Ξ½ "Ξ΅ΟΞΉΟΟ ΟΞ�Ο" + throw new Exception("ΞΟΞΏΟΟ ΟΞ·ΞΌΞΞ½Ξ· ΞΊΞ»Ξ�ΟΞ·. HTTP STATUS {$http_code}. Ξ Ξ±ΟάνΟΞ·ΟΞ· Ξ�ΟΞ±Ξ½: {$result}", $http_code); + } + curl_close($ch); + return $result; + } + + public function post($uri, $payload, $headers = []) + { + $ch = curl_init(); + + $this->setCommonCurlOptions($ch, $uri, $headers); + + curl_setopt($ch, CURLOPT_POST, true); + curl_setopt($ch, CURLOPT_POSTFIELDS, $payload); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + + $result = curl_exec($ch); + + if (curl_errno($ch)) { + throw new Exception("ΞΞ¬ΞΈΞΏΟ ΞΊΞ±ΟΞ¬ ΟΞ·Ξ½ ΞΊΞ»Ξ�ΟΞ· ΟΞΏΟ {$uri}. Curl error: " . curl_error($ch) . " Curl info: " . var_export(curl_getinfo($ch), true)); + } + if (intval(($http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE)) / 100) != 2) { + // ΟΟΞ±Ξ³ΞΌΞ±ΟΞΏΟΞΏΞΉΞ�ΞΈΞ·ΞΊΞ΅ ΞΊΞ»Ξ�ΟΞ· αλλά δΡν Ξ�ΟΞ±Ξ½ "Ξ΅ΟΞΉΟΟ ΟΞ�Ο" + return [ + 'success' => false, + 'http_status' => $http_code, + 'response' => $result + ]; + // throw new Exception("ΞΟΞΏΟΟ ΟΞ·ΞΌΞΞ½Ξ· ΞΊΞ»Ξ�ΟΞ·. HTTP STATUS {$http_code}. Ξ Ξ±ΟάνΟΞ·ΟΞ· Ξ�ΟΞ±Ξ½: {$result}", $http_code); + } + curl_close($ch); + return [ + 'success' => true, + 'http_status' => $http_code, + 'response' => $result + ]; + } + + public function get($uri, $params = [], $headers = []) + { + $ch = curl_init(); + + if (is_array($params) && count($params) > 0) { + $qs = '?' . http_build_query($params); + } else { + $qs = ''; + } + $this->setCommonCurlOptions($ch, "{$uri}{$qs}", $headers); + +// curl_setopt($ch, CURLOPT_HTTPGET, true); // default + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + + $result = curl_exec($ch); + + if (curl_errno($ch)) { + throw new Exception("ΞΞ¬ΞΈΞΏΟ ΞΊΞ±ΟΞ¬ ΟΞ·Ξ½ ΞΊΞ»Ξ�ΟΞ· ΟΞΏΟ {$uri}. Curl error: " . curl_error($ch) . " Curl info: " . var_export(curl_getinfo($ch), true)); + } + if (intval(($http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE)) / 100) != 2) { + // ΟΟΞ±Ξ³ΞΌΞ±ΟΞΏΟΞΏΞΉΞ�ΞΈΞ·ΞΊΞ΅ ΞΊΞ»Ξ�ΟΞ· αλλά δΡν Ξ�ΟΞ±Ξ½ "Ξ΅ΟΞΉΟΟ ΟΞ�Ο" + return [ + 'success' => false, + 'http_status' => $http_code, + 'response' => $result + ]; + // throw new Exception("ΞΟΞΏΟΟ ΟΞ·ΞΌΞΞ½Ξ· ΞΊΞ»Ξ�ΟΞ·. HTTP STATUS {$http_code}. Ξ Ξ±ΟάνΟΞ·ΟΞ· Ξ�ΟΞ±Ξ½: {$result}", $http_code); + } + curl_close($ch); + return [ + 'success' => true, + 'http_status' => $http_code, + 'response' => $result + ]; + } + + public function setDebug($debug = true) + { + $this->_debug = ($debug === true); + return; + } + +} diff --git a/academic-id/slim-app/src/osteam/Handlers/Error.php b/academic-id/slim-app/src/osteam/Handlers/Error.php new file mode 100644 index 0000000..d130ed5 --- /dev/null +++ b/academic-id/slim-app/src/osteam/Handlers/Error.php @@ -0,0 +1,32 @@ +<?php +namespace Gr\Gov\Minedu\Osteam\Slim\Handlers; + +use Psr\Http\Message\ServerRequestInterface; +use Psr\Http\Message\ResponseInterface; +use Slim\Handlers\AbstractError; +use Gr\Gov\Minedu\Osteam\Slim\BaseApp; + +/** + * Error handler. + */ +class Error extends AbstractError +{ + /** + * Invoke error handler + * + * @param ServerRequestInterface $request The most recent Request object + * @param ResponseInterface $response The most recent Response object + * @param \Exception $exception The caught Exception object + * + * @return ResponseInterface + * @throws UnexpectedValueException + */ + public function __invoke(ServerRequestInterface $request, ResponseInterface $response, \Exception $exception) + { + return $response->withJson(array_merge(BaseApp::coreResponseData(false), [ + 'message' => 'An error occured', + 'in' => $exception->getMessage() + ]), intval($code = $exception->getCode()) > 0 ? $code : null); + } + +} diff --git a/academic-id/slim-app/src/osteam/Handlers/NotFound.php b/academic-id/slim-app/src/osteam/Handlers/NotFound.php new file mode 100644 index 0000000..2452917 --- /dev/null +++ b/academic-id/slim-app/src/osteam/Handlers/NotFound.php @@ -0,0 +1,30 @@ +<?php +namespace Gr\Gov\Minedu\Osteam\Slim\Handlers; + +use Psr\Http\Message\ServerRequestInterface; +use Psr\Http\Message\ResponseInterface; +use Slim\Handlers\AbstractHandler; +use Gr\Gov\Minedu\Osteam\Slim\BaseApp; + +/** + * JSON not found handler. + */ +class NotFound extends AbstractHandler +{ + /** + * Invoke not found handler + * + * @param ServerRequestInterface $request The most recent Request object + * @param ResponseInterface $response The most recent Response object + * + * @return ResponseInterface + * @throws UnexpectedValueException + */ + public function __invoke(ServerRequestInterface $request, ResponseInterface $response) + { + return $response->withJson(array_merge(BaseApp::coreResponseData(false), [ + 'message' => 'Not found' + ]), 404); + } + +} diff --git a/academic-id/slim-app/src/routes.php b/academic-id/slim-app/src/routes.php new file mode 100644 index 0000000..976cd31 --- /dev/null +++ b/academic-id/slim-app/src/routes.php @@ -0,0 +1,15 @@ +<?php + +$app->get('/queryID/{identity}', '\Gr\Gov\Minedu\Osteam\Slim\App:queryID') + ->setName('queryID'); + +$app->get('/student/{identity}', '\Gr\Gov\Minedu\Osteam\Slim\App:student') + ->setName('student'); + +$app->any('/[{anythingelse}]', function ($request, $response, $args) { + $this->logger->info("Void response, no action route was enabled"); + return $response->withJson([ + 'message' => 'Your request is not valid', + 'in' => var_export($args, true) + ], 404); +}); diff --git a/academic-id/slim-app/src/settings.php.dist b/academic-id/slim-app/src/settings.php.dist new file mode 100644 index 0000000..b112e14 --- /dev/null +++ b/academic-id/slim-app/src/settings.php.dist @@ -0,0 +1,26 @@ +<?php + +return [ + 'settings' => [ + 'displayErrorDetails' => true, // set to false in production + 'addContentLengthHeader' => false, // Allow the web server to send the content-length header + // Renderer settings + 'renderer' => [ + 'template_path' => __DIR__ . '/../templates/', + ], + // Monolog settings + 'logger' => [ + 'name' => 'slim-app', + 'path' => __DIR__ . '/../logs/app.log', + 'level' => \Monolog\Logger::DEBUG, + ], + // + // app custom settings + 'app' => [ + 'username' => 'username-for-endpoint', + 'password' => 'password-for-endpoint', + 'secure_endpoint_username' => 'username-for-this-wrapper', + 'secure_endpoint_password' => 'password-for-this-wrapper', + ] + ], +]; diff --git a/academic-id/slim-app/templates/index.phtml b/academic-id/slim-app/templates/index.phtml new file mode 100644 index 0000000..ea58714 --- /dev/null +++ b/academic-id/slim-app/templates/index.phtml @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"/> + <title>Slim 3</title> + <link href='//fonts.googleapis.com/css?family=Lato:300' rel='stylesheet' type='text/css'> + <style> + body { + margin: 50px 0 0 0; + padding: 0; + width: 100%; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + text-align: center; + color: #aaa; + font-size: 18px; + } + + h1 { + color: #719e40; + letter-spacing: -3px; + font-family: 'Lato', sans-serif; + font-size: 100px; + font-weight: 200; + margin-bottom: 0; + } + </style> + </head> + <body> + <h1>Slim</h1> + <div>a microframework for PHP</div> + + <?php if (isset($name)) : ?> + <h2>Hello <?= htmlspecialchars($name); ?>!</h2> + <?php else: ?> + <p>Try <a href="http://www.slimframework.com">SlimFramework</a></p> + <?php endif; ?> + </body> +</html> diff --git a/academic-id/slim-app/tests/Functional/BaseTestCase.php b/academic-id/slim-app/tests/Functional/BaseTestCase.php new file mode 100644 index 0000000..095d8da --- /dev/null +++ b/academic-id/slim-app/tests/Functional/BaseTestCase.php @@ -0,0 +1,77 @@ +<?php + +namespace Tests\Functional; + +use Slim\App; +use Slim\Http\Request; +use Slim\Http\Response; +use Slim\Http\Environment; + +/** + * This is an example class that shows how you could set up a method that + * runs the application. Note that it doesn't cover all use-cases and is + * tuned to the specifics of this skeleton app, so if your needs are + * different, you'll need to change it. + */ +class BaseTestCase extends \PHPUnit_Framework_TestCase +{ + /** + * Use middleware when running application? + * + * @var bool + */ + protected $withMiddleware = true; + + /** + * Process the application given a request method and URI + * + * @param string $requestMethod the request method (e.g. GET, POST, etc.) + * @param string $requestUri the request URI + * @param array|object|null $requestData the request data + * @return \Slim\Http\Response + */ + public function runApp($requestMethod, $requestUri, $requestData = null) + { + // Create a mock environment for testing with + $environment = Environment::mock( + [ + 'REQUEST_METHOD' => $requestMethod, + 'REQUEST_URI' => $requestUri + ] + ); + + // Set up a request object based on the environment + $request = Request::createFromEnvironment($environment); + + // Add request data, if it exists + if (isset($requestData)) { + $request = $request->withParsedBody($requestData); + } + + // Set up a response object + $response = new Response(); + + // Use the application settings + $settings = require __DIR__ . '/../../src/settings.php'; + + // Instantiate the application + $app = new App($settings); + + // Set up dependencies + require __DIR__ . '/../../src/dependencies.php'; + + // Register middleware + if ($this->withMiddleware) { + require __DIR__ . '/../../src/middleware.php'; + } + + // Register routes + require __DIR__ . '/../../src/routes.php'; + + // Process the application + $response = $app->process($request, $response); + + // Return the response + return $response; + } +} diff --git a/academic-id/slim-app/tests/Functional/HomepageTest.php b/academic-id/slim-app/tests/Functional/HomepageTest.php new file mode 100644 index 0000000..17caf91 --- /dev/null +++ b/academic-id/slim-app/tests/Functional/HomepageTest.php @@ -0,0 +1,40 @@ +<?php + +namespace Tests\Functional; + +class HomepageTest extends BaseTestCase +{ + /** + * Test that the index route returns a rendered response containing the text 'SlimFramework' but not a greeting + */ + public function testGetHomepageWithoutName() + { + $response = $this->runApp('GET', '/'); + + $this->assertEquals(200, $response->getStatusCode()); + $this->assertContains('SlimFramework', (string)$response->getBody()); + $this->assertNotContains('Hello', (string)$response->getBody()); + } + + /** + * Test that the index route with optional name argument returns a rendered greeting + */ + public function testGetHomepageWithGreeting() + { + $response = $this->runApp('GET', '/name'); + + $this->assertEquals(200, $response->getStatusCode()); + $this->assertContains('Hello name!', (string)$response->getBody()); + } + + /** + * Test that the index route won't accept a post request + */ + public function testPostHomepageNotAllowed() + { + $response = $this->runApp('POST', '/', ['test']); + + $this->assertEquals(405, $response->getStatusCode()); + $this->assertContains('Method not allowed', (string)$response->getBody()); + } +} \ No newline at end of file -- GitLab