TestSiteOliveroInstallTestScript.php

Same filename in this branch
  1. 11.x core/tests/Drupal/TestSite/TestSiteOliveroInstallTestScript.php
Same filename and directory in other branches
  1. 10 core/tests/Drupal/TestSite/TestSiteOliveroInstallTestScript.php
  2. 9 core/tests/Drupal/TestSite/TestSiteOliveroInstallTestScript.php
  3. main core/tests/Drupal/TestSite/TestSiteOliveroInstallTestScript.php
  4. main core/modules/search/tests/src/Nightwatch/Tests/Olivero/TestSiteOliveroInstallTestScript.php

Namespace

Drupal\Tests\search\Nightwatch\Olivero

File

core/modules/search/tests/src/Nightwatch/Tests/Olivero/TestSiteOliveroInstallTestScript.php

View source
<?php

declare (strict_types=1);
namespace Drupal\Tests\search\Nightwatch\Olivero;

use Drupal\Core\Extension\ModuleInstallerInterface;
use Drupal\Core\Extension\ThemeInstallerInterface;
use Drupal\TestSite\TestSetupInterface;

/**
 * Setup file used by TestSiteInstallTestScript.
 *
 * @see \Drupal\KernelTests\Scripts\TestSiteApplicationTest
 */
class TestSiteOliveroInstallTestScript implements TestSetupInterface {
  
  /**
   * {@inheritdoc}
   */
  public function setup() : void {
    // Install required module for the Olivero front page.
    $module_installer = \Drupal::service('module_installer');
    assert($module_installer instanceof ModuleInstallerInterface);
    $module_installer->install([
      'olivero_test',
    ]);
    $module_installer->install([
      'search',
    ]);
    // Install Olivero and set it as the default theme.
    $theme_installer = \Drupal::service('theme_installer');
    assert($theme_installer instanceof ThemeInstallerInterface);
    $theme_installer->install([
      'olivero',
    ], TRUE);
    $system_theme_config = \Drupal::configFactory()->getEditable('system.theme');
    $system_theme_config->set('default', 'olivero')
      ->save();
  }

}

Classes

Title Deprecated Summary
TestSiteOliveroInstallTestScript Setup file used by TestSiteInstallTestScript.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.