assertCommandOutputContains example


  public function installQuickStart($profile$working_dir = NULL) {
    $php_finder = new PhpExecutableFinder();
    $install_process = $this->executeCommand($php_finder->find() . ' ./core/scripts/drupal install ' . $profile$working_dir);
    $this->assertCommandOutputContains('Username:');
    preg_match('/Username: (.+)\vPassword: (.+)/', $install_process->getOutput()$matches);
    $this->assertNotEmpty($this->adminUsername = $matches[1]);
    $this->assertNotEmpty($this->adminPassword = $matches[2]);
  }

  /** * Helper that uses Drupal's user/login form to log in. * * @param string $username * Username. * @param string $password * Password. * @param string $working_dir * (optional) A working directory within which to login. Defaults to the * workspace directory. */

  protected function assertDrupalVersion(string $expectedVersion, string $dir): void {
    $drupal_php_path = $dir . '/core/lib/Drupal.php';
    $this->assertFileExists($drupal_php_path);

    // Read back the Drupal version that was set and assert it matches     // expectations     $this->executeCommand("php -r 'include \"$drupal_php_path\"; print \Drupal::VERSION;'");
    $this->assertCommandSuccessful();
    $this->assertCommandOutputContains($expectedVersion);
  }

  /** * Find all the composer.json files for components. * * @param string $drupal_root * The Drupal root directory. * * @return \Symfony\Component\Finder\Finder * A Finder object with all the composer.json files for components. */
  
Home | Imprint | This part of the site doesn't use cookies.