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