comparison core/tests/Drupal/FunctionalTests/Installer/InstallerExistingConfigSyncDirectoryProfileHookInstall.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
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 InstallerExistingConfigSyncDirectoryProfileHookInstall extends InstallerExistingConfigTestBase {
11
12 /**
13 * {@inheritdoc}
14 */
15 protected $profile = 'testing_config_install_multilingual';
16
17 /**
18 * {@inheritdoc}
19 */
20 protected $existingSyncDirectory = TRUE;
21
22 /**
23 * {@inheritdoc}
24 */
25 protected function visitInstaller() {
26 // Create an .install file with a hook_install() implementation.
27 $path = $this->siteDirectory . '/profiles/' . $this->profile;
28 $contents = <<<EOF
29 <?php
30
31 function testing_config_install_multilingual_install() {
32 }
33 EOF;
34 file_put_contents("$path/{$this->profile}.install", $contents);
35 parent::visitInstaller();
36 }
37
38 /**
39 * Installer step: Select installation profile.
40 */
41 protected function setUpProfile() {
42 // This is the form we are testing so wait until the test method to do
43 // assertions.
44 return;
45 }
46
47 /**
48 * Installer step: Requirements problem.
49 */
50 protected function setUpRequirementsProblem() {
51 // This form will never be reached.
52 return;
53 }
54
55 /**
56 * Installer step: Configure settings.
57 */
58 protected function setUpSettings() {
59 // This form will never be reached.
60 return;
61 }
62
63 /**
64 * Final installer step: Configure site.
65 */
66 protected function setUpSite() {
67 // This form will never be reached.
68 return;
69 }
70
71 /**
72 * {@inheritdoc}
73 */
74 protected function getConfigTarball() {
75 return __DIR__ . '/../../../fixtures/config_install/multilingual.tar.gz';
76 }
77
78 /**
79 * Tests installing from config is not available due to hook_INSTALL().
80 */
81 public function testConfigSync() {
82 $this->assertSession()->titleEquals('Select an installation profile | Drupal');
83 $this->assertSession()->responseNotContains('Use existing configuration');
84
85 // Remove the install hook and the option to install from existing
86 // configuration will be available.
87 unlink("{$this->siteDirectory}/profiles/{$this->profile}/{$this->profile}.install");
88 $this->getSession()->reload();
89 $this->assertSession()->titleEquals('Select an installation profile | Drupal');
90 $this->assertSession()->responseContains('Use existing configuration');
91 }
92
93 }