PHPUnit
PHPUnit TYPO3 extension
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Tx_Phpunit_BackEnd_Module Class Reference
Inheritance diagram for Tx_Phpunit_BackEnd_Module:

Public Member Functions

 __construct ()
 
 __destruct ()
 
 injectRequest (Tx_Phpunit_Interface_Request $request)
 
 injectTestListener (Tx_Phpunit_BackEnd_TestListener $testListener)
 
 injectNamePrettifier (PHPUnit_Util_TestDox_NamePrettifier $namePrettifier)
 
 injectOutputService (Tx_Phpunit_Service_OutputService $service)
 
 injectUserSettingsService (Tx_Phpunit_Interface_UserSettingsService $service)
 
 injectTestFinder (Tx_Phpunit_Service_TestFinder $testFinder)
 
 injectTestCaseService (Tx_Phpunit_Service_TestCaseService $testCaseService)
 
 main ()
 

Public Attributes

const EXTENSION_KEY = 'phpunit'
 
const MODULE_NAME = 'tools_txphpunitbeM1'
 

Protected Member Functions

 translate ($key)
 
 getLanguageService ()
 
 addAdditionalHeaderData ()
 
 cleanOutputBuffers ()
 
 renderRunTests ()
 
 getAndSaveSelectedTestableKey ()
 
 createCheckboxes ()
 
 renderRunningTest ()
 
 setPhpUnitErrorHandler ()
 
 renderTestingHeader ($testableKey)
 
 collectTestablesToProcess ($testableKey)
 
 loadAllFilesContainingTestCasesForSingleTestable (Tx_Phpunit_Testable $testable)
 
 createTestSuiteWithAllTestCases ()
 
 configureTestListener ()
 
 runAllTests (PHPUnit_Framework_TestSuite $testSuiteWithAllTestCases, PHPUnit_Framework_TestResult $testResult)
 
 renderTestStatistics (PHPUnit_Framework_TestResult $testResult)
 
 renderReRunButton ()
 
 renderCodeCoverage ()
 
 createOpenNewWindowLink ()
 
 findTestCasesInDir ($directory)
 
 loadRequiredTestClasses (array $paths)
 
 createIconStyle ($extensionKey)
 
 shouldCollectCodeCoverageInformation ()
 

Protected Attributes

 $extensionPath = ''
 
 $namePrettifier = NULL
 
 $request = NULL
 
 $testFinder = NULL
 
 $testCaseService = NULL
 
 $testListener = NULL
 
 $outputService = NULL
 
 $userSettingsService = NULL
 
 $coverage = NULL
 
 $testStatistics = NULL
 

Constructor & Destructor Documentation

Tx_Phpunit_BackEnd_Module::__construct ( )

The constructor.

Tx_Phpunit_BackEnd_Module::__destruct ( )

The destructor.

Member Function Documentation

Tx_Phpunit_BackEnd_Module::addAdditionalHeaderData ( )
protected

Adds some JavaScript and CSS stuff to header data.

Returns
void
Tx_Phpunit_BackEnd_Module::cleanOutputBuffers ( )
protected

Ends and cleans all output buffers.

Returns
void
Tx_Phpunit_BackEnd_Module::collectTestablesToProcess (   $testableKey)
protected

Collects the testables to process as directed by the given testable key.

Parameters
string$testableKeythe key of the selected testable
Returns
Tx_Phpunit_Testable[] the testables to process
Tx_Phpunit_BackEnd_Module::configureTestListener ( )
protected

Configures the test listener as defined in the user settings.

Returns
void
Tx_Phpunit_BackEnd_Module::createCheckboxes ( )
protected

Renders the checkboxes for hiding or showing various test results.

Returns
string HTML code with checkboxes and a surrounding form
Tx_Phpunit_BackEnd_Module::createIconStyle (   $extensionKey)
protected

Creates the CSS style attribute content for an icon for the extension $extensionKey.

Parameters
string$extensionKeythe key of a loaded extension, may also be "typo3"
Returns
string the content for the "style" attribute, will not be empty
Exceptions
Tx_Phpunit_Exception_NoTestsDirectoryif there is not extension with tests with the given key
Tx_Phpunit_BackEnd_Module::createOpenNewWindowLink ( )
protected

Renders a link which opens the current screen in a new window,

Returns
string
Tx_Phpunit_BackEnd_Module::createTestSuiteWithAllTestCases ( )
protected

Creates a test suite that contains all test cases in the systems (but filters out this extension's base test cases).

Returns
PHPUnit_Framework_TestSuite the test suite with all test cases added
Tx_Phpunit_BackEnd_Module::findTestCasesInDir (   $directory)
protected

Recursively finds all test case files in the directory $directory.

Parameters
string$directorythe absolute path of the directory in which to look for test cases, must not be empty
Returns
array[] files names of the test cases in the directory $dir and all its subdirectories relative to $dir, will be empty if no test cases have been found
Tx_Phpunit_BackEnd_Module::getAndSaveSelectedTestableKey ( )
protected

Gets the key of the currently selected testable and saves it to the user settings.

Returns
string the currently selected testable key, will not be empty
Tx_Phpunit_BackEnd_Module::getLanguageService ( )
protected

Returns $GLOBALS['LANG'].

Returns
LanguageService
Tx_Phpunit_BackEnd_Module::injectNamePrettifier ( PHPUnit_Util_TestDox_NamePrettifier  $namePrettifier)

Injects the name prettifier.

Parameters
PHPUnit_Util_TestDox_NamePrettifier$namePrettifierthe name prettifier to inject
Returns
void
Tx_Phpunit_BackEnd_Module::injectOutputService ( Tx_Phpunit_Service_OutputService  $service)

Injects the output service.

Parameters
Tx_Phpunit_Service_OutputService$servicethe service to inject
Returns
void
Tx_Phpunit_BackEnd_Module::injectRequest ( Tx_Phpunit_Interface_Request  $request)

Injects the request.

Parameters
Tx_Phpunit_Interface_Request$requestthe request to inject
Returns
void
Tx_Phpunit_BackEnd_Module::injectTestCaseService ( Tx_Phpunit_Service_TestCaseService  $testCaseService)

Injects the test case service.

Parameters
Tx_Phpunit_Service_TestCaseService$testCaseServicethe test case service to inject
Returns
void
Tx_Phpunit_BackEnd_Module::injectTestFinder ( Tx_Phpunit_Service_TestFinder  $testFinder)

Injects the test finder.

Parameters
Tx_Phpunit_Service_TestFinder$testFinderthe test finder to inject
Returns
void
Tx_Phpunit_BackEnd_Module::injectTestListener ( Tx_Phpunit_BackEnd_TestListener  $testListener)

Injects the test listener.

Parameters
Tx_Phpunit_BackEnd_TestListener$testListenerthe test listener to inject
Returns
void
Tx_Phpunit_BackEnd_Module::injectUserSettingsService ( Tx_Phpunit_Interface_UserSettingsService  $service)

Injects the user settings service.

Parameters
Tx_Phpunit_Interface_UserSettingsService$servicethe service to inject
Returns
void
Tx_Phpunit_BackEnd_Module::loadAllFilesContainingTestCasesForSingleTestable ( Tx_Phpunit_Testable  $testable)
protected

Loads all files containing test cases for the given testable.

Parameters
Tx_Phpunit_Testable$testablethe testable for which to load all test case files
Returns
void
Tx_Phpunit_BackEnd_Module::loadRequiredTestClasses ( array  $paths)
protected

Includes all PHP files given in $paths.

Parameters
array[]$paths array keys: absolute path array values: array of file names in that path
Returns
void
Tx_Phpunit_BackEnd_Module::main ( )

Main function of the module. Outputs all content directly instead of collecting it and doing the output later.

Returns
void
Tx_Phpunit_BackEnd_Module::renderCodeCoverage ( )
protected

Renders and outputs the code coverage report.

Returns
void
Tx_Phpunit_BackEnd_Module::renderReRunButton ( )
protected

Renders and output the re-run button.

Returns
void
Tx_Phpunit_BackEnd_Module::renderRunningTest ( )
protected

Renders the screen for the function "Run tests" which shows and runs the actual unit tests.

Returns
void
Tx_Phpunit_BackEnd_Module::renderRunTests ( )
protected

Renders the screens for function "Run tests".

Returns
void
Tx_Phpunit_BackEnd_Module::renderTestingHeader (   $testableKey)
protected

Renders and outputs the "Testing ..." header for the given testable key.

Parameters
string$testableKeythe key of the selected testable
Returns
void
Tx_Phpunit_BackEnd_Module::renderTestStatistics ( PHPUnit_Framework_TestResult  $testResult)
protected

Renders and output the tests statistics.

Parameters
PHPUnit_Framework_TestResult$testResultthe test result
Returns
void
Tx_Phpunit_BackEnd_Module::runAllTests ( PHPUnit_Framework_TestSuite  $testSuiteWithAllTestCases,
PHPUnit_Framework_TestResult  $testResult 
)
protected

Runs all tests.

Parameters
PHPUnit_Framework_TestSuite$testSuiteWithAllTestCasessuite with all test cases
PHPUnit_Framework_TestResult$testResultthe test result (will be modified)
Returns
void
Tx_Phpunit_BackEnd_Module::setPhpUnitErrorHandler ( )
protected

Sets the PHPUnit error handler to catch all errors. This is important as PHPUnit only sets its error handler if nothing has been set before, but typically an error handler is set during by TYPO3 during the initialization.

Returns
void
Tx_Phpunit_BackEnd_Module::shouldCollectCodeCoverageInformation ( )
protected

Checks whether code coverage information should be collected.

Returns
bool whether code coverage information should be collected
Tx_Phpunit_BackEnd_Module::translate (   $key)
protected

Returns the localized string for the key $key.

Parameters
string$keythe key of the string to retrieve, must not be empty
Returns
string the localized string for the key $key

The documentation for this class was generated from the following file: