X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fblock%2Ftests%2Fsrc%2FFunctional%2FBlockTestBase.php;fp=web%2Fcore%2Fmodules%2Fblock%2Ftests%2Fsrc%2FFunctional%2FBlockTestBase.php;h=e1ccd1a3658ca580d782eb4f1952fab15e50be60;hp=0000000000000000000000000000000000000000;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/web/core/modules/block/tests/src/Functional/BlockTestBase.php b/web/core/modules/block/tests/src/Functional/BlockTestBase.php new file mode 100644 index 000000000..e1ccd1a36 --- /dev/null +++ b/web/core/modules/block/tests/src/Functional/BlockTestBase.php @@ -0,0 +1,74 @@ +config('system.site')->set('page.front', '/test-page')->save(); + + // Create Full HTML text format. + $full_html_format = FilterFormat::create([ + 'format' => 'full_html', + 'name' => 'Full HTML', + ]); + $full_html_format->save(); + + // Create and log in an administrative user having access to the Full HTML + // text format. + $this->adminUser = $this->drupalCreateUser([ + 'administer blocks', + $full_html_format->getPermissionName(), + 'access administration pages', + ]); + $this->drupalLogin($this->adminUser); + + // Define the existing regions. + $this->regions = [ + 'header', + 'sidebar_first', + 'content', + 'sidebar_second', + 'footer', + ]; + $block_storage = $this->container->get('entity_type.manager')->getStorage('block'); + $blocks = $block_storage->loadByProperties(['theme' => $this->config('system.theme')->get('default')]); + foreach ($blocks as $block) { + $block->delete(); + } + } + +}