setUpSite example

/** * {@inheritdoc} */
  protected function setUpSite() {
    $site_directory = $this->container->getParameter('app.root') . '/' . $this->siteDirectory;
    $this->assertDirectoryIsWritable($site_directory);
    $this->assertFileIsWritable($site_directory . '/settings.php');

    $this->assertSession()->responseContains('All necessary changes to <em class="placeholder">' . $this->siteDirectory . '</em> and <em class="placeholder">' . $this->siteDirectory . '/settings.php</em> have been made, so you should remove write permissions to them now in order to avoid security risks. If you are unsure how to do so, consult the <a href="https://www.drupal.org/server-permissions">online handbook</a>.');

    parent::setUpSite();
  }

  /** * Verifies the expected behaviors of the installation result. */
  public function testInstalled() {
    $this->assertSession()->addressEquals('user/1');
    $this->assertSession()->statusCodeEquals(200);
  }

}
// Address the requirements problem screen, if any.     $this->setUpRequirementsProblem();

    // Configure settings.     $this->setUpSettings();

    // @todo Allow test classes based on this class to act on further installer     // screens.
    // Configure site.     $this->setUpSite();

    if ($this->isInstalled) {
      // Import new settings.php written by the installer.       $request = Request::createFromGlobals();
      $class_loader = require $this->container->getParameter('app.root') . '/autoload.php';
      Settings::initialize($this->container->getParameter('app.root'), DrupalKernel::findSitePath($request)$class_loader);

      // After writing settings.php, the installer removes write permissions       // from the site directory. To allow drupal_generate_test_ua() to write       // a file containing the private key for drupal_valid_test_ua(), the site       // directory has to be writable.
return $parameters;
  }

  /** * {@inheritdoc} */
  protected function setUpSite() {
    $this->assertSession()->fieldValueEquals('site_mail', self::EXPECTED_SITE_MAIL);
    $this->assertSession()->fieldValueEquals('date_default_timezone', self::EXPECTED_TIMEZONE);

    return parent::setUpSite();
  }

  /** * Verify the correct site config was set. */
  public function testInstaller() {
    $this->assertEquals(self::EXPECTED_SITE_MAIL, $this->config('system.site')->get('mail'));
    $this->assertEquals(self::EXPECTED_TIMEZONE, $this->config('system.date')->get('timezone.default'));
  }

}

  protected function setUpSite() {
    // Assert that the expected title is present.     $this->assertEquals('Configure site', $this->cssSelect('main h2')[0]->getText());

    // Test that SiteConfigureForm::buildForm() has made the site directory and     // the settings file non-writable.     $site_directory = $this->container->getParameter('app.root') . '/' . $this->siteDirectory;
    $this->assertDirectoryIsNotWritable($site_directory);
    $this->assertFileIsNotWritable($site_directory . '/settings.php');

    parent::setUpSite();
  }

  /** * {@inheritdoc} */
  protected function visitInstaller() {
    parent::visitInstaller();

    // Assert the title is correct and has the title suffix.     $this->assertSession()->titleEquals('Choose language | Drupal');
  }

  
    $this->assertSession()->pageTextContains('Congratulations and welcome to the Drupal community.');
    $this->assertSession()->elementTextContains('css', '#block-olivero-powered', 'Powered by Drupal');
  }

  /** * {@inheritdoc} */
  protected function setUpSite() {
    // Test that the correct theme is being used.     $this->assertSession()->responseNotContains('olivero');
    $this->assertSession()->responseContains('css/theme/install-page.css');
    parent::setUpSite();
  }

  /** * Ensures that the exported standard configuration is up to date. */
  public function testStandardConfig() {
    $skipped_config = [];
    // FunctionalTestSetupTrait::installParameters() uses Drupal as site name     // and simpletest@example.com as mail address.     $skipped_config['system.site'][] = 'name: Drupal';
    $skipped_config['system.site'][] = 'mail: simpletest@example.com';
    
Home | Imprint | This part of the site doesn't use cookies.