X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Ftests%2FDrupal%2FFunctionalTests%2FInstaller%2FDistributionProfileTest.php;fp=web%2Fcore%2Ftests%2FDrupal%2FFunctionalTests%2FInstaller%2FDistributionProfileTest.php;h=630ec1558d8828c6e9e4ad2c87b24f1335924895;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hp=0000000000000000000000000000000000000000;hpb=74df008bdbb3a11eeea356744f39b802369bda3c;p=yaffs-website diff --git a/web/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTest.php b/web/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTest.php new file mode 100644 index 000000000..630ec1558 --- /dev/null +++ b/web/core/tests/Drupal/FunctionalTests/Installer/DistributionProfileTest.php @@ -0,0 +1,79 @@ +info = [ + 'type' => 'profile', + 'core' => \Drupal::CORE_COMPATIBILITY, + 'name' => 'Distribution profile', + 'distribution' => [ + 'name' => 'My Distribution', + 'install' => [ + 'theme' => 'bartik', + 'finish_url' => '/myrootuser', + ], + ], + ]; + // File API functions are not available yet. + $path = $this->siteDirectory . '/profiles/mydistro'; + mkdir($path, 0777, TRUE); + file_put_contents("$path/mydistro.info.yml", Yaml::encode($this->info)); + file_put_contents("$path/mydistro.install", "save('/user/1', '/myrootuser');}"); + } + + /** + * {@inheritdoc} + */ + protected function setUpLanguage() { + // Verify that the distribution name appears. + $this->assertRaw($this->info['distribution']['name']); + // Verify that the distribution name is used in the site title. + $this->assertTitle('Choose language | ' . $this->info['distribution']['name']); + // Verify that the requested theme is used. + $this->assertRaw($this->info['distribution']['install']['theme']); + // Verify that the "Choose profile" step does not appear. + $this->assertNoText('profile'); + + parent::setUpLanguage(); + } + + /** + * {@inheritdoc} + */ + protected function setUpProfile() { + // This step is skipped, because there is a distribution profile. + } + + /** + * Confirms that the installation succeeded. + */ + public function testInstalled() { + $this->assertUrl('myrootuser'); + $this->assertResponse(200); + // Confirm that we are logged-in after installation. + $this->assertText($this->rootUser->getUsername()); + + // Confirm that Drupal recognizes this distribution as the current profile. + $this->assertEqual(\Drupal::installProfile(), 'mydistro'); + $this->assertEqual($this->config('core.extension')->get('profile'), 'mydistro', 'The install profile has been written to core.extension configuration.'); + } + +}