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

Public Member Functions

 __destruct ()
 
 injectNamePrettifier (PHPUnit_Util_TestDox_NamePrettifier $namePrettifier)
 
 injectOutputService (Tx_Phpunit_Service_OutputService $outputService)
 
 setTotalNumberOfTests ($totalNumberOfTests)
 
 getTotalNumberOfDetectedDataProviderTests ()
 
 enableShowMemoryAndTime ()
 
 useHumanReadableTextFormat ()
 
 addRiskyTest (PHPUnit_Framework_Test $test, Exception $e, $time)
 
 startTestSuite (PHPUnit_Framework_TestSuite $suite)
 
 setTestSuiteName ($name)
 
 endTestSuite (PHPUnit_Framework_TestSuite $suite)
 
 assertionCount ()
 

Public Attributes

 $totalLeakedMemory = 0
 

Protected Member Functions

 getFirstNonPhpUnitTrace (array $traceData)
 
 setTimeLimit ($limit)
 
 createReRunLink (PHPUnit_Framework_TestCase $test)
 
 createReRunUrl (PHPUnit_Framework_TestCase $test)
 
 createTestId (PHPUnit_Framework_TestCase $test)
 
 getTestCaseName ()
 
 prettifyTestMethod ($testName)
 
 prettifyTestClass ($testClassName)
 

Protected Attributes

 $outputService = NULL
 
 $totalNumberOfTests = 0
 
 $totalNumberOfDetectedDataProviderTests = 0
 
 $currentTestNumber = 0
 
 $currentDataProviderNumber = 0
 
 $currentTestCaseName = ''
 
 $previousTestName = ''
 
 $memoryUsageStartOfTest = 0
 
 $memoryUsageEndOfTest = 0
 
 $testAssertions = 0
 
 $useHumanReadableTextFormat = FALSE
 
 $enableShowMemoryAndTime = FALSE
 
 $namePrettifier = NULL
 

Constructor & Destructor Documentation

Tx_Phpunit_BackEnd_TestListener::__destruct ( )

The destructor.

Member Function Documentation

Tx_Phpunit_BackEnd_TestListener::addRiskyTest ( PHPUnit_Framework_Test  $test,
Exception  $e,
  $time 
)

A risky test has been detected.

Parameters
PHPUnit_Framework_Test$test
Exception$e
float$time
Returns
void
Tx_Phpunit_BackEnd_TestListener::assertionCount ( )

Retrieves the collected amount of processed assertions.

Returns
int the number of executed assertions, will be >= 0
Tx_Phpunit_BackEnd_TestListener::createReRunLink ( PHPUnit_Framework_TestCase  $test)
protected

Creates the link (including an icon) to re-run the given single test.

Parameters
PHPUnit_Framework_TestCase$testthe test for which to create the re-run link
Returns
string the link to re-run the given test, will not be empty
Tx_Phpunit_BackEnd_TestListener::createReRunUrl ( PHPUnit_Framework_TestCase  $test)
protected

Creates the URL to re-run the given test.

Parameters
PHPUnit_Framework_TestCase$testthe test for which to create the re-run URL
Returns
string the htmlspecialchared URL to re-run the given test, will not be empty
Tx_Phpunit_BackEnd_TestListener::createTestId ( PHPUnit_Framework_TestCase  $test)
protected

Creates a unique string ID for $test that can be used in URLs.

Parameters
PHPUnit_Framework_TestCase$testa test for which to create an ID
Returns
string a unique ID for $test, not htmlspecialchared or URL-encoded yet
Tx_Phpunit_BackEnd_TestListener::enableShowMemoryAndTime ( )

Enables the option to show the memory leaks and time usage of the single tests.

Returns
void
Tx_Phpunit_BackEnd_TestListener::endTestSuite ( PHPUnit_Framework_TestSuite  $suite)

A test suite/case has ended.

Note: This function also gets called when a test that uses a data provider has ended.

Parameters
PHPUnit_Framework_TestSuite$suitethe test suite/case that has ended
Returns
void
Tx_Phpunit_BackEnd_TestListener::getFirstNonPhpUnitTrace ( array  $traceData)
protected

Returns the first trace information which is not caused by the PHPUnit file "Framework/Assert.php".

Parameters
array[]$traceData the trace data
Returns
array trace information
Tx_Phpunit_BackEnd_TestListener::getTestCaseName ( )
protected

Gets the current test case name.

Returns
string the current test case name, will not be empty
Tx_Phpunit_BackEnd_TestListener::getTotalNumberOfDetectedDataProviderTests ( )

Gets the total number of tests that were detected to come from data providers.

Note: As these are detected based on similar names, the first test from a data provider cannot be detected reliably; the number will always be too low.

Returns
int the total number of data-provider related tests detected so far, will be >= 0
Tx_Phpunit_BackEnd_TestListener::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_TestListener::injectOutputService ( Tx_Phpunit_Service_OutputService  $outputService)

Injects the output service.

Parameters
Tx_Phpunit_Service_OutputService$outputServicethe output service to inject
Returns
void
Tx_Phpunit_BackEnd_TestListener::prettifyTestClass (   $testClassName)
protected

Prettifies the name of a test class.

This method will return $testClass unchanged if human-readable names are disabled.

Parameters
string$testClassNamea camel-case test class name, must not be empty
Returns
string the prettified test class name, will not be empty
Tx_Phpunit_BackEnd_TestListener::prettifyTestMethod (   $testName)
protected

Prettifies the name of a test method.

This method will return $testName unchanged if human-readable names are disabled.

Parameters
string$testNamea camel-case test name, must not be empty
Returns
string the prettified test name, will not be empty
Tx_Phpunit_BackEnd_TestListener::setTestSuiteName (   $name)

Sets the name of the test suite that is used for creating the re-run link.

Parameters
string$namethe name of the test suite, must not be empty
Returns
void
Tx_Phpunit_BackEnd_TestListener::setTimeLimit (   $limit)
protected

Sets the PHP execution time limit.

Parameters
int$limitthe PHP execution time limit in seconds, must be >= 0
Returns
void
Tx_Phpunit_BackEnd_TestListener::setTotalNumberOfTests (   $totalNumberOfTests)

Sets the total number of tests to run (used for displaying the progress bar).

Parameters
int$totalNumberOfTeststhe total number of tests to run, must be >= 0
Returns
void
Tx_Phpunit_BackEnd_TestListener::startTestSuite ( PHPUnit_Framework_TestSuite  $suite)

A test suite/case has started.

Note: This function also gets called when a test that uses a data provider has started.

Parameters
PHPUnit_Framework_TestSuite$suitethe test suite/case that has started
Returns
void
Tx_Phpunit_BackEnd_TestListener::useHumanReadableTextFormat ( )

Enables the option to use human-readable test and test case names.

Returns
void

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