mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #10073 from silverstripe/pulls/4/skip-login-hash-tests
MNT Skip tests when session-manager module is installed
This commit is contained in:
commit
50acac04c5
@ -5,7 +5,7 @@ import:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- REQUIRE_RECIPE="4.x-dev"
|
- REQUIRE_RECIPE="4.9.x-dev"
|
||||||
|
|
||||||
# Using a manual matrix to exlude PHPUNIT_COVERAGE_TEST for now because it was causing some strange issues
|
# Using a manual matrix to exlude PHPUNIT_COVERAGE_TEST for now because it was causing some strange issues
|
||||||
# e.g. https://travis-ci.com/github/silverstripe/silverstripe-framework/jobs/457096837
|
# e.g. https://travis-ci.com/github/silverstripe/silverstripe-framework/jobs/457096837
|
||||||
|
@ -27,6 +27,7 @@ use SilverStripe\Security\Permission;
|
|||||||
use SilverStripe\Security\RememberLoginHash;
|
use SilverStripe\Security\RememberLoginHash;
|
||||||
use SilverStripe\Security\Security;
|
use SilverStripe\Security\Security;
|
||||||
use SilverStripe\Security\Tests\MemberTest\FieldsExtension;
|
use SilverStripe\Security\Tests\MemberTest\FieldsExtension;
|
||||||
|
use SilverStripe\SessionManager\Models\LoginSession;
|
||||||
|
|
||||||
class MemberTest extends FunctionalTest
|
class MemberTest extends FunctionalTest
|
||||||
{
|
{
|
||||||
@ -1198,18 +1199,21 @@ class MemberTest extends FunctionalTest
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
RememberLoginHash::get()->filter(['MemberID'=>$m1->ID, 'DeviceID'=>$firstHash->DeviceID])->count(),
|
1,
|
||||||
1
|
RememberLoginHash::get()->filter(['MemberID'=>$m1->ID, 'DeviceID'=>$firstHash->DeviceID])->count()
|
||||||
);
|
);
|
||||||
|
|
||||||
// Logging out from any device when all login hashes should be removed
|
// If session-manager module is installed then logout_across_devices is modified so skip
|
||||||
RememberLoginHash::config()->update('logout_across_devices', true);
|
if (!class_exists(LoginSession::class)) {
|
||||||
Injector::inst()->get(IdentityStore::class)->logIn($m1, true);
|
// Logging out from any device when all login hashes should be removed
|
||||||
$this->get('Security/logout', $this->session());
|
RememberLoginHash::config()->update('logout_across_devices', true);
|
||||||
$this->assertEquals(
|
Injector::inst()->get(IdentityStore::class)->logIn($m1, true);
|
||||||
RememberLoginHash::get()->filter('MemberID', $m1->ID)->count(),
|
$this->get('Security/logout', $this->session());
|
||||||
0
|
$this->assertEquals(
|
||||||
);
|
0,
|
||||||
|
RememberLoginHash::get()->filter('MemberID', $m1->ID)->count()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCanDelete()
|
public function testCanDelete()
|
||||||
|
@ -5,6 +5,7 @@ namespace SilverStripe\Security\Tests;
|
|||||||
use SilverStripe\Dev\SapphireTest;
|
use SilverStripe\Dev\SapphireTest;
|
||||||
use SilverStripe\Security\Member;
|
use SilverStripe\Security\Member;
|
||||||
use SilverStripe\Security\RememberLoginHash;
|
use SilverStripe\Security\RememberLoginHash;
|
||||||
|
use SilverStripe\SessionManager\Models\LoginSession;
|
||||||
|
|
||||||
class RememberLoginHashTest extends SapphireTest
|
class RememberLoginHashTest extends SapphireTest
|
||||||
{
|
{
|
||||||
@ -49,6 +50,10 @@ class RememberLoginHashTest extends SapphireTest
|
|||||||
*/
|
*/
|
||||||
public function testClear(bool $logoutAcrossDevices, string $deviceId, array $expected, array $unexpected)
|
public function testClear(bool $logoutAcrossDevices, string $deviceId, array $expected, array $unexpected)
|
||||||
{
|
{
|
||||||
|
// If session-manager module is installed then logout_across_devices is modified so skip
|
||||||
|
if (class_exists(LoginSession::class)) {
|
||||||
|
$this->markTestSkipped();
|
||||||
|
}
|
||||||
RememberLoginHash::config()->set('logout_across_devices', $logoutAcrossDevices);
|
RememberLoginHash::config()->set('logout_across_devices', $logoutAcrossDevices);
|
||||||
|
|
||||||
RememberLoginHash::clear(
|
RememberLoginHash::clear(
|
||||||
@ -75,6 +80,10 @@ class RememberLoginHashTest extends SapphireTest
|
|||||||
|
|
||||||
public function testGetSetLogoutAcrossDevices()
|
public function testGetSetLogoutAcrossDevices()
|
||||||
{
|
{
|
||||||
|
// If session-manager module is installed then logout_across_devices is modified so skip
|
||||||
|
if (class_exists(LoginSession::class)) {
|
||||||
|
$this->markTestSkipped();
|
||||||
|
}
|
||||||
// set config directly
|
// set config directly
|
||||||
RememberLoginHash::config()->set('logout_across_devices', true);
|
RememberLoginHash::config()->set('logout_across_devices', true);
|
||||||
$this->assertTrue(RememberLoginHash::getLogoutAcrossDevices());
|
$this->assertTrue(RememberLoginHash::getLogoutAcrossDevices());
|
||||||
|
Loading…
Reference in New Issue
Block a user