annotate core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTest.php @ 16:c2387f117808

Routine composer update
author Chris Cannam
date Tue, 10 Jul 2018 15:07:59 +0100
parents
children 129ea1e6d783
rev   line source
Chris@16 1 <?php
Chris@16 2
Chris@16 3 namespace Drupal\FunctionalTests\Installer;
Chris@16 4
Chris@16 5 use Drupal\Core\Serialization\Yaml;
Chris@16 6 use Drupal\Core\Site\Settings;
Chris@16 7
Chris@16 8 /**
Chris@16 9 * Tests distribution profile support.
Chris@16 10 *
Chris@16 11 * @group Installer
Chris@16 12 */
Chris@16 13 class DistributionProfileTest extends InstallerTestBase {
Chris@16 14
Chris@16 15 /**
Chris@16 16 * The distribution profile info.
Chris@16 17 *
Chris@16 18 * @var array
Chris@16 19 */
Chris@16 20 protected $info;
Chris@16 21
Chris@16 22 protected function prepareEnvironment() {
Chris@16 23 parent::prepareEnvironment();
Chris@16 24 $this->info = [
Chris@16 25 'type' => 'profile',
Chris@16 26 'core' => \Drupal::CORE_COMPATIBILITY,
Chris@16 27 'name' => 'Distribution profile',
Chris@16 28 'distribution' => [
Chris@16 29 'name' => 'My Distribution',
Chris@16 30 'install' => [
Chris@16 31 'theme' => 'bartik',
Chris@16 32 ],
Chris@16 33 ],
Chris@16 34 ];
Chris@16 35 // File API functions are not available yet.
Chris@16 36 $path = $this->siteDirectory . '/profiles/mydistro';
Chris@16 37 mkdir($path, 0777, TRUE);
Chris@16 38 file_put_contents("$path/mydistro.info.yml", Yaml::encode($this->info));
Chris@16 39 }
Chris@16 40
Chris@16 41 /**
Chris@16 42 * {@inheritdoc}
Chris@16 43 */
Chris@16 44 protected function setUpLanguage() {
Chris@16 45 // Verify that the distribution name appears.
Chris@16 46 $this->assertRaw($this->info['distribution']['name']);
Chris@16 47 // Verify that the distribution name is used in the site title.
Chris@16 48 $this->assertTitle('Choose language | ' . $this->info['distribution']['name']);
Chris@16 49 // Verify that the requested theme is used.
Chris@16 50 $this->assertRaw($this->info['distribution']['install']['theme']);
Chris@16 51 // Verify that the "Choose profile" step does not appear.
Chris@16 52 $this->assertNoText('profile');
Chris@16 53
Chris@16 54 parent::setUpLanguage();
Chris@16 55 }
Chris@16 56
Chris@16 57 /**
Chris@16 58 * {@inheritdoc}
Chris@16 59 */
Chris@16 60 protected function setUpProfile() {
Chris@16 61 // This step is skipped, because there is a distribution profile.
Chris@16 62 }
Chris@16 63
Chris@16 64 /**
Chris@16 65 * Confirms that the installation succeeded.
Chris@16 66 */
Chris@16 67 public function testInstalled() {
Chris@16 68 $this->assertUrl('user/1');
Chris@16 69 $this->assertResponse(200);
Chris@16 70 // Confirm that we are logged-in after installation.
Chris@16 71 $this->assertText($this->rootUser->getUsername());
Chris@16 72
Chris@16 73 // Confirm that Drupal recognizes this distribution as the current profile.
Chris@16 74 $this->assertEqual(\Drupal::installProfile(), 'mydistro');
Chris@16 75 $this->assertEqual(Settings::get('install_profile'), 'mydistro', 'The install profile has been written to settings.php.');
Chris@16 76 $this->assertEqual($this->config('core.extension')->get('profile'), 'mydistro', 'The install profile has been written to core.extension configuration.');
Chris@16 77 }
Chris@16 78
Chris@16 79 }