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