diff --git a/core/modules/system/src/Tests/Installer/InstallerSiteConfigDefaultTest.php b/core/modules/system/src/Tests/Installer/InstallerSiteConfigDefaultTest.php deleted file mode 100644 index 1117bea095..0000000000 --- a/core/modules/system/src/Tests/Installer/InstallerSiteConfigDefaultTest.php +++ /dev/null @@ -1,33 +0,0 @@ -assertFieldByName('site_mail', ini_get('sendmail_from')); - $this->assertFieldByName('date_default_timezone', @date_default_timezone_get()); - - return parent::setUpSite(); - } - - /** - * Verify the correct site config was set. - */ - public function testInstaller() { - $this->assertEqual(\Drupal::config('system.site')->get('mail'), $this->parameters['forms']['install_configure_form']['site_mail']); - $this->assertEqual(\Drupal::config('system.date')->get('timezone.default'), @date_default_timezone_get()); - } - -} diff --git a/core/modules/system/src/Tests/Installer/InstallerSiteConfigProfileTest.php b/core/modules/system/src/Tests/Installer/InstallerSiteConfigProfileTest.php index 08ba200e38..945fc960e8 100644 --- a/core/modules/system/src/Tests/Installer/InstallerSiteConfigProfileTest.php +++ b/core/modules/system/src/Tests/Installer/InstallerSiteConfigProfileTest.php @@ -18,32 +18,18 @@ class InstallerSiteConfigProfileTest extends InstallerTestBase { protected $profile = 'testing_site_config'; /** - * The site mail we expect to be set. + * 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. Determined dynamically in setUpSite(). + * The timezone we expect to be set from the install profile. * * @see testing_site_config_install() */ - protected $expectedTimezone; - - /** - * {@inheritdoc} - */ - protected function setUp() { - // The install profile set the timezone to one of two possibilities, but - // never to the system timezone. (See testing_site_config.install.) - $this->expectedTimezone = 'America/Los_Angeles'; - if ($this->expectedTimezone == @date_default_timezone_get()) { - $this->expectedTimezone = 'America/New_York'; - } - - return parent::setUp(); - } + const EXPECTED_TIMEZONE = 'America/Los_Angeles'; /** * {@inheritdoc} @@ -63,7 +49,7 @@ protected function installParameters() { */ protected function setUpSite() { $this->assertFieldByName('site_mail', self::EXPECTED_SITE_MAIL); - $this->assertFieldByName('date_default_timezone', $this->expectedTimezone); + $this->assertFieldByName('date_default_timezone', self::EXPECTED_TIMEZONE); return parent::setUpSite(); } @@ -72,8 +58,8 @@ protected function setUpSite() { * Verify the correct site config was set. */ public function testInstaller() { - $this->assertEqual(\Drupal::config('system.site')->get('mail'), self::EXPECTED_SITE_MAIL); - $this->assertEqual(\Drupal::config('system.date')->get('timezone.default'), $this->expectedTimezone); + $this->assertEqual($this->config('system.site')->get('mail'), self::EXPECTED_SITE_MAIL); + $this->assertEqual($this->config('system.date')->get('timezone.default'), self::EXPECTED_TIMEZONE); } } diff --git a/core/modules/system/src/Tests/Installer/InstallerTest.php b/core/modules/system/src/Tests/Installer/InstallerTest.php index be51057ad8..454e9e67ec 100644 --- a/core/modules/system/src/Tests/Installer/InstallerTest.php +++ b/core/modules/system/src/Tests/Installer/InstallerTest.php @@ -75,6 +75,9 @@ protected function setUpSite() { // Assert that the expected title is present. $this->assertEqual('Configure site', $this->cssSelect('main h2')[0]); + // Assert the system timezone is selected as the default. + $this->assertFieldByName('date_default_timezone', 'Australia/Sydney'); + parent::setUpSite(); } diff --git a/core/profiles/testing_site_config/testing_site_config.install b/core/profiles/testing_site_config/testing_site_config.install index 954e4a0b66..6b6b919b0b 100644 --- a/core/profiles/testing_site_config/testing_site_config.install +++ b/core/profiles/testing_site_config/testing_site_config.install @@ -9,12 +9,9 @@ function testing_site_config_install() { ->set('mail', 'profile-testing-site-config@example.com') ->save(TRUE); - // Set the time zone to something that is not the system timezone. - $timezone = 'America/Los_Angeles'; - if ($timezone == @date_default_timezone_get()) { - $timezone = 'America/New_York'; - } + // Set the time zone to something that is not the system timezone (which is + // Australia/Sydney in the testing environment). \Drupal::configFactory()->getEditable('system.date') - ->set('timezone.default', $timezone) + ->set('timezone.default', 'America/Los_Angeles') ->save(TRUE); }