InstallerSiteConfigProfileTest.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. namespace Drupal\FunctionalTests\Installer;
  3. /**
  4. * Verifies that the installer defaults to the existing site email address and
  5. * timezone, if they were provided by the install profile.
  6. *
  7. * @group Installer
  8. */
  9. class InstallerSiteConfigProfileTest extends InstallerTestBase {
  10. /**
  11. * {@inheritdoc}
  12. */
  13. protected $defaultTheme = 'stark';
  14. /**
  15. * {@inheritdoc}
  16. */
  17. protected $profile = 'testing_site_config';
  18. /**
  19. * The site mail we expect to be set from the install profile.
  20. *
  21. * @see testing_site_config_install()
  22. */
  23. const EXPECTED_SITE_MAIL = 'profile-testing-site-config@example.com';
  24. /**
  25. * The timezone we expect to be set from the install profile.
  26. *
  27. * @see testing_site_config_install()
  28. */
  29. const EXPECTED_TIMEZONE = 'America/Los_Angeles';
  30. /**
  31. * {@inheritdoc}
  32. */
  33. protected function installParameters() {
  34. $parameters = parent::installParameters();
  35. // Don't override the site email address, allowing it to default to the one
  36. // from our install profile.
  37. unset($parameters['forms']['install_configure_form']['site_mail']);
  38. return $parameters;
  39. }
  40. /**
  41. * {@inheritdoc}
  42. */
  43. protected function setUpSite() {
  44. $this->assertFieldByName('site_mail', self::EXPECTED_SITE_MAIL);
  45. $this->assertFieldByName('date_default_timezone', self::EXPECTED_TIMEZONE);
  46. return parent::setUpSite();
  47. }
  48. /**
  49. * Verify the correct site config was set.
  50. */
  51. public function testInstaller() {
  52. $this->assertEqual($this->config('system.site')->get('mail'), self::EXPECTED_SITE_MAIL);
  53. $this->assertEqual($this->config('system.date')->get('timezone.default'), self::EXPECTED_TIMEZONE);
  54. }
  55. }