3 namespace Drupal\Tests\block\Functional;
5 use Drupal\filter\Entity\FilterFormat;
6 use Drupal\Tests\BrowserTestBase;
9 * Provides setup and helper methods for block module tests.
11 abstract class BlockTestBase extends BrowserTestBase {
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
37 protected function setUp() {
40 // Use the test page as the front page.
41 $this->config('system.site')->set('page.front', '/test-page')->save();
43 // Create Full HTML text format.
44 $full_html_format = FilterFormat::create([
45 'format' => 'full_html',
46 'name' => 'Full HTML',
48 $full_html_format->save();
50 // Create and log in an administrative user having access to the Full HTML
52 $this->adminUser = $this->drupalCreateUser([
54 $full_html_format->getPermissionName(),
55 'access administration pages',
57 $this->drupalLogin($this->adminUser);
59 // Define the existing regions.
67 $block_storage = $this->container->get('entity_type.manager')->getStorage('block');
68 $blocks = $block_storage->loadByProperties(['theme' => $this->config('system.theme')->get('default')]);
69 foreach ($blocks as $block) {