TYPO3  7.6
Public Member Functions | Protected Member Functions | List of all members
UnitTestsBootstrap Class Reference

Public Member Functions

 bootstrapSystem ()
 

Protected Member Functions

 enableDisplayErrors ()
 
 checkForCliDispatch ()
 
 getWebRoot ()
 
 createNecessaryDirectoriesInDocumentRoot ()
 
 createDirectory ($directory)
 
 includeAndStartCoreBootstrap ()
 
 initializeConfiguration ()
 
 finishCoreBootstrap ()
 

Detailed Description

This file is defined in UnitTests.xml and called by phpunit before instantiating the test suites, it must also be included with phpunit parameter –bootstrap if executing single test case classes.

For easy access to the PHPUnit and VFS framework, it is recommended to install the phpunit TYPO3 Extension It does not need to be activated, nor a cli user needs to be present. But it is also possible to use other installations of PHPUnit and VFS

cd /var/www/t3master/foo # Document root of TYPO3 CMS sources (location of index.php)

Call single test case, example:

Definition at line 38 of file UnitTestsBootstrap.php.

Member Function Documentation

bootstrapSystem ( )

Bootstraps the system for unit tests.

Returns
void

Definition at line 45 of file UnitTestsBootstrap.php.

References UnitTestsBootstrap\enableDisplayErrors().

checkForCliDispatch ( )
protected

Checks whether the tests are run using the CLI dispatcher. If so, echos a helpful message and exits with an error code 1.

Returns
UnitTestsBootstrap fluent interface

Definition at line 74 of file UnitTestsBootstrap.php.

createDirectory (   $directory)
protected

Creates the directory $directory (recursively if required).

If $directory already exists, this method is a no-op.

Parameters
string$directoryabsolute path of the directory to be created
Returns
void
Exceptions
\RuntimeException

Definition at line 167 of file UnitTestsBootstrap.php.

Referenced by UnitTestsBootstrap\createNecessaryDirectoriesInDocumentRoot().

createNecessaryDirectoriesInDocumentRoot ( )
protected

Creates the following directories in the TYPO3 document root:

  • typo3conf
  • typo3conf/ext
  • typo3temp
  • uploads
Returns
UnitTestsBootstrap fluent interface

Definition at line 149 of file UnitTestsBootstrap.php.

References UnitTestsBootstrap\createDirectory().

enableDisplayErrors ( )
protected

Makes sure error messages during the tests get displayed no matter what is set in php.ini.

Returns
UnitTestsBootstrap fluent interface

Definition at line 62 of file UnitTestsBootstrap.php.

Referenced by UnitTestsBootstrap\bootstrapSystem().

finishCoreBootstrap ( )
protected

Finishes the last steps of the Core Bootstrap.

Returns
UnitTestsBootstrap fluent interface

Definition at line 220 of file UnitTestsBootstrap.php.

References Bootstrap\getInstance().

getWebRoot ( )
protected

Returns the absolute path the TYPO3 document root.

Returns
string the TYPO3 document root using Unix path separators

Definition at line 114 of file UnitTestsBootstrap.php.

includeAndStartCoreBootstrap ( )
protected

Includes the Core Bootstrap class and calls its first few functions.

Returns
UnitTestsBootstrap fluent interface

Definition at line 184 of file UnitTestsBootstrap.php.

References Bootstrap\getInstance().

initializeConfiguration ( )
protected

Provides the default configuration in $GLOBALS['TYPO3_CONF_VARS'].

Returns
UnitTestsBootstrap fluent interface

Definition at line 204 of file UnitTestsBootstrap.php.

References $GLOBALS.