Issue #3417362 by kristiaanvandeneynde, smustgrave, quietone: Call refreshVariables() where needed in various tests

merge-requests/5553/merge
catch 2024-02-26 14:34:59 +00:00
parent 7a2865154f
commit 5ce1a1b41b
4 changed files with 15 additions and 0 deletions

View File

@ -359,6 +359,9 @@ abstract class CommentResourceTestBase extends EntityResourceTestBase {
$this->assertResourceResponse(201, FALSE, $response);
$this->assertFalse($unserialized->isPublished());
// Make sure the role save below properly invalidates cache tags.
$this->refreshVariables();
// Grant anonymous permission to skip comment approval.
$this->grantPermissionsToTestedRole(['skip comment approval']);

View File

@ -86,6 +86,9 @@ class MediaOverviewPageTest extends MediaFunctionalTestBase {
]);
$media3->save();
// Make sure the role save below properly invalidates cache tags.
$this->refreshVariables();
// Verify the view is now correctly populated. The non-admin user can only
// view published media.
$this->grantPermissions($role, [
@ -138,6 +141,9 @@ class MediaOverviewPageTest extends MediaFunctionalTestBase {
$assert_session->elementExists('css', 'td.views-field-operations li a:contains("Delete")', $row1);
$assert_session->linkByHrefExists('/media/' . $media1->id() . '/delete');
// Make sure the role save below properly invalidates cache tags.
$this->refreshVariables();
// Make the user the owner of the unpublished media item and assert the
// media item is only visible with the 'view own unpublished media'
// permission.

View File

@ -375,6 +375,9 @@ abstract class MediaResourceTestBase extends EntityResourceTestBase {
static::recursiveKSort($actual);
$this->assertSame($expected, $actual);
// Make sure the role save below properly invalidates cache tags.
$this->refreshVariables();
// To still run the complete test coverage for POSTing a Media entity, we
// must revoke the additional permissions that we granted.
$role = Role::load(static::$auth ? RoleInterface::AUTHENTICATED_ID : RoleInterface::ANONYMOUS_ID);

View File

@ -255,6 +255,9 @@ abstract class NodeResourceTestBase extends EntityResourceTestBase {
$this->assertSame('/llama', $this->entityStorage->loadUnchanged($this->entity->id())->get('path')->alias);
$this->assertResourceErrorResponse(403, "Access denied on updating field 'path'. " . static::$patchProtectedFieldNames['path'], $response);
// Make sure the role save below properly invalidates cache tags.
$this->refreshVariables();
// Grant permission to create URL aliases.
$this->grantPermissionsToTestedRole(['create url aliases']);