3 namespace Drupal\block\Tests;
5 use Drupal\simpletest\WebTestBase;
6 use Drupal\filter\Entity\FilterFormat;
9 * Provides setup and helper methods for block module tests.
11 abstract class BlockTestBase extends WebTestBase {
18 public static $modules = ['block', 'filter', 'test_page_test', 'help', 'block_test'];
21 * A list of theme regions to test.
28 * A test user with administrative privileges.
30 * @var \Drupal\user\UserInterface
34 protected function setUp() {
37 // Use the test page as the front page.
38 $this->config('system.site')->set('page.front', '/test-page')->save();
40 // Create Full HTML text format.
41 $full_html_format = FilterFormat::create([
42 'format' => 'full_html',
43 'name' => 'Full HTML',
45 $full_html_format->save();
47 // Create and log in an administrative user having access to the Full HTML
49 $this->adminUser = $this->drupalCreateUser([
51 $full_html_format->getPermissionName(),
52 'access administration pages',
54 $this->drupalLogin($this->adminUser);
56 // Define the existing regions.
64 $block_storage = $this->container->get('entity_type.manager')->getStorage('block');
65 $blocks = $block_storage->loadByProperties(['theme' => $this->config('system.theme')->get('default')]);
66 foreach ($blocks as $block) {