diff --git a/routes/web.php b/routes/web.php index 59a6eddc6..b6eda7c51 100644 --- a/routes/web.php +++ b/routes/web.php @@ -14,7 +14,7 @@ Route::group(['middleware' => 'auth'], function () { // Shelves Route::get('/create-shelf', 'BookshelfController@create'); - Route::group(['prefix' => 'shelves'], function() { + Route::group(['prefix' => 'shelves'], function () { Route::get('/', 'BookshelfController@index'); Route::post('/', 'BookshelfController@store'); Route::get('/{slug}/edit', 'BookshelfController@edit'); diff --git a/tests/Auth/SocialAuthTest.php b/tests/Auth/SocialAuthTest.php index 4369d8b7a..d412e8c94 100644 --- a/tests/Auth/SocialAuthTest.php +++ b/tests/Auth/SocialAuthTest.php @@ -1,5 +1,6 @@ assertDontSee("login-form"); } + public function test_social_account_detach() + { + $editor = $this->getEditor(); + config([ + 'GITHUB_APP_ID' => 'abc123', 'GITHUB_APP_SECRET' => '123abc', + 'APP_URL' => 'http://localhost' + ]); + + $socialAccount = SocialAccount::query()->forceCreate([ + 'user_id' => $editor->id, + 'driver' => 'github', + 'driver_id' => 'logintest123', + ]); + + $resp = $this->actingAs($editor)->get($editor->getEditUrl()); + $resp->assertElementContains('a[href$="/login/service/github/detach"]', 'Disconnect Account'); + + $resp = $this->get('/login/service/github/detach'); + $resp->assertRedirect($editor->getEditUrl()); + $resp = $this->followRedirects($resp); + $resp->assertSee('Github account was successfully disconnected from your profile.'); + + $this->assertDatabaseMissing('social_accounts', ['id' => $socialAccount->id]); + } + public function test_social_autoregister() { config([