EngineNyanCatTest.php in Drupal 9        
                          
                  
                        
  
  
  
  
File
  core/modules/system/tests/src/Functional/Theme/EngineNyanCatTest.php
  
    View source  
  <?php
namespace Drupal\Tests\system\Functional\Theme;
use Drupal\Tests\BrowserTestBase;
class EngineNyanCatTest extends BrowserTestBase {
  
  protected static $modules = [
    'theme_test',
  ];
  
  protected $defaultTheme = 'stark';
  protected function setUp() : void {
    parent::setUp();
    \Drupal::service('theme_installer')
      ->install([
      'test_theme_nyan_cat_engine',
    ]);
  }
  
  public function testTemplateOverride() {
    $this
      ->config('system.theme')
      ->set('default', 'test_theme_nyan_cat_engine')
      ->save();
    $this
      ->drupalGet('theme-test/template-test');
    $this
      ->assertSession()
      ->pageTextContains('Success: Template overridden with Nyan Cat theme. All of them');
  }
}