installDrupal example

parent::setUp();

    $this->setUpAppRoot();

    // Allow tests to compare MarkupInterface objects via assertEquals().     $this->registerComparator(new MarkupInterfaceComparator());

    $this->setupBaseUrl();

    // Install Drupal test site.     $this->prepareEnvironment();
    $this->installDrupal();

    // Setup Mink.     $this->initMink();

    // Set up the browser test output file.     $this->initBrowserOutputFile();

    // Ensure that the test is not marked as risky because of no assertions. In     // PHPUnit 6 tests that only make assertions using $this->assertSession()     // can be marked as risky.     $this->addToAssertionCount(1);
  }
// Install Drupal test site.     $this->prepareEnvironment();
    $this->runDbTasks();

    // We are going to set a missing zlib requirement property for usage     // during the performUpgrade() and tearDown() methods. Also set that the     // tests failed.     if (!$this->zlibInstalled) {
      parent::setUp();
      return;
    }
    $this->installDrupal();

    // Add the config directories to settings.php.     $sync_directory = Settings::get('config_sync_directory');
    \Drupal::service('file_system')->prepareDirectory($sync_directory, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS);

    // Ensure the default temp directory exist and is writable. The configured     // temp directory may be removed during update.     \Drupal::service('file_system')->prepareDirectory($this->tempFilesDirectory, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS);

    // Set the container. parent::rebuildAll() would normally do this, but this     // not safe to do here, because the database has not been updated yet.

  public function setup($profile = 'testing', $setup_class = NULL, $langcode = 'en') {
    $this->profile = $profile;
    $this->langcode = $langcode;
    $this->setupBaseUrl();
    $this->prepareEnvironment();
    $this->executePreinstallClass($setup_class);
    $this->installDrupal();
    $this->executeSetupClass($setup_class);
  }

  /** * Installs Drupal into the test site. */
  protected function installDrupal() {
    $this->initUserSession();
    $this->prepareSettings();
    $this->doInstall();
    $this->initSettings();
    
Home | Imprint | This part of the site doesn't use cookies.