91af34a2d16ee6891e861e31bb945d66486ce7c8
[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   /**
25    * The install profile info.
26    *
27    * @var array
28    */
29   protected $info;
30
31   protected function setUp() {
32     $this->info = [
33       'type' => 'profile',
34       'core' => \Drupal::CORE_COMPATIBILITY,
35       'name' => 'Override standard',
36       'hidden' => TRUE,
37     ];
38     // File API functions are not available yet.
39     $path = $this->siteDirectory . '/profiles/standard';
40     mkdir($path, 0777, TRUE);
41     file_put_contents("$path/standard.info.yml", Yaml::encode($this->info));
42
43     parent::setUp();
44   }
45
46   /**
47    * {@inheritdoc}
48    */
49   protected function setUpProfile() {
50     // This step is skipped, because there is only one visible profile.
51   }
52
53   /**
54    * Confirms that the installation succeeded.
55    */
56   public function testInstalled() {
57     $this->assertUrl('user/1');
58     $this->assertResponse(200);
59     // Confirm that we are logged-in after installation.
60     $this->assertText($this->rootUser->getUsername());
61     // Confirm that the minimal profile was installed.
62     $this->assertEqual(drupal_get_profile(), 'minimal');
63   }
64
65 }