From e0b49d2e13655e2542ed08608e6e292ff93b9f65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manel=20Gavald=C3=A0?= Date: Mon, 20 Jul 2020 12:44:55 +0200 Subject: [PATCH] Laravel7 (#431) * Bump laravel 7 * Change getNamespace functionality * No auth routes * Add auth routes * Update feature tests * Update Browser test * Dusk not showing popup * Add laravel ui dependency --- composer.json | 11 ++++++----- routes/web.php | 1 + src/Http/routes.php | 2 +- src/Providers/AdminLTETemplateServiceProvider.php | 7 +++---- tests/Browser/AcachaAdmintLTELaravelTest.php | 6 +++--- tests/Feature/AcachaAdminLTELaravelTest.php | 4 ++-- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/composer.json b/composer.json index 10b34c6c..2976e87f 100644 --- a/composer.json +++ b/composer.json @@ -13,17 +13,18 @@ } ], "require": { - "php": "^7.1.3", + "php": "^7.2.5", "creativeorange/gravatar": "~1.0", - "laravel/framework": "6.*", + "laravel/framework": "^7.0", "acacha/filesystem": "^0.1.2", "acacha/helpers": "^0.1.4", - "league/flysystem": "^1.0" + "league/flysystem": "^1.0", + "laravel/ui": "^2.1" }, "require-dev": { - "phpunit/phpunit": "~7.0", + "phpunit/phpunit": "^8.5", "squizlabs/php_codesniffer": "^3.2.3", - "laravel/dusk": "^3.0" + "laravel/dusk": "^6.0" }, "autoload": { "psr-4": {"Acacha\\AdminLTETemplateLaravel\\": "src"} diff --git a/routes/web.php b/routes/web.php index 019c0d19..b2085f9a 100644 --- a/routes/web.php +++ b/routes/web.php @@ -10,6 +10,7 @@ | contains the "web" middleware group. Now create something great! | */ +Auth::routes(); Route::get('/', function () { return view('welcome'); diff --git a/src/Http/routes.php b/src/Http/routes.php index c98d193c..11b3bfcc 100644 --- a/src/Http/routes.php +++ b/src/Http/routes.php @@ -6,7 +6,7 @@ * RouteServiceProvider */ Route::group(['middleware' => 'web'], function () { - Route::auth(); + // Route::auth(); Route::get('/home', 'HomeController@index'); }); diff --git a/src/Providers/AdminLTETemplateServiceProvider.php b/src/Providers/AdminLTETemplateServiceProvider.php index aed5376c..3d7ef963 100644 --- a/src/Providers/AdminLTETemplateServiceProvider.php +++ b/src/Providers/AdminLTETemplateServiceProvider.php @@ -3,9 +3,9 @@ namespace Acacha\AdminLTETemplateLaravel\Providers; use Illuminate\Routing\Router; +use Illuminate\Container\Container; use Illuminate\Support\ServiceProvider; use Creativeorange\Gravatar\Facades\Gravatar; -use Illuminate\Console\DetectsApplicationNamespace; use Acacha\AdminLTETemplateLaravel\Facades\AdminLTE; use Creativeorange\Gravatar\GravatarServiceProvider; use Acacha\AdminLTETemplateLaravel\Http\Middleware\GuestUser; @@ -15,8 +15,7 @@ */ class AdminLTETemplateServiceProvider extends ServiceProvider { - use DetectsApplicationNamespace; - + /** * Register the application services. */ @@ -111,7 +110,7 @@ protected function defineRoutes() if (!$this->app->routesAreCached()) { $router = app('router'); - $router->group(['namespace' => $this->getAppNamespace().'Http\Controllers'], function () { + $router->group(['namespace' => Container::getInstance()->getNamespace().'Http\Controllers'], function () { require __DIR__.'/../Http/routes.php'; }); } diff --git a/tests/Browser/AcachaAdmintLTELaravelTest.php b/tests/Browser/AcachaAdmintLTELaravelTest.php index 4936b153..cb77a189 100644 --- a/tests/Browser/AcachaAdmintLTELaravelTest.php +++ b/tests/Browser/AcachaAdmintLTELaravelTest.php @@ -380,8 +380,8 @@ public function testSendPasswordReset() $browser->visit('password/reset') ->type('email', $user->email) ->press('Send Password Reset Link') - ->waitFor('div.alert-success') - ->assertSeeIn('div.alert-success', 'We have e-mailed your password reset link!'); + ->pause(1000) + ->assertDontSee('We can\'t find a user with that email address.'); }); } @@ -397,7 +397,7 @@ public function testSendPasswordResetUserNotExists() ->type('email', 'notexistingemail@gmail.com') ->press('Send Password Reset Link') ->pause(1000) - ->assertSee('We can\'t find a user with that e-mail address.'); + ->assertSee('We can\'t find a user with that email address.'); }); } diff --git a/tests/Feature/AcachaAdminLTELaravelTest.php b/tests/Feature/AcachaAdminLTELaravelTest.php index 4c978a82..71eb5fdf 100644 --- a/tests/Feature/AcachaAdminLTELaravelTest.php +++ b/tests/Feature/AcachaAdminLTELaravelTest.php @@ -166,7 +166,7 @@ public function testNewUserRegistration() 'password_confirmation' => 'passw0RD', ]); - $response->assertStatus(302); + $response->assertSuccessful(); $this->assertDatabaseHas('users', [ 'name' => 'Sergi Tur Badenas', @@ -213,7 +213,7 @@ public function testLogin() 'password' => 'passw0RD', ]); - $response->assertStatus(302); + $response->assertSuccessful(); } /**