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
|
Chris@16
|
7 /**
|
Chris@16
|
8 * Tests distribution profile support.
|
Chris@16
|
9 *
|
Chris@16
|
10 * @group Installer
|
Chris@16
|
11 */
|
Chris@16
|
12 class SingleVisibleProfileTest extends InstallerTestBase {
|
Chris@16
|
13
|
Chris@16
|
14 /**
|
Chris@16
|
15 * The installation profile to install.
|
Chris@16
|
16 *
|
Chris@16
|
17 * Not needed when only one is visible.
|
Chris@16
|
18 *
|
Chris@16
|
19 * @var string
|
Chris@16
|
20 */
|
Chris@16
|
21 protected $profile = NULL;
|
Chris@16
|
22
|
Chris@16
|
23 /**
|
Chris@16
|
24 * {@inheritdoc}
|
Chris@16
|
25 */
|
Chris@16
|
26 protected function prepareEnvironment() {
|
Chris@16
|
27 parent::prepareEnvironment();
|
Chris@16
|
28 $profiles = ['standard', 'demo_umami'];
|
Chris@16
|
29 foreach ($profiles as $profile) {
|
Chris@16
|
30 $info = [
|
Chris@16
|
31 'type' => 'profile',
|
Chris@16
|
32 'core' => \Drupal::CORE_COMPATIBILITY,
|
Chris@16
|
33 'name' => 'Override ' . $profile,
|
Chris@16
|
34 'hidden' => TRUE,
|
Chris@16
|
35 ];
|
Chris@16
|
36 // File API functions are not available yet.
|
Chris@16
|
37 $path = $this->siteDirectory . '/profiles/' . $profile;
|
Chris@16
|
38 mkdir($path, 0777, TRUE);
|
Chris@16
|
39 file_put_contents("$path/$profile.info.yml", Yaml::encode($info));
|
Chris@16
|
40 }
|
Chris@16
|
41 }
|
Chris@16
|
42
|
Chris@16
|
43 /**
|
Chris@16
|
44 * {@inheritdoc}
|
Chris@16
|
45 */
|
Chris@16
|
46 protected function setUpProfile() {
|
Chris@16
|
47 // This step is skipped, because there is only one visible profile.
|
Chris@16
|
48 }
|
Chris@16
|
49
|
Chris@16
|
50 /**
|
Chris@16
|
51 * Confirms that the installation succeeded.
|
Chris@16
|
52 */
|
Chris@16
|
53 public function testInstalled() {
|
Chris@16
|
54 $this->assertUrl('user/1');
|
Chris@16
|
55 $this->assertResponse(200);
|
Chris@16
|
56 // Confirm that we are logged-in after installation.
|
Chris@18
|
57 $this->assertText($this->rootUser->getAccountName());
|
Chris@16
|
58 // Confirm that the minimal profile was installed.
|
Chris@16
|
59 $this->assertEqual(drupal_get_profile(), 'minimal');
|
Chris@16
|
60 }
|
Chris@16
|
61
|
Chris@16
|
62 }
|