Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / tests / Drupal / FunctionalTests / Installer / InstallerExistingConfigProfileHookInstall.php
1 <?php
2
3 namespace Drupal\FunctionalTests\Installer;
4
5 /**
6  * Verifies that profiles with hook_install() can't be installed from config.
7  *
8  * @group Installer
9  */
10 class InstallerExistingConfigProfileHookInstall extends InstallerExistingConfigTestBase {
11
12   protected $profile = 'config_profile_with_hook_install';
13
14   /**
15    * {@inheritdoc}
16    */
17   protected function visitInstaller() {
18     // Create an .install file with a hook_install() implementation.
19     $path = $this->siteDirectory . '/profiles/' . $this->profile;
20     $contents = <<<EOF
21 <?php
22
23 function config_profile_with_hook_install_install() {
24 }
25 EOF;
26     file_put_contents("$path/{$this->profile}.install", $contents);
27     parent::visitInstaller();
28   }
29
30   /**
31    * Installer step: Configure settings.
32    */
33   protected function setUpSettings() {
34     // There are errors therefore there is nothing to do here.
35     return;
36   }
37
38   /**
39    * Final installer step: Configure site.
40    */
41   protected function setUpSite() {
42     // There are errors therefore there is nothing to do here.
43     return;
44   }
45
46   /**
47    * {@inheritdoc}
48    */
49   protected function getConfigTarball() {
50     // We're not going to get to the config import stage so this does not
51     // matter.
52     return __DIR__ . '/../../../fixtures/config_install/testing_config_install_no_config.tar.gz';
53   }
54
55   /**
56    * Confirms the installation has failed and the expected error is displayed.
57    */
58   public function testConfigSync() {
59     $this->assertTitle('Requirements problem | Drupal');
60     $this->assertText($this->profile);
61     $this->assertText('The selected profile has a hook_install() implementation and therefore can not be installed from configuration.');
62   }
63
64 }