‪TYPO3CMS  10.4
AbstractIntroductionPackage.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
21 
23 {
24 
29  {
30  $acceptanceUrl = $I->grabModuleConfig('WebDriver', 'url');
31  $acceptanceUrlWithTrailingSlash = rtrim($acceptanceUrl, '/') . '/';
32  $acceptanceHost = $this->‪getHostWithPortFromUrl($acceptanceUrl);
33 
34  $trustedHostsPatternConfig = '<?php' . PHP_EOL
35  . '$GLOBALS[\'TYPO3_CONF_VARS\'][\'SYS\'][\'trustedHostsPattern\'] = \'' . $acceptanceHost . '\';';
36  $I->writeToFile('typo3conf/AdditionalConfiguration.php', $trustedHostsPatternConfig);
37 
38  $configFile = __DIR__ . '/../../../../../../typo3temp/var/tests/acceptance/typo3conf/sites/introduction/config.yaml';
39  $config = file($configFile);
40  if (strpos($config[0], 'base: /') !== false) {
41  $I->amGoingTo('manipulate base in sites config');
42  $config[0] = 'base: ' . $acceptanceUrlWithTrailingSlash . PHP_EOL;
43  file_put_contents($configFile, $config);
44  }
45  $I->amOnPage('/typo3');
46  $I->click('Maintenance');
47  $I->switchToContentFrame();
48 
49  try {
50  // fill in sudo mode password
51  $I->see('Confirm with user password');
52  $I->fillField('confirmationPassword', 'password');
53  $I->click('Confirm');
54  $I->wait(10);
55  // wait for Maintenance headline being available
56  $I->waitForText('Maintenance');
57  $I->canSee('Maintenance', 'h1');
58  } catch (\Exception $e) {
59  // nothing...
60  }
61 
62  $I->click('Flush cache');
63  }
64 
69  protected function getHostWithPortFromUrl(string $url): string
70  {
71  $urlParts = parse_url($url);
72  return $urlParts['host'] . (isset($urlParts['port']) ? ':' . $urlParts['port'] : '');
73  }
74 }
‪TYPO3\CMS\Core\Tests\Acceptance\Support\InstallTester
Definition: InstallTester.php:27
‪TYPO3\CMS\Core\Tests\Acceptance\Install
Definition: AbstractIntroductionPackage.php:18
‪TYPO3\CMS\Core\Tests\Acceptance\Install\AbstractIntroductionPackage\getHostWithPortFromUrl
‪string getHostWithPortFromUrl(string $url)
Definition: AbstractIntroductionPackage.php:69
‪TYPO3\CMS\Core\Tests\Acceptance\Install\AbstractIntroductionPackage\manipulateSiteConfigurationOnlyForTesting
‪manipulateSiteConfigurationOnlyForTesting(InstallTester $I)
Definition: AbstractIntroductionPackage.php:28
‪TYPO3\CMS\Core\Tests\Acceptance\Install\AbstractIntroductionPackage
Definition: AbstractIntroductionPackage.php:23