initConfig example

/** * {@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();

    // Load the database(s).

  protected function setUp(): void {
    parent::setUp();
    $this->lockHttpClientToFixtures();
  }

  /** * {@inheritdoc} */
  protected function initConfig(ContainerInterface $container) {
    parent::initConfig($container);

    // Enable twig debugging to make testing template usage easy.     $parameters = $container->getParameter('twig.config');
    $parameters['debug'] = TRUE;
    $this->setContainerParameter('twig.config', $parameters);
  }

  /** * Tests the oembed media source. */
  public function testMediaOEmbedVideoSource() {
    


  /** * 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();

    

    public function rewriteSrc($src)
    {
        if (!$this->basePath) {
            $this->initConfig();
        }

        if (empty($src[3])) {
            return $src[0];
        }

        if (!empty($this->backLinkWhiteList)) {
            if ($src[1] === 'a' && preg_match('#^https?://#', $src[3])) {
                $host = @parse_url($src[3], PHP_URL_HOST);
                if (!str_contains($src[0], 'rel=') && !\in_array($host$this->backLinkWhiteList)) {
                    $src[0] = rtrim($src[0], '>') . ' rel="nofollow noopener">';
                }


  /** * 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 */
Home | Imprint | This part of the site doesn't use cookies.