Issue Task Closed

#72450Instance path for test instance configuration

Artus Kolanowski 12/27/15, 15:25 updated 10/02/18, 11:19

Description

In a functional test I need to test the result of a mail function. My approach is to use mbox as transport. But mbox needs an absolute path which should be a folder within the test instance. The problem is that the instance path private and it’s set after the configuration was written and thus I can’t use a path within the test instance. So it would be very helpful to have the instance path as constant in the functional test case. My proposal would be a dynamic generated constant FULL_QUALIFIED_TEST_CASE_CLASS_NAME_PATH which contains the instance path and is available on object instance level (so not static). Additionally the class `\TYPO3\CMS\Core\Tests\FunctionalTestCaseBootstrapUtility` should provide two static public methods:

/**
 * Calculates a "unique" identifier for the given test case class name.
 *
 * @param string $testCaseClassName
 * @return string
 */
public static function getIdentifier($testCaseClassName) {
  return substr(sha1($testCaseClassName), 0, 7);
}
/**
 * Calculates path to TYPO3 CMS test installation the given test case class name.
 *
 * @param string $testCaseClassName
 * @return string
 */
public static function getInstancePath($testCaseClassName) {
  return ORIGINAL_ROOT . 'typo3temp/functional-' . static::getIdentifier($testCaseClassName);
}

If already implemented this so if want I could contribute.

Reviews 3