‪TYPO3CMS  11.5
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 {
28  {
29  $acceptanceUrl = $I->grabModuleConfig('WebDriver', 'url');
30  $acceptanceUrlWithTrailingSlash = rtrim($acceptanceUrl, '/') . '/';
31  $acceptanceHost = $this->‪getHostWithPortFromUrl($acceptanceUrl);
32 
33  $trustedHostsPatternConfig = '<?php' . PHP_EOL
34  . '$GLOBALS[\'TYPO3_CONF_VARS\'][\'SYS\'][\'trustedHostsPattern\'] = \'' . $acceptanceHost . '\';';
35  $I->writeToFile('typo3conf/AdditionalConfiguration.php', $trustedHostsPatternConfig);
36 
37  $configFile = __DIR__ . '/../../../../../../typo3temp/var/tests/acceptance/typo3conf/sites/introduction/config.yaml';
38  $config = file($configFile);
39  if (str_contains($config[0], 'base: /')) {
40  $I->amGoingTo('manipulate base in sites config');
41  $config[0] = 'base: ' . $acceptanceUrlWithTrailingSlash . PHP_EOL;
42  file_put_contents($configFile, $config);
43  }
44  $I->amOnPage('/typo3');
45  $I->click('Maintenance');
46  $I->switchToContentFrame();
47 
48  try {
49  // fill in sudo mode password
50  $I->see('Confirm with user password');
51  $I->fillField('confirmationPassword', 'password');
52  $I->click('Confirm');
53  $I->wait(10);
54  // wait for Maintenance headline being available
55  $I->waitForText('Maintenance');
56  $I->canSee('Maintenance', 'h1');
57  } catch (\Exception $e) {
58  // nothing...
59  }
60 
61  $I->click('Flush cache');
62  }
63 
68  protected function getHostWithPortFromUrl(string $url): string
69  {
70  $urlParts = parse_url($url);
71  return $urlParts['host'] . (isset($urlParts['port']) ? ':' . $urlParts['port'] : '');
72  }
73 }
‪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:68
‪TYPO3\CMS\Core\Tests\Acceptance\Install\AbstractIntroductionPackage\manipulateSiteConfigurationOnlyForTesting
‪manipulateSiteConfigurationOnlyForTesting(InstallTester $I)
Definition: AbstractIntroductionPackage.php:27
‪TYPO3\CMS\Core\Tests\Acceptance\Install\AbstractIntroductionPackage
Definition: AbstractIntroductionPackage.php:23