InstallerSiteConfigProfileTest.php 1.58 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
<?php

namespace Drupal\FunctionalTests\Installer;

/**
 * Verifies that the installer defaults to the existing site email address and
 * timezone, if they were provided by the install profile.
 *
 * @group Installer
 */
class InstallerSiteConfigProfileTest extends InstallerTestBase {

  /**
   * {@inheritdoc}
   */
  protected $profile = 'testing_site_config';

  /**
   * The site mail we expect to be set from the install profile.
   *
   * @see testing_site_config_install()
   */
  const EXPECTED_SITE_MAIL = 'profile-testing-site-config@example.com';

  /**
   * The timezone we expect to be set from the install profile.
   *
   * @see testing_site_config_install()
   */
  const EXPECTED_TIMEZONE = 'America/Los_Angeles';

  /**
   * {@inheritdoc}
   */
  protected function installParameters() {
    $parameters = parent::installParameters();

    // Don't override the site email address, allowing it to default to the one
    // from our install profile.
    unset($parameters['forms']['install_configure_form']['site_mail']);

    return $parameters;
  }

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

    return parent::setUpSite();
  }

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

}