PageTitleConvertedIntoBlockUpdateTest.php in Zircon Profile 8
File
core/modules/system/src/Tests/Update/PageTitleConvertedIntoBlockUpdateTest.php
View source
<?php
namespace Drupal\system\Tests\Update;
use Drupal\node\Entity\Node;
class PageTitleConvertedIntoBlockUpdateTest extends UpdatePathTestBase {
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
__DIR__ . '/../../../../system/tests/fixtures/update/drupal-8.page-title-into-block-2476947.php',
];
}
protected function setUp() {
parent::setUp();
$theme_handler = \Drupal::service('theme_handler');
$theme_handler
->refreshInfo();
}
public function testUpdateHookN() {
$this
->runUpdates();
$block_storage = \Drupal::entityManager()
->getStorage('block');
$this
->assertRaw('Because your site has custom theme(s) installed, we have placed the page title block in the content region. Please manually review the block configuration and remove the page title variables from your page templates.');
\Drupal::state()
->set('system.maintenance_mode', FALSE);
$this
->drupalLogin($this->rootUser);
$page = Node::create([
'type' => 'page',
'title' => 'Page node',
]);
$page
->save();
$this
->drupalGet('/node');
$this
->assertRaw('page-title');
$this
->drupalGet('node/' . $page
->id());
$this
->assertRaw('page-title');
$this
->drupalGet('admin/structure/block/list/bartik');
$config_storage = \Drupal::service('config.storage');
$this
->assertTrue($config_storage
->exists('block.block.test_theme_page_title'), 'Page title block has been created for the custom theme.');
}
}