MNT Update tests to use logInAs() (#2679)

This commit is contained in:
Steve Boyd 2021-08-18 12:35:36 +12:00 committed by GitHub
parent 6617c63dea
commit e98110d336
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 5 deletions

View File

@ -125,7 +125,7 @@ class CMSMainTest extends FunctionalTest
{ {
$page1 = $this->objFromFixture(Page::class, "page1"); $page1 = $this->objFromFixture(Page::class, "page1");
$page2 = $this->objFromFixture(Page::class, "page2"); $page2 = $this->objFromFixture(Page::class, "page2");
$this->session()->set('loggedInAs', $this->idFromFixture(Member::class, 'admin')); $this->logInAs('admin');
$response = $this->get('admin/pages/publishall?confirm=1'); $response = $this->get('admin/pages/publishall?confirm=1');
$this->assertContains( $this->assertContains(
@ -147,8 +147,6 @@ class CMSMainTest extends FunctionalTest
$latestID = DB::prepared_query('select max("Version") from "RedirectorPage_Versions" where "RecordID" = ?', [$pageID])->value(); $latestID = DB::prepared_query('select max("Version") from "RedirectorPage_Versions" where "RecordID" = ?', [$pageID])->value();
$dsCount = DB::prepared_query('select count("Version") from "RedirectorPage_Versions" where "RecordID" = ? and "Version"= ?', [$pageID, $latestID])->value(); $dsCount = DB::prepared_query('select count("Version") from "RedirectorPage_Versions" where "RecordID" = ? and "Version"= ?', [$pageID, $latestID])->value();
$this->assertEquals(1, $dsCount, "Published page has no duplicate version records: it has " . $dsCount . " for version " . $latestID); $this->assertEquals(1, $dsCount, "Published page has no duplicate version records: it has " . $dsCount . " for version " . $latestID);
$this->session()->clear('loggedInAs');
} }
/** /**

View File

@ -199,7 +199,7 @@ class SiteTreePermissionsTest extends FunctionalTest
'Users without SITETREE_GRANT_ACCESS permission cannot change "edit" permissions in cms fields' 'Users without SITETREE_GRANT_ACCESS permission cannot change "edit" permissions in cms fields'
); );
$this->session()->set('loggedInAs', null); $this->logOut();
} }
public function testRestrictedViewLoggedInUsers() public function testRestrictedViewLoggedInUsers()

View File

@ -12,7 +12,7 @@ class CMSMainSearchFormTest extends FunctionalTest
public function testTitleFilter() public function testTitleFilter()
{ {
$this->session()->set('loggedInAs', $this->idFromFixture(Member::class, 'admin')); $this->logInAs('admin');
$this->get( $this->get(
'admin/pages/?' . 'admin/pages/?' .