class PhpUnitWrapper implements IPhpUnitWrapper (View source)

PHPUnit Wrapper class.

Base class for PHPUnit wrapper classes to support different PHPUnit versions. The current implementation supports PHPUnit 3.4 and PHPUnit 3.5.

Properties

protected string $version

Shows the version, implemented by the phpunit-wrapper class instance.

Methods

public
bool
getCoverageStatus()

Getter for $coverage ($coverage).

public
setCoverageStatus($value)

Setter for $coverage ($coverage).

public
PHPUnit_Framework_TestSuite
getSuite()

Getter for $suite ($suite).

public
setSuite($value)

Setter for $suite ($suite).

public
PHPUnit_Framework_TestListener
getReporter()

Getter for $reporter ($reporter).

public
setReporter($value)

Setter for $reporter ($reporter).

public
PHPUnit_Framework_TestResult
getFrameworkTestResults()

Getter for $results ($results).

public
setFrameworkTestResults($value)

Setter for $results ($results).

public
string
getVersion()

Getter for $version ($version).

public static 
inst()

Loads and initiates phpunit, based on the available phpunit version.

public static 
bool
has_php_unit()

Returns true if one of the two supported PHPUNIT versions is installed.

public
init()

Implements method, defined in the interface IPhpUnitWrapper:init (IPhpUnitWrapper).

protected
beforeRunTests()

This method is called before the unittests are performed.

protected
afterRunTests()

This method is called after the unittests are performed.

public
runTests()

Perform all tests, added to the suite and initialises SilverStripe to collect the results of the unit tests.

protected
array
moduleDirectories()

Returns an array containing all the module folders in the base dir.

Details

bool getCoverageStatus()

Getter for $coverage ($coverage).

Return Value

bool

setCoverageStatus($value)

Setter for $coverage ($coverage).

Parameters

$value

PHPUnit_Framework_TestSuite getSuite()

Getter for $suite ($suite).

Return Value

PHPUnit_Framework_TestSuite

setSuite($value)

Setter for $suite ($suite).

Parameters

$value PHPUnit_Framework_TestSuite

PHPUnit_Framework_TestListener getReporter()

Getter for $reporter ($reporter).

Return Value

PHPUnit_Framework_TestListener

setReporter($value)

Setter for $reporter ($reporter).

Parameters

$value PHPUnit_Framework_TestListener

PHPUnit_Framework_TestResult getFrameworkTestResults()

Getter for $results ($results).

Return Value

PHPUnit_Framework_TestResult

setFrameworkTestResults($value)

Setter for $results ($results).

Parameters

$value PHPUnit_Framework_TestResult

string getVersion()

Getter for $version ($version).

Return Value

string

static PhpUnitWrapper inst()

Loads and initiates phpunit, based on the available phpunit version.

Return Value

PhpUnitWrapper

Instance of the php-wrapper class

static bool has_php_unit()

Returns true if one of the two supported PHPUNIT versions is installed.

Return Value

bool

true if PHPUnit has been installed on the environment.

init()

Implements method, defined in the interface IPhpUnitWrapper:init (IPhpUnitWrapper).

This wrapper class doesn't require any initialisation.

protected beforeRunTests()

This method is called before the unittests are performed.

This wrapper implements the non-PHPUnit version which means that unit tests can not be performed.

Exceptions

PhpUnitWrapper_Excption

protected afterRunTests()

This method is called after the unittests are performed.

This wrapper implements the non-PHPUnit version which means that unit tests can not be performed.

Exceptions

PhpUnitWrapper_Excption

runTests()

Perform all tests, added to the suite and initialises SilverStripe to collect the results of the unit tests.

This method calls beforeRunTests and afterRunTests.

protected array moduleDirectories()

Returns an array containing all the module folders in the base dir.

Return Value

array