Skip to content

Commit

Permalink
Add Mink test to cover different session settings.
Browse files Browse the repository at this point in the history
  • Loading branch information
demiankatz committed Jan 25, 2024
1 parent 19ba1c8 commit 32bb6a8
Showing 1 changed file with 50 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,56 @@ public function testCaseInsensitiveUsername(): void
$this->findAndAssertLink($page, 'Change Password');
}

/**
* Data provider for testLoginWithSessionSettings().
*
* @return array
*/
public static function sessionSettingsProvider(): array
{
return [
'unencrypted file' => ['File', false],
'encrypted file' => ['File', true],
'unencrypted database' => ['Database', false],
'encrypted database' => ['Database', true],
];
}

/**
* Test that we can log in successfully using various session settings.
*
* @return void
*
* @depends testChangePassword
*
* @dataProvider sessionSettingsProvider
*/
public function testLoginWithSessionSettings($type, $secure): void
{
// Adjust session settings:
$this->changeConfigs(
[
'config' => [
'Session' => compact('type', 'secure'),
],
]
);

// Go to profile page:
$session = $this->getMinkSession();
$page = $session->getPage();
$session->visit($this->getVuFindUrl('/MyResearch/Profile'));

// Log in
$this->clickCss($page, '#loginOptions a');
$this->fillInLoginForm($page, 'username1', 'good');
$this->clickCss($page, '.modal-body .btn.btn-primary');
$this->waitForPageLoad($page);

// Confirm that we logged in based on the presence of a "change password" link.
$this->findAndAssertLink($page, 'Change Password');
}

/**
* Test that changing email is disabled by default.
*
Expand Down

0 comments on commit 32bb6a8

Please sign in to comment.