From 733282307ee5747987af943b9c91d73e48581bf4 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Thu, 12 Aug 2021 10:56:29 +1200 Subject: [PATCH] MNT Update tests to use logInAs() --- tests/php/Security/SecurityTest.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/php/Security/SecurityTest.php b/tests/php/Security/SecurityTest.php index 2b2c5d1f6..5f1984ff1 100644 --- a/tests/php/Security/SecurityTest.php +++ b/tests/php/Security/SecurityTest.php @@ -266,7 +266,8 @@ class SecurityTest extends FunctionalTest public function testMemberIDInSessionDoesntExistInDatabaseHasToLogin() { - /* Log in with a Member ID that doesn't exist in the DB */ + // Attempt to fake a log in with a Member ID that doesn't exist in the DB + // Note: attempting $this->logInAs(500) will throw a TypeError in RequestAuthenticationHandler::logIn() $this->session()->set('loggedInAs', 500); $this->autoFollowRedirection = true; @@ -282,7 +283,7 @@ class SecurityTest extends FunctionalTest $this->autoFollowRedirection = false; /* Log the user out */ - $this->session()->set('loggedInAs', null); + $this->logOut(); } public function testLoginUsernamePersists() @@ -381,7 +382,7 @@ class SecurityTest extends FunctionalTest "Internal relative BackURLs work when passed through to login form" ); // Log the user out - $this->session()->set('loggedInAs', null); + $this->logOut(); // Test internal absolute redirect $response = $this->doTestLoginForm( @@ -396,7 +397,7 @@ class SecurityTest extends FunctionalTest "Internal absolute BackURLs work when passed through to login form" ); // Log the user out - $this->session()->set('loggedInAs', null); + $this->logOut(); // Test external redirect $response = $this->doTestLoginForm('noexpiry@silverstripe.com', '1nitialPassword', 'http://myspoofedhost.com'); @@ -416,7 +417,7 @@ class SecurityTest extends FunctionalTest ); // Log the user out - $this->session()->set('loggedInAs', null); + $this->logOut(); } /**