From 5d7e520f4b2b1c3c7807b41e7f5057e4b9503e7f Mon Sep 17 00:00:00 2001 From: willyreyno Date: Tue, 17 Sep 2019 10:55:00 +0200 Subject: [PATCH 1/4] Add middleware to routes and configurable env variable --- config/graphqlite.php | 1 + src/routes/routes.php | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/config/graphqlite.php b/config/graphqlite.php index 4f26a9a6a2..9ce7a57b79 100644 --- a/config/graphqlite.php +++ b/config/graphqlite.php @@ -20,4 +20,5 @@ 'types' => 'App\\', 'debug' => Debug::RETHROW_UNSAFE_EXCEPTIONS, 'uri' => '/graphql', + 'middleware' => env('GRAPHQLITE_MW', ['web']), ]; diff --git a/src/routes/routes.php b/src/routes/routes.php index 19f6acfb34..5046479033 100644 --- a/src/routes/routes.php +++ b/src/routes/routes.php @@ -1,6 +1,8 @@ config('graphqlite.middleware')], function () { + $uri = config('graphqlite.uri', '/graphql'); -Route::get($uri, 'TheCodingMachine\\GraphQLite\\Laravel\\Controllers\\GraphQLiteController@index'); -Route::post($uri, 'TheCodingMachine\\GraphQLite\\Laravel\\Controllers\\GraphQLiteController@index'); + Route::get($uri, 'TheCodingMachine\\GraphQLite\\Laravel\\Controllers\\GraphQLiteController@index'); + Route::post($uri, 'TheCodingMachine\\GraphQLite\\Laravel\\Controllers\\GraphQLiteController@index'); +}); \ No newline at end of file From ca2810852c7a9f557bef0f81a968677bd1f717de Mon Sep 17 00:00:00 2001 From: willyreyno Date: Tue, 17 Sep 2019 12:07:42 +0200 Subject: [PATCH 2/4] Remove env variable because array can't be passed through env var --- config/graphqlite.php | 2 +- src/routes/routes.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/graphqlite.php b/config/graphqlite.php index 9ce7a57b79..efe415323a 100644 --- a/config/graphqlite.php +++ b/config/graphqlite.php @@ -20,5 +20,5 @@ 'types' => 'App\\', 'debug' => Debug::RETHROW_UNSAFE_EXCEPTIONS, 'uri' => '/graphql', - 'middleware' => env('GRAPHQLITE_MW', ['web']), + 'middleware' => ['web'], ]; diff --git a/src/routes/routes.php b/src/routes/routes.php index 5046479033..9edcea36cf 100644 --- a/src/routes/routes.php +++ b/src/routes/routes.php @@ -1,6 +1,6 @@ config('graphqlite.middleware')], function () { +Route::group(['middleware' => config('graphqlite.middleware', ['web'])], function () { $uri = config('graphqlite.uri', '/graphql'); Route::get($uri, 'TheCodingMachine\\GraphQLite\\Laravel\\Controllers\\GraphQLiteController@index'); From 682269fddd38324b6bf2ce0383f1532396d8e9ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Thu, 26 Sep 2019 17:14:46 +0200 Subject: [PATCH 3/4] Fixing encryption error message --- phpunit.xml.dist | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index c40c0becd3..9a2c7e34ad 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -16,6 +16,10 @@ + + + + src/ From a27f08508ae55bd776d66dff7d6a9c3bc35f1266 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Thu, 26 Sep 2019 17:19:13 +0200 Subject: [PATCH 4/4] Fixing testbench version to allow testing on Laravel 6 --- composer.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index bf643f6fc2..3feed57d9a 100644 --- a/composer.json +++ b/composer.json @@ -25,6 +25,11 @@ "symfony/psr-http-message-bridge": "^1", "zendframework/zend-diactoros": "^1.8.6" }, + "require-dev": { + "orchestra/testbench": "^3.5.5 || ^4", + "phpunit/phpunit": "^7.5.4 || ^8.3", + "ext-sqlite3": "*" + }, "autoload" : { "psr-4" : { "TheCodingMachine\\GraphQLite\\Laravel\\" : "src/" @@ -40,11 +45,6 @@ ] } }, - "require-dev": { - "orchestra/testbench": "^3.5.5", - "phpunit/phpunit": "^7.5.4", - "ext-sqlite3": "*" - }, "minimum-stability": "dev", "prefer-stable": true }