‪TYPO3CMS  ‪main
AbstractCest.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 
25 
27 {
28  private const ‪ADDITIONAL_CONFIGURATION_FILEPATH = 'typo3conf/system/additional.php';
29  protected const ‪INSTALL_TOOL_PASSWORD = 'temporary password';
30 
31  public function ‪_before(‪ApplicationTester $I): void
32  {
33  $I->amOnPage('typo3/install.php');
34  }
35 
36  public function ‪_after(‪ApplicationTester $I): void
37  {
38  $I->click('Logout');
39  // Make sure logout has finished
40  $I->waitForText('The Install Tool is locked', 20);
41 
42  $I->amGoingTo('clean up created files');
43  unlink(‪Environment::getProjectPath() . '/' . self::ADDITIONAL_CONFIGURATION_FILEPATH);
44 
45  $I->dontSeeFileFound($this->‪getEnableInstallToolFilePath());
46  $I->dontSeeFileFound(‪Environment::getProjectPath() . '/' . self::ADDITIONAL_CONFIGURATION_FILEPATH);
47  }
48 
49  protected function ‪getEnableInstallToolFilePath(): string
50  {
52  }
53 
54  protected function ‪logIntoInstallTool(‪ApplicationTester $I): void
55  {
56  $password = $this->‪setInstallToolPassword($I);
57 
58  $I->writeToFile($this->‪getEnableInstallToolFilePath(), '');
59  $I->reloadPage();
60  $I->waitForElementVisible('#t3-install-form-password');
61  $I->fillField('#t3-install-form-password', $password);
62  $I->click('Login');
63  $I->waitForText('Maintenance');
64  }
65 
66  private function ‪setInstallToolPassword(‪ApplicationTester $I): string
67  {
68  $hashMethod = GeneralUtility::makeInstance(Argon2iPasswordHash::class);
70  $hashedPassword = $hashMethod->getHashedPassword($password);
71  $I->writeToFile(
72  self::ADDITIONAL_CONFIGURATION_FILEPATH,
73  '<?php' . PHP_EOL . '$GLOBALS[\'TYPO3_CONF_VARS\'][\'BE\'][\'installToolPassword\'] = \'' . $hashedPassword . '\';'
74  );
75  return $password;
76  }
77 }
‪TYPO3\CMS\Core\Tests\Acceptance\Support\ApplicationTester
Definition: ApplicationTester.php:28
‪TYPO3\CMS\Install\Service\EnableFileService\INSTALL_TOOL_ENABLE_FILE_PATH
‪const INSTALL_TOOL_ENABLE_FILE_PATH
Definition: EnableFileService.php:30
‪TYPO3\CMS\Install\Service\EnableFileService
Definition: EnableFileService.php:26
‪TYPO3\CMS\Core\Tests\Acceptance\Application\InstallTool\AbstractCest\_after
‪_after(ApplicationTester $I)
Definition: AbstractCest.php:36
‪TYPO3\CMS\Core\Core\Environment\getVarPath
‪static getVarPath()
Definition: Environment.php:197
‪TYPO3\CMS\Core\Tests\Acceptance\Application\InstallTool\AbstractCest\logIntoInstallTool
‪logIntoInstallTool(ApplicationTester $I)
Definition: AbstractCest.php:54
‪TYPO3\CMS\Core\Core\Environment\getProjectPath
‪static string getProjectPath()
Definition: Environment.php:160
‪TYPO3\CMS\Core\Tests\Acceptance\Application\InstallTool
Definition: AbstractCest.php:18
‪TYPO3\CMS\Core\Tests\Acceptance\Application\InstallTool\AbstractCest\getEnableInstallToolFilePath
‪getEnableInstallToolFilePath()
Definition: AbstractCest.php:49
‪TYPO3\CMS\Core\Tests\Acceptance\Application\InstallTool\AbstractCest
Definition: AbstractCest.php:27
‪TYPO3\CMS\Core\Core\Environment
Definition: Environment.php:41
‪TYPO3\CMS\Core\Tests\Acceptance\Application\InstallTool\AbstractCest\_before
‪_before(ApplicationTester $I)
Definition: AbstractCest.php:31
‪TYPO3\CMS\Core\Tests\Acceptance\Application\InstallTool\AbstractCest\ADDITIONAL_CONFIGURATION_FILEPATH
‪const ADDITIONAL_CONFIGURATION_FILEPATH
Definition: AbstractCest.php:28
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:51
‪TYPO3\CMS\Core\Crypto\PasswordHashing\Argon2iPasswordHash
Definition: Argon2iPasswordHash.php:31
‪TYPO3\CMS\Core\Tests\Acceptance\Application\InstallTool\AbstractCest\setInstallToolPassword
‪setInstallToolPassword(ApplicationTester $I)
Definition: AbstractCest.php:66
‪TYPO3\CMS\Core\Tests\Acceptance\Application\InstallTool\AbstractCest\INSTALL_TOOL_PASSWORD
‪const INSTALL_TOOL_PASSWORD
Definition: AbstractCest.php:29