$edit =
[ 'visibility[user_role][roles][' . RoleInterface::AUTHENTICATED_ID . ']' => FALSE,
];
$this->
submitForm($edit, 'Save block'
);
$this->
clickLink('Configure'
);
$this->
assertSession()->
checkboxNotChecked('edit-visibility-user-role-roles-authenticated'
);
// Ensure that no visibility is configured.
/** @var \Drupal\block\BlockInterface $block */
$block = Block::
load($block_id);
$visibility_config =
$block->
getVisibilityConditions()->
getConfiguration();
$this->
assertSame([],
$visibility_config);
$this->
assertSame([],
$block->
get('visibility'
));
} /**
* Tests block visibility when leaving "pages" textarea empty.
*/
public function testBlockVisibilityListedEmpty() { $block_name = 'system_powered_by_block';
// Create a random title for the block.
$title =
$this->
randomMachineName(8
);