InstallerConfigDirectorySetNoDirectoryTest.php

Same filename and directory in other branches
  1. 11.x core/tests/Drupal/FunctionalTests/Installer/InstallerConfigDirectorySetNoDirectoryTest.php
  2. 10 core/tests/Drupal/FunctionalTests/Installer/InstallerConfigDirectorySetNoDirectoryTest.php
  3. 9 core/tests/Drupal/FunctionalTests/Installer/InstallerConfigDirectorySetNoDirectoryTest.php
  4. 8.9.x core/tests/Drupal/FunctionalTests/Installer/InstallerConfigDirectorySetNoDirectoryTest.php

Namespace

Drupal\FunctionalTests\Installer

File

core/tests/Drupal/FunctionalTests/Installer/InstallerConfigDirectorySetNoDirectoryTest.php

View source
<?php

declare (strict_types=1);
namespace Drupal\FunctionalTests\Installer;

use Drupal\Component\Utility\Crypt;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;

/**
 * Tests the installer when a custom config directory set up but does not exist.
 */
class InstallerConfigDirectorySetNoDirectoryTest extends InstallerTestBase {
  
  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'stark';
  
  /**
   * The sync directory created during the install.
   *
   * @var string
   */
  protected $syncDirectory;
  
  /**
   * {@inheritdoc}
   */
  protected function prepareEnvironment() : void {
    parent::prepareEnvironment();
    $this->syncDirectory = $this->publicFilesDirectory . '/config_' . Crypt::randomBytesBase64() . '/sync';
    $this->settings['settings']['config_sync_directory'] = (object) [
      'value' => $this->syncDirectory,
      'required' => TRUE,
    ];
  }
  
  /**
   * Verifies that installation succeeded.
   */
  public function testInstaller() : void {
    $this->assertSession()
      ->addressEquals('user/1');
    $this->assertSession()
      ->statusCodeEquals(200);
    $this->assertDirectoryExists($this->syncDirectory);
  }

}

Classes

Title Deprecated Summary
InstallerConfigDirectorySetNoDirectoryTest Tests the installer when a custom config directory set up but does not exist.

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