]> BookStack Code Mirror - bookstack/blobdiff - tests/Auth/LoginAutoInitiateTest.php
ZIP Imports: Added API examples, finished testing
[bookstack] / tests / Auth / LoginAutoInitiateTest.php
index a2941e21bc2b3db7f0e0abb55c7689c12789edb9..fcb4431af9c14ff8ecb068acf22527178b020c03 100644 (file)
@@ -6,13 +6,12 @@ use Tests\TestCase;
 
 class LoginAutoInitiateTest extends TestCase
 {
-
     protected function setUp(): void
     {
         parent::setUp();
 
         config()->set([
-            'auth.auto_initiate' => true,
+            'auth.auto_initiate'        => true,
             'services.google.client_id' => false,
             'services.github.client_id' => false,
         ]);
@@ -26,8 +25,8 @@ class LoginAutoInitiateTest extends TestCase
 
         $req = $this->get('/login');
         $req->assertSeeText('Attempting Login');
-        $req->assertElementExists('form[action$="/oidc/login"][method=POST][id="login-form"] button');
-        $req->assertElementExists('button[form="login-form"]');
+        $this->withHtml($req)->assertElementExists('form[action$="/oidc/login"][method=POST][id="login-form"] button');
+        $this->withHtml($req)->assertElementExists('button[form="login-form"]');
     }
 
     public function test_with_saml2()
@@ -38,15 +37,15 @@ class LoginAutoInitiateTest extends TestCase
 
         $req = $this->get('/login');
         $req->assertSeeText('Attempting Login');
-        $req->assertElementExists('form[action$="/saml2/login"][method=POST][id="login-form"] button');
-        $req->assertElementExists('button[form="login-form"]');
+        $this->withHtml($req)->assertElementExists('form[action$="/saml2/login"][method=POST][id="login-form"] button');
+        $this->withHtml($req)->assertElementExists('button[form="login-form"]');
     }
 
     public function test_it_does_not_run_if_social_provider_is_active()
     {
         config()->set([
-            'auth.method' => 'oidc',
-            'services.google.client_id' => 'abc123a',
+            'auth.method'                   => 'oidc',
+            'services.google.client_id'     => 'abc123a',
             'services.google.client_secret' => 'def456',
         ]);
 
@@ -71,10 +70,9 @@ class LoginAutoInitiateTest extends TestCase
         config()->set([
             'auth.method' => 'oidc',
         ]);
-        $this->actingAs($this->getEditor());
+        $this->actingAs($this->users->editor());
 
         $req = $this->post('/logout');
         $req->assertRedirect('/login?prevent_auto_init=true');
     }
-
-}
\ No newline at end of file
+}