/**
* Tests the visibility settings for the blocks based on language.
*/
public function testLanguageBlockVisibility() { // Check if the visibility setting is available.
$default_theme =
$this->
config('system.theme'
)->
get('default'
);
$this->
drupalGet('admin/structure/block/add/system_powered_by_block' . '/' .
$default_theme);
// Ensure that the language visibility field is visible without a type
// setting.
$this->
assertSession()->
fieldExists('visibility[language][langcodes][en]'
);
$this->
assertSession()->
fieldNotExists('visibility[language][context_mapping][language]'
);
// Enable a standard block and set the visibility setting for one language.
$edit =
[ 'visibility[language][langcodes][en]' => TRUE,
'id' =>
strtolower($this->
randomMachineName(8
)),
'region' => 'sidebar_first',
];
$this->
drupalGet('admin/structure/block/add/system_powered_by_block' . '/' .
$default_theme);
$this->
submitForm($edit, 'Save block'
);