Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / system / tests / src / Functional / Update / SiteBrandingConvertedIntoBlockUpdateTest.php
1 <?php
2
3 namespace Drupal\Tests\system\Functional\Update;
4
5 use Drupal\FunctionalTests\Update\UpdatePathTestBase;
6
7 /**
8  * Tests the upgrade path for page site variables being converted into a block.
9  *
10  * @group system
11  */
12 class SiteBrandingConvertedIntoBlockUpdateTest extends UpdatePathTestBase {
13
14   /**
15    * {@inheritdoc}
16    */
17   protected function setDatabaseDumpFiles() {
18     $this->databaseDumpFiles = [
19       __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
20       __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.site-branding-into-block-2005546.php',
21     ];
22   }
23
24   /**
25    * {@inheritdoc}
26    */
27   protected function setUp() {
28     parent::setUp();
29     /** @var \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler */
30     $theme_handler = \Drupal::service('theme_handler');
31     $theme_handler->refreshInfo();
32   }
33
34   /**
35    * Tests that site branding elements are being converted into blocks.
36    */
37   public function testUpdateHookN() {
38     $this->runUpdates();
39
40     /** @var \Drupal\block\BlockInterface $block_storage */
41     $block_storage = \Drupal::entityManager()->getStorage('block');
42
43     $this->assertRaw('Because your site has custom theme(s) installed, we had to set the branding block into the content region. Please manually review the block configuration and remove the site name, slogan, and logo variables from your templates.');
44
45     // Disable maintenance mode.
46     // @todo Can be removed once maintenance mode is automatically turned off
47     // after updates in https://www.drupal.org/node/2435135.
48     \Drupal::state()->set('system.maintenance_mode', FALSE);
49
50     // We finished updating so we can log in the user now.
51     $this->drupalLogin($this->rootUser);
52
53     // Site branding is visible on the home page.
54     $this->drupalGet('/node');
55     $this->assertRaw('site-branding__logo');
56     $this->assertRaw('site-branding__name');
57     $this->assertNoRaw('site-branding__slogan');
58
59     $this->drupalGet('admin/structure/block/list/bartik');
60
61     /** @var \Drupal\Core\Config\StorageInterface $config_storage */
62     $config_storage = \Drupal::service('config.storage');
63     $this->assertTrue($config_storage->exists('block.block.test_theme_branding'), 'Site branding block has been created for the custom theme.');
64   }
65
66 }