comparison core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTest.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents c2387f117808
children af1871eacc83
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
1 <?php 1 <?php
2 2
3 namespace Drupal\FunctionalTests\Installer; 3 namespace Drupal\FunctionalTests\Installer;
4 4
5 use Drupal\Core\Serialization\Yaml; 5 use Drupal\Core\Serialization\Yaml;
6 use Drupal\Core\Site\Settings;
7 6
8 /** 7 /**
9 * Tests distribution profile support. 8 * Tests distribution profile support.
10 * 9 *
11 * @group Installer 10 * @group Installer
27 'name' => 'Distribution profile', 26 'name' => 'Distribution profile',
28 'distribution' => [ 27 'distribution' => [
29 'name' => 'My Distribution', 28 'name' => 'My Distribution',
30 'install' => [ 29 'install' => [
31 'theme' => 'bartik', 30 'theme' => 'bartik',
31 'finish_url' => '/myrootuser',
32 ], 32 ],
33 ], 33 ],
34 ]; 34 ];
35 // File API functions are not available yet. 35 // File API functions are not available yet.
36 $path = $this->siteDirectory . '/profiles/mydistro'; 36 $path = $this->siteDirectory . '/profiles/mydistro';
37 mkdir($path, 0777, TRUE); 37 mkdir($path, 0777, TRUE);
38 file_put_contents("$path/mydistro.info.yml", Yaml::encode($this->info)); 38 file_put_contents("$path/mydistro.info.yml", Yaml::encode($this->info));
39 file_put_contents("$path/mydistro.install", "<?php function mydistro_install() {\Drupal::service('path.alias_storage')->save('/user/1', '/myrootuser');}");
39 } 40 }
40 41
41 /** 42 /**
42 * {@inheritdoc} 43 * {@inheritdoc}
43 */ 44 */
63 64
64 /** 65 /**
65 * Confirms that the installation succeeded. 66 * Confirms that the installation succeeded.
66 */ 67 */
67 public function testInstalled() { 68 public function testInstalled() {
68 $this->assertUrl('user/1'); 69 $this->assertUrl('myrootuser');
69 $this->assertResponse(200); 70 $this->assertResponse(200);
70 // Confirm that we are logged-in after installation. 71 // Confirm that we are logged-in after installation.
71 $this->assertText($this->rootUser->getUsername()); 72 $this->assertText($this->rootUser->getUsername());
72 73
73 // Confirm that Drupal recognizes this distribution as the current profile. 74 // Confirm that Drupal recognizes this distribution as the current profile.
74 $this->assertEqual(\Drupal::installProfile(), 'mydistro'); 75 $this->assertEqual(\Drupal::installProfile(), 'mydistro');
75 $this->assertEqual(Settings::get('install_profile'), 'mydistro', 'The install profile has been written to settings.php.');
76 $this->assertEqual($this->config('core.extension')->get('profile'), 'mydistro', 'The install profile has been written to core.extension configuration.'); 76 $this->assertEqual($this->config('core.extension')->get('profile'), 'mydistro', 'The install profile has been written to core.extension configuration.');
77 } 77 }
78 78
79 } 79 }