‪TYPO3CMS  10.4
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 
24 
26 {
27  public const ‪ENABLE_INSTALL_TOOL_FILEPATH = 'typo3conf/ENABLE_INSTALL_TOOL';
28  public const ‪ADDITIONAL_CONFIGURATION_FILEPATH = 'typo3conf/AdditionalConfiguration.php';
29 
30  public function ‪_before(‪BackendTester $I)
31  {
32  $I->amOnPage('typo3/install.php');
33  }
34 
35  public function ‪_after(‪BackendTester $I)
36  {
37  $I->click('Logout');
38 
39  $I->amGoingTo('clean up created files');
40  unlink(‪Environment::getProjectPath() . '/' . self::ADDITIONAL_CONFIGURATION_FILEPATH);
41 
42  $I->dontSeeFileFound(‪Environment::getProjectPath() . '/' . self::ENABLE_INSTALL_TOOL_FILEPATH);
43  $I->dontSeeFileFound(‪Environment::getProjectPath() . '/' . self::ADDITIONAL_CONFIGURATION_FILEPATH);
44  }
45 
46  protected function ‪logIntoInstallTool(‪BackendTester $I)
47  {
48  $password = $this->‪setInstallToolPassword($I);
49 
51  $I->reloadPage();
52  $I->fillField('#t3-install-form-password', $password);
53  $I->click('Login');
54  $I->waitForText('Maintenance');
55  }
56 
62  private function ‪setInstallToolPassword(‪BackendTester $I): string
63  {
64  $hashMethod = GeneralUtility::makeInstance(Argon2iPasswordHash::class);
65  $password = 'temporary password';
66  $hashedPassword = $hashMethod->getHashedPassword($password);
67  $I->writeToFile(
68  self::ADDITIONAL_CONFIGURATION_FILEPATH,
69  '<?php' . PHP_EOL . '$GLOBALS[\'TYPO3_CONF_VARS\'][\'BE\'][\'installToolPassword\'] = \'' . $hashedPassword . '\';'
70  );
71  return $password;
72  }
73 }
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\InstallTool\AbstractCest\_before
‪_before(BackendTester $I)
Definition: AbstractCest.php:30
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\InstallTool\AbstractCest\ADDITIONAL_CONFIGURATION_FILEPATH
‪const ADDITIONAL_CONFIGURATION_FILEPATH
Definition: AbstractCest.php:28
‪TYPO3\CMS\Core\Core\Environment\getProjectPath
‪static string getProjectPath()
Definition: Environment.php:169
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\InstallTool
Definition: AbstractCest.php:18
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\InstallTool\AbstractCest
Definition: AbstractCest.php:26
‪TYPO3\CMS\Core\Tests\Acceptance\Support\BackendTester
Definition: BackendTester.php:27
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\InstallTool\AbstractCest\logIntoInstallTool
‪logIntoInstallTool(BackendTester $I)
Definition: AbstractCest.php:46
‪TYPO3\CMS\Core\Core\Environment
Definition: Environment.php:40
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\InstallTool\AbstractCest\setInstallToolPassword
‪string setInstallToolPassword(BackendTester $I)
Definition: AbstractCest.php:62
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46
‪TYPO3\CMS\Core\Crypto\PasswordHashing\Argon2iPasswordHash
Definition: Argon2iPasswordHash.php:31
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\InstallTool\AbstractCest\ENABLE_INSTALL_TOOL_FILEPATH
‪const ENABLE_INSTALL_TOOL_FILEPATH
Definition: AbstractCest.php:27
‪TYPO3\CMS\Core\Tests\Acceptance\Backend\InstallTool\AbstractCest\_after
‪_after(BackendTester $I)
Definition: AbstractCest.php:35