Skip to content
This repository was archived by the owner on Jun 30, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ $structure = $defaultSection->getStructure();
$this->assertTrue(is_array($structure['pages:1']['__contents']['tt_content:1']));
```

In case of using helhum/typo3-secure-web do not forget to set TYPO3_PATH_WEB to your web-dir folder

#### Structure

The returned structure of a frontend request is an array with some information about your page and its children.
Expand Down Expand Up @@ -203,3 +205,7 @@ Following links provide documentation and additional information about TYPO3 CMS
- [Functional tests for dummies](https://de.slideshare.net/cpsitgmbh/functional-tests-for-dummies-65673214)

Last but not least you may ask for further support in the Slack channel "[#cig-testing](https://typo3.slack.com/messages/cig-testing)".

## helhum/typo3-secure-web compatibility

In case of using helhum/typo3-secure-web you should set TYPO3_PATH_ROOT to your private dir, and TYPO3_PATH_WEB to the public one.
40 changes: 40 additions & 0 deletions src/TestingFramework/Bootstrap/AbstractBootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public function bootstrapFunctionalTestSystem()
$this->enableDisplayErrors();
$this->createNecessaryDirectoriesInDocumentRoot();
$this->defineOriginalRootPath();
$this->defineOriginalWebPath();
}

/**
Expand Down Expand Up @@ -151,6 +152,27 @@ protected function defineOriginalRootPath()
}
}

/**
* Defines the constant ORIGINAL_WEB for the path to the web(public) TYPO3 root dir
* In case of using helhum/typo3-secure-web your private and public sources can have different root paths
*
* @return void
*/
protected function defineOriginalWebPath()
{
if (!defined('ORIGINAL_WEB')) {
/** @var string */
define('ORIGINAL_WEB', $this->getPublicRootPath());
}

if (!file_exists(ORIGINAL_WEB . 'index.php')) {
$this->exitWithMessage(
'Unable to determine path to entry script.'
. ' Please check your path or set an environment variable \'TYPO3_PATH_WEB\' to your public root path.'
);
}
}

/**
* Returns the absolute path to the TYPO3 document root
*
Expand All @@ -169,6 +191,24 @@ protected function getWebRoot()
return rtrim(str_replace('\\', '/', $webRoot), '/') . '/';
}

/**
* Returns the absolute path to the TYPO3 public root dir
*
* @return string the TYPO3 public root using Unix path separators
*/
protected function getPublicRootPath()
{
if (getenv('TYPO3_PATH_WEB')) {
$publicRoot = getenv('TYPO3_PATH_WEB');
} elseif (getenv('TYPO3_PATH_ROOT')) {
$publicRoot = getenv('TYPO3_PATH_ROOT');
} else {
$publicRoot = getcwd();
}

return rtrim(str_replace('\\', '/', $publicRoot), '/') . '/';
}

/**
* Creates the directory $directory (recursively if required).
*
Expand Down
15 changes: 9 additions & 6 deletions src/TestingFramework/TestSystem/AbstractTestSystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ protected function setUpSystemCoreLinks()
{
$linksToSet = [
ORIGINAL_ROOT . 'typo3' => $this->systemPath . 'typo3',
ORIGINAL_ROOT . 'index.php' => $this->systemPath . 'index.php',
ORIGINAL_WEB . 'index.php' => $this->systemPath . 'index.php',
];
foreach ($linksToSet as $from => $to) {
if (!symlink($from, $to)) {
Expand Down Expand Up @@ -337,11 +337,14 @@ protected function linkTestExtensionsToSystem(array $extensionPaths)
);
}
$destinationPath = $this->systemPath . 'typo3conf/ext/' . basename($absoluteExtensionPath);
if (!symlink($absoluteExtensionPath, $destinationPath)) {
throw new Exception(
'Can not link extension folder: ' . $absoluteExtensionPath . ' to ' . $destinationPath,
1376657142
);

if (!file_exists($destinationPath)) {
if (!symlink($absoluteExtensionPath, $destinationPath)) {
throw new Exception(
'Can not link extension folder: ' . $absoluteExtensionPath . ' to ' . $destinationPath,
1376657142
);
}
}
}
}
Expand Down