NonDefaultBlockAdminTest.php 943 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace Drupal\Tests\block\Functional;
  3. use Drupal\Tests\BrowserTestBase;
  4. /**
  5. * Tests the block administration page for a non-default theme.
  6. *
  7. * @group block
  8. */
  9. class NonDefaultBlockAdminTest extends BrowserTestBase {
  10. /**
  11. * Modules to install.
  12. *
  13. * @var array
  14. */
  15. public static $modules = ['block'];
  16. /**
  17. * {@inheritdoc}
  18. */
  19. protected function setUp() {
  20. parent::setUp();
  21. $this->drupalPlaceBlock('local_tasks_block');
  22. }
  23. /**
  24. * Test non-default theme admin.
  25. */
  26. public function testNonDefaultBlockAdmin() {
  27. $admin_user = $this->drupalCreateUser(['administer blocks', 'administer themes']);
  28. $this->drupalLogin($admin_user);
  29. $new_theme = 'bartik';
  30. \Drupal::service('theme_handler')->install([$new_theme]);
  31. $this->drupalGet('admin/structure/block/list/' . $new_theme);
  32. $this->assertText('Bartik(' . t('active tab') . ')', 'Tab for non-default theme found.');
  33. }
  34. }