PHPUnit
PHPUnit TYPO3 extension
 All Classes Namespaces Functions
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Tx_Phpunit_Service_TestFinder Class Reference
Inheritance diagram for Tx_Phpunit_Service_TestFinder:

Public Member Functions

 injectExtensionSettingsService (Tx_Phpunit_Interface_ExtensionSettingsService $service)
 
 __destruct ()
 
 getRelativeCoreTestsPath ()
 
 getAbsoluteCoreTestsPath ()
 
 hasCoreTests ()
 
 existsTestableForKey ($key)
 
 existsTestableForAnything ()
 
 getTestableForKey ($key)
 
 getTestablesForEverything ()
 
 getTestablesForExtensions ()
 
 sortTestablesByKey (Tx_Phpunit_Testable $testable1, Tx_Phpunit_Testable $testable2)
 
 getDummyExtensionKeys ()
 

Protected Member Functions

 getLoadedExtensionKeys ()
 
 getExcludedExtensionKeys ()
 
 findTestsPathForExtension ($extensionKey)
 

Protected Attributes

 $allTestables = array()
 
 $allTestablesAreCached = FALSE
 
 $extensionSettingsService = NULL
 

Static Protected Attributes

static $allowedTestDirectoryNames = array('Tests/', 'tests/')
 
static $dummyExtensionKeys = array('aaa', 'bbb', 'ccc', 'ddd')
 

Constructor & Destructor Documentation

Tx_Phpunit_Service_TestFinder::__destruct ( )

The destructor.

Member Function Documentation

Tx_Phpunit_Service_TestFinder::existsTestableForAnything ( )

Checks whether there is at least one tests directory in at least one extension or in the TYPO3 Core.

Returns
boolean TRUE if there ist at least one test directory, FALSE otherwise
Tx_Phpunit_Service_TestFinder::existsTestableForKey (   $key)

Checks whether there is testable code for a key.

Parameters
string$keythe key to check, might be an extension key, the core key or any other string (even an empty string)
Returns
boolean TRUE if there is testable code with the given key, FALSE otherwise
Tx_Phpunit_Service_TestFinder::findTestsPathForExtension (   $extensionKey)
protected

Finds the absolute path to the tests of the extension with the key $extensionKey.

Parameters
string$extensionKeythe key of an installed extension, must not be empty
Returns
string the absolute path of the tests directory of the given extension (might differ in case from the actual tests directory on case-insensitive file systems)
Exceptions
InvalidArgumentException
Tx_Phpunit_Exception_NoTestsDirectoryif the given extension has no tests directory
Tx_Phpunit_Service_TestFinder::getAbsoluteCoreTestsPath ( )

Gets the absolute path of the TYPO3 Core unit tests.

If there is no tests directory for the Core, this function will return an empty string.

Returns
string the absolute path of the TYPO3 Core unit tests, will be empty if there is no Core tests directory
Tx_Phpunit_Service_TestFinder::getDummyExtensionKeys ( )

Returns the keys of the extensions excluded from unit testing because they are the dummy extensions of phpunit.

Returns
array<string> the keys of the dummy extensions, will not be empty
Tx_Phpunit_Service_TestFinder::getExcludedExtensionKeys ( )
protected

Returns the keys of the extensions excluded from unit testing via the phpunit configuration.

Returns
array<string> the keys of the excluded extensions, might be empty
Tx_Phpunit_Service_TestFinder::getLoadedExtensionKeys ( )
protected

Returns the keys of the loaded extensions.

Returns
array<string> the keys of the loaded extensions, might be empty
Tx_Phpunit_Service_TestFinder::getRelativeCoreTestsPath ( )

Gets the path of the TYPO3 Core unit tests relative to PATH_site.

If there is no tests directory for the Core, this function will return an empty string.

Returns
string the path of the TYPO3 Core unit tests relative to PATH_site, will be empty if there is no Core tests directory
Tx_Phpunit_Service_TestFinder::getTestableForKey (   $key)

Returns the testable code for the given key.

Parameters
string$keythe key for which to get the testable, must an extension key or the core key, must not be empty
Returns
Tx_Phpunit_Testable the testable for the given key
Exceptions
InvalidArgumentException
BadMethodCallException
Tx_Phpunit_Service_TestFinder::getTestablesForEverything ( )

Returns the testable code instance for everything, i.e., the core and all installed extensions.

Returns
array<Tx_Phpunit_Testable> testable code for everything using the extension keys or the core key as array keys, might be empty
Tx_Phpunit_Service_TestFinder::getTestablesForExtensions ( )

Returns the testable code for all installed extensions, sorted in alphabetical order by extension name.

Extensions without a test directory and extensions in the "exclude list" will be skipped.

Returns
array<Tx_Phpunit_Testable> testable code for the installed extensions using the extension keys as array keys, might be empty
Tx_Phpunit_Service_TestFinder::hasCoreTests ( )

Checks whether the TYPO3 Core has a tests directory.

Returns
boolean TRUE if the TYPO3 Core has a tests directory, FALSE otherwise
Tx_Phpunit_Service_TestFinder::injectExtensionSettingsService ( Tx_Phpunit_Interface_ExtensionSettingsService  $service)

Injects the extension settings service.

Parameters
Tx_Phpunit_Interface_ExtensionSettingsService$servicethe service to inject
Returns
void
Tx_Phpunit_Service_TestFinder::sortTestablesByKey ( Tx_Phpunit_Testable  $testable1,
Tx_Phpunit_Testable  $testable2 
)

Callback function for comparing the keys of $testable1 and $testable2.

Parameters
Tx_Phpunit_Testable$testable1the first item to compare
Tx_Phpunit_Testable$testable2the second item to compare
Returns
integer 1 if both items need to be swapped, 0 if they have the same key, and -1 if the order is okay.

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