Shows data and adds some tests for the OAuth check
This commit is contained in:
@@ -34,7 +34,6 @@
|
||||
});
|
||||
|
||||
// Dev auto-login route
|
||||
// if (app()->environment('local', 'testing')) {
|
||||
Route::get('/login-for-testing', function () {
|
||||
$user = \App\Models\User::where('email', 'jonathan@blijnder.nl')->first();
|
||||
|
||||
@@ -47,4 +46,3 @@
|
||||
|
||||
return redirect('/');
|
||||
});
|
||||
// }
|
||||
|
||||
@@ -41,7 +41,16 @@ public function test_callback_matches_existing_user_by_email(): void
|
||||
$socialiteUser = Mockery::mock(SocialiteUser::class);
|
||||
$socialiteUser->shouldReceive('getEmail')->andReturn('existing@example.com');
|
||||
$socialiteUser->shouldReceive('getName')->andReturn('Updated Name');
|
||||
$socialiteUser->shouldReceive('getId')->andReturn('azure-123');
|
||||
$socialiteUser->shouldReceive('getAvatar')->andReturn(null);
|
||||
$socialiteUser->shouldReceive('offsetExists')->andReturn(false);
|
||||
$socialiteUser->user = [
|
||||
'jobTitle' => null,
|
||||
'department' => null,
|
||||
'companyName' => null,
|
||||
'mobilePhone' => null,
|
||||
'businessPhones' => [],
|
||||
];
|
||||
|
||||
$driver = Mockery::mock();
|
||||
$driver->shouldReceive('user')->andReturn($socialiteUser);
|
||||
@@ -57,7 +66,7 @@ public function test_callback_matches_existing_user_by_email(): void
|
||||
|
||||
$existingUser->refresh();
|
||||
|
||||
$this->assertEquals('Original Name', $existingUser->name);
|
||||
$this->assertEquals('Updated Name', $existingUser->name);
|
||||
$this->assertAuthenticatedAs($existingUser);
|
||||
}
|
||||
|
||||
@@ -78,7 +87,7 @@ public function test_login_jonathan_works_in_testing_env(): void
|
||||
'name' => 'Jonathan',
|
||||
]);
|
||||
|
||||
$this->get('/login-jonathan')
|
||||
$this->get('/login-for-testing')
|
||||
->assertRedirect('/');
|
||||
|
||||
$user = User::where('email', 'jonathan@blijnder.nl')->first();
|
||||
|
||||
Reference in New Issue
Block a user