Chris@0: drupalCreateUser(['administer blocks', 'administer themes']); Chris@0: $this->drupalLogin($admin_user); Chris@0: Chris@0: // Confirm we have access to the block demo page for the default theme. Chris@0: $config = $this->container->get('config.factory')->get('system.theme'); Chris@0: $default_theme = $config->get('default'); Chris@0: $this->drupalGet('admin/structure/block/demo/' . $default_theme); Chris@0: $this->assertResponse(200); Chris@0: $this->assertLinkByHref('admin/structure/block'); Chris@0: $this->assertNoLinkByHref('admin/structure/block/list/' . $default_theme); Chris@0: Chris@0: // All available themes in core. Chris@0: $available_themes = [ Chris@0: 'bartik', Chris@0: 'classy', Chris@0: 'seven', Chris@0: 'stark', Chris@0: ]; Chris@0: Chris@0: // All available themes minute minus the default theme. Chris@0: $themes = array_diff($available_themes, [$default_theme]); Chris@0: Chris@0: foreach ($themes as $theme) { Chris@0: // Install theme. Chris@0: $this->container->get('theme_handler')->install([$theme]); Chris@0: // Confirm access to the block demo page for the theme. Chris@0: $this->drupalGet('admin/structure/block/demo/' . $theme); Chris@0: $this->assertResponse(200); Chris@0: // Confirm existence of link for "Exit block region demonstration". Chris@0: $this->assertLinkByHref('admin/structure/block/list/' . $theme); Chris@0: } Chris@0: Chris@0: // Confirm access to the block demo page is denied for an invalid theme. Chris@0: $this->drupalGet('admin/structure/block/demo/invalid_theme'); Chris@0: $this->assertResponse(403); Chris@0: } Chris@0: Chris@0: }