Shows data and adds some tests for the OAuth check

This commit is contained in:
2026-02-16 12:24:50 +01:00
parent 9a10ff4727
commit e4259978de
2 changed files with 11 additions and 4 deletions

View File

@@ -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();