initKernel example

$this->executeSetupClass($setup_class);
  }

  /** * Installs Drupal into the test site. */
  protected function installDrupal() {
    $this->initUserSession();
    $this->prepareSettings();
    $this->doInstall();
    $this->initSettings();
    $container = $this->initKernel(\Drupal::request());
    $this->initConfig($container);
  }

  /** * Uses the setup file to configure Drupal. * * @param string $class * The fully qualified class name, which should set up Drupal for tests. For * example this class could create content types and fields or install * modules. The class needs to implement TestSetupInterface. * * @see \Drupal\TestSite\TestSetupInterface */
$this->getSession()->getPage()->pressButton('Save settings');

    $this->drupalGet(Url::fromRoute('system.status'));
    if (!$twig_development_mode) {
      $this->assertSession()->pageTextNotContains('Twig development mode');
    }
    else {
      $this->assertSession()->pageTextContains('Twig development mode');
      $this->assertSession()->linkExists('development settings page');
    }

    $refreshed_container = $this->initKernel(Request::create('/'));
    $twig_config = $refreshed_container->getParameter('twig.config');
    self::assertEquals($twig_debug$twig_config['debug']);
    self::assertNull($twig_config['auto_reload']);
    self::assertEquals(!$twig_cache_disable$twig_config['cache']);
  }

  /** * Test data for Twig development mode. * * @return array[] */
  
/** * {@inheritdoc} */
  public function installDrupal() {
    $this->initUserSession();
    $this->prepareSettings();
    $this->doInstall();
    $this->initSettings();

    $request = Request::createFromGlobals();
    $container = $this->initKernel($request);
    $this->initConfig($container);
  }

  /** * {@inheritdoc} */
  protected function doInstall() {
    $this->runDbTasks();
    // Allow classes to set database dump files.     $this->setDatabaseDumpFiles();

    
return $options;
  }

  /** * Installs Drupal into the test site. */
  public function installDrupal() {
    $this->initUserSession();
    $this->prepareSettings();
    $this->doInstall();
    $this->initSettings();
    $this->container = $container = $this->initKernel(\Drupal::request());
    $this->initConfig($container);
    $this->installDefaultThemeFromClassProperty($container);
    $this->installModulesFromClassProperty($container);

    // Clear the static cache so that subsequent cache invalidations will work     // as expected.     $this->container->get('cache_tags.invalidator')->resetChecksums();

    // Generate a route to prime the URL generator with the correct base URL.     // @todo Remove in https://www.drupal.org/project/drupal/issues/3207896.     Url::fromRoute('<front>')->setAbsolute()->toString();

    
Home | Imprint | This part of the site doesn't use cookies.