7 class LoginAutoInitiateTest extends TestCase
10 protected function setUp(): void
15 'auth.auto_initiate' => true,
16 'services.google.client_id' => false,
17 'services.github.client_id' => false,
21 public function test_with_oidc()
24 'auth.method' => 'oidc',
27 $req = $this->get('/login');
28 $req->assertSeeText('Attempting Login');
29 $req->assertElementExists('form[action$="/oidc/login"][method=POST][id="login-form"] button');
30 $req->assertElementExists('button[form="login-form"]');
33 public function test_with_saml2()
36 'auth.method' => 'saml2',
39 $req = $this->get('/login');
40 $req->assertSeeText('Attempting Login');
41 $req->assertElementExists('form[action$="/saml2/login"][method=POST][id="login-form"] button');
42 $req->assertElementExists('button[form="login-form"]');
45 public function test_it_does_not_run_if_social_provider_is_active()
48 'auth.method' => 'oidc',
49 'services.google.client_id' => 'abc123a',
50 'services.google.client_secret' => 'def456',
53 $req = $this->get('/login');
54 $req->assertDontSeeText('Attempting Login');
55 $req->assertSee('Log In');
58 public function test_it_does_not_run_if_prevent_query_string_exists()
61 'auth.method' => 'oidc',
64 $req = $this->get('/login?prevent_auto_init=true');
65 $req->assertDontSeeText('Attempting Login');
66 $req->assertSee('Log In');
69 public function test_logout_with_auto_init_leads_to_login_page_with_prevention_query()
72 'auth.method' => 'oidc',
74 $this->actingAs($this->getEditor());
76 $req = $this->post('/logout');
77 $req->assertRedirect('/login?prevent_auto_init=true');