3 namespace Drupal\block\Tests;
5 @trigger_error(__NAMESPACE__ . '\BlockTestBase is deprecated in Drupal 8.5.0 and will be removed before Drupal 9.0.0. Instead, use \Drupal\Tests\block\Functional\BlockTestBase, see https://www.drupal.org/node/2901823.', E_USER_DEPRECATED);
7 use Drupal\simpletest\WebTestBase;
8 use Drupal\filter\Entity\FilterFormat;
11 * Provides setup and helper methods for block module tests.
13 * @deprecated in Drupal 8.5.0 and will be removed before Drupal 9.0.0.
14 * Use \Drupal\Tests\block\Functional\BlockTestBase.
16 * @see https://www.drupal.org/node/2901823
18 abstract class BlockTestBase extends WebTestBase {
25 public static $modules = ['block', 'filter', 'test_page_test', 'help', 'block_test'];
28 * A list of theme regions to test.
35 * A test user with administrative privileges.
37 * @var \Drupal\user\UserInterface
41 protected function setUp() {
44 // Use the test page as the front page.
45 $this->config('system.site')->set('page.front', '/test-page')->save();
47 // Create Full HTML text format.
48 $full_html_format = FilterFormat::create([
49 'format' => 'full_html',
50 'name' => 'Full HTML',
52 $full_html_format->save();
54 // Create and log in an administrative user having access to the Full HTML
56 $this->adminUser = $this->drupalCreateUser([
58 $full_html_format->getPermissionName(),
59 'access administration pages',
61 $this->drupalLogin($this->adminUser);
63 // Define the existing regions.
71 $block_storage = $this->container->get('entity_type.manager')->getStorage('block');
72 $blocks = $block_storage->loadByProperties(['theme' => $this->config('system.theme')->get('default')]);
73 foreach ($blocks as $block) {