Tests block title length after successful upgrade.
public function testBlockUpgradeTitleLength() {
$this
->assertTrue($this
->performUpgrade(), 'The upgrade was completed successfully.');
// WebTestBase::drupalPlaceBlock() uses the API directly, which doesn't
// output validation errors or success messages, so create the blocks from
// the UI.
// Add a block instance with a 255-character title.
// Confirm that the custom block has been created, and title matches input.
$settings = array(
'settings[label]' => $this
->randomName(255),
'machine_name' => strtolower($this
->randomName(8)),
'region' => 'sidebar_first',
);
$this
->drupalPost('admin/structure/block/add/system_powered_by_block/' . config('system.theme')
->get('default'), $settings, t('Save block'));
$this
->assertText($settings['settings[label]'], 'Block with title longer than 64 characters successfully created.');
// Try to add a block with a title over 255 characters.
$settings = array(
'settings[label]' => $this
->randomName(256),
'machine_name' => strtolower($this
->randomName(8)),
'region' => 'sidebar_first',
);
$this
->drupalPost('admin/structure/block/add/system_powered_by_block/' . config('system.theme')
->get('default'), $settings, t('Save block'));
// Confirm that the custom block cannot be created with title longer than
// the maximum number of characters.
$this
->assertText('Title cannot be longer than 255 characters');
}