mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #10052 from creative-commoners/pulls/4/logged-in-as
MNT Update tests to use logInAs()
This commit is contained in:
commit
4b8397cd81
@ -266,7 +266,8 @@ class SecurityTest extends FunctionalTest
|
|||||||
|
|
||||||
public function testMemberIDInSessionDoesntExistInDatabaseHasToLogin()
|
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->session()->set('loggedInAs', 500);
|
||||||
|
|
||||||
$this->autoFollowRedirection = true;
|
$this->autoFollowRedirection = true;
|
||||||
@ -282,7 +283,7 @@ class SecurityTest extends FunctionalTest
|
|||||||
$this->autoFollowRedirection = false;
|
$this->autoFollowRedirection = false;
|
||||||
|
|
||||||
/* Log the user out */
|
/* Log the user out */
|
||||||
$this->session()->set('loggedInAs', null);
|
$this->logOut();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testLoginUsernamePersists()
|
public function testLoginUsernamePersists()
|
||||||
@ -381,7 +382,7 @@ class SecurityTest extends FunctionalTest
|
|||||||
"Internal relative BackURLs work when passed through to login form"
|
"Internal relative BackURLs work when passed through to login form"
|
||||||
);
|
);
|
||||||
// Log the user out
|
// Log the user out
|
||||||
$this->session()->set('loggedInAs', null);
|
$this->logOut();
|
||||||
|
|
||||||
// Test internal absolute redirect
|
// Test internal absolute redirect
|
||||||
$response = $this->doTestLoginForm(
|
$response = $this->doTestLoginForm(
|
||||||
@ -396,7 +397,7 @@ class SecurityTest extends FunctionalTest
|
|||||||
"Internal absolute BackURLs work when passed through to login form"
|
"Internal absolute BackURLs work when passed through to login form"
|
||||||
);
|
);
|
||||||
// Log the user out
|
// Log the user out
|
||||||
$this->session()->set('loggedInAs', null);
|
$this->logOut();
|
||||||
|
|
||||||
// Test external redirect
|
// Test external redirect
|
||||||
$response = $this->doTestLoginForm('noexpiry@silverstripe.com', '1nitialPassword', 'http://myspoofedhost.com');
|
$response = $this->doTestLoginForm('noexpiry@silverstripe.com', '1nitialPassword', 'http://myspoofedhost.com');
|
||||||
@ -416,7 +417,7 @@ class SecurityTest extends FunctionalTest
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Log the user out
|
// Log the user out
|
||||||
$this->session()->set('loggedInAs', null);
|
$this->logOut();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user