Merge branch '5' into 6

This commit is contained in:
github-actions 2024-06-11 03:31:06 +00:00
commit 2979abf92e

View File

@ -5,6 +5,7 @@ namespace SilverStripe\CMS\Tests\Behaviour;
use Page; use Page;
use PHPUnit\Framework\Assert; use PHPUnit\Framework\Assert;
use SilverStripe\BehatExtension\Context\LoginContext as BehatLoginContext; use SilverStripe\BehatExtension\Context\LoginContext as BehatLoginContext;
use SilverStripe\SiteConfig\SiteConfig;
class LoginContext extends BehatLoginContext class LoginContext extends BehatLoginContext
{ {
@ -26,7 +27,11 @@ class LoginContext extends BehatLoginContext
$password = 'Password!456'; $password = 'Password!456';
$member = $this->generateMemberWithPermission($email, $password, $permCode); $member = $this->generateMemberWithPermission($email, $password, $permCode);
$canEdit = strstr($negative ?? '', 'not') ? false : true; $canEdit = strstr($negative ?? '', 'not') ? false : true;
// Flush the SiteConfig cache so that siteconfig behat tests that update a
// SiteConfig DataObject will not be referring to a stale verion of itself
// which can happen because SiteConfig::current_site_config() uses DataObject::get_one()
// which will caches its result by default
SiteConfig::current_site_config()->flushCache();
if ($canEdit) { if ($canEdit) {
Assert::assertTrue($page->canEdit($member), 'The member can edit this page'); Assert::assertTrue($page->canEdit($member), 'The member can edit this page');
} else { } else {