PHP Class PHPUnit_Framework_TestSuite, phpunit

Afficher le fichier Open project: sebastianbergmann/phpunit Class Usage Examples

Protected Properties

Свойство Type Description
$backupGlobals boolean Enable or disable the backup and restoration of the $GLOBALS array.
$backupStaticAttributes boolean Enable or disable the backup and restoration of static attributes.
$foundClasses array
$groups array The test groups of the test suite.
$name string The name of the test suite.
$numTests integer The number of tests in the test suite.
$runTestInSeparateProcess boolean
$testCase boolean
$tests array The tests in the test suite.

Méthodes publiques

Méthode Description
__construct ( mixed $theClass = '', string $name = '' ) Constructs a new TestSuite:
addTest ( PHPUnit_Framework_Test $test, array $groups = [] ) Adds a test to the suite.
addTestFile ( string $filename ) Wraps both addTest() and addTestSuite as well as the separate import statements for the user's convenience.
addTestFiles ( array | Iterator $filenames ) Wrapper for addTestFile() that adds multiple test files.
addTestSuite ( mixed $testClass ) Adds the tests from the given class to the suite.
count ( boolean $preferCache = false ) : integer Counts the number of test cases that will be run by this test.
createTest ( ReflectionClass $theClass, string $name ) : PHPUnit_Framework_Test
getGroupDetails ( )
getGroups ( ) : array Returns the test groups of the suite.
getIterator ( ) : RecursiveIteratorIterator Returns an iterator for this test suite.
getName ( ) : string Returns the name of the suite.
injectFilter ( PHPUnit_Runner_Filter_Factory $filter )
isTestMethod ( ReflectionMethod $method ) : boolean
markTestSuiteSkipped ( string $message = '' ) Mark the test suite as skipped.
run ( PHPUnit_Framework_TestResult $result = null ) : PHPUnit_Framework_TestResult Runs the tests and collects their result in a TestResult.
runTest ( PHPUnit_Framework_Test $test, PHPUnit_Framework_TestResult $result ) Runs a test.
setBackupGlobals ( boolean $backupGlobals )
setBackupStaticAttributes ( boolean $backupStaticAttributes )
setGroupDetails ( array $groups ) Set tests groups of the test case
setName ( $name ) Sets the name of the suite.
setRunTestInSeparateProcess ( boolean $runTestInSeparateProcess )
setTests ( array $tests ) Set tests of the test suite
setbeStrictAboutChangesToGlobalState ( boolean $beStrictAboutChangesToGlobalState )
testAt ( $index ) : PHPUnit_Framework_Test Returns the test at the given index.
tests ( ) : array Returns the tests as an enumeration.
toString ( ) : string Returns a string representation of the test suite.

Méthodes protégées

Méthode Description
addTestMethod ( ReflectionClass $class, ReflectionMethod $method )
createResult ( ) : PHPUnit_Framework_TestResult Creates a default TestResult object.
incompleteTest ( string $class, string $methodName, string $message ) : PHPUnit_Framework_IncompleteTestCase
setUp ( ) Template Method that is called before the tests of this test suite are run.
skipTest ( string $class, string $methodName, string $message ) : PHPUnit_Framework_SkippedTestCase
tearDown ( ) Template Method that is called after the tests of this test suite have finished running.
warning ( string $message ) : PHPUnit_Framework_WarningTestCase

Method Details

__construct() public méthode

- PHPUnit_Framework_TestSuite() constructs an empty TestSuite. - PHPUnit_Framework_TestSuite(ReflectionClass) constructs a TestSuite from the given class. - PHPUnit_Framework_TestSuite(ReflectionClass, String) constructs a TestSuite from the given class with the given name. - PHPUnit_Framework_TestSuite(String) either constructs a TestSuite from the given class (if the passed string is the name of an existing class) or constructs an empty TestSuite with the given name.
public __construct ( mixed $theClass = '', string $name = '' )
$theClass mixed
$name string

addTest() public méthode

Adds a test to the suite.
public addTest ( PHPUnit_Framework_Test $test, array $groups = [] )
$test PHPUnit_Framework_Test
$groups array

addTestFile() public méthode

If the named file cannot be read or there are no new tests that can be added, a PHPUnit_Framework_WarningTestCase will be created instead, leaving the current test run untouched.
public addTestFile ( string $filename )
$filename string

addTestFiles() public méthode

Wrapper for addTestFile() that adds multiple test files.
public addTestFiles ( array | Iterator $filenames )
$filenames array | Iterator

addTestMethod() protected méthode

protected addTestMethod ( ReflectionClass $class, ReflectionMethod $method )
$class ReflectionClass
$method ReflectionMethod

addTestSuite() public méthode

Adds the tests from the given class to the suite.
public addTestSuite ( mixed $testClass )
$testClass mixed

count() public méthode

Counts the number of test cases that will be run by this test.
public count ( boolean $preferCache = false ) : integer
$preferCache boolean Indicates if cache is preferred.
Résultat integer

createResult() protected méthode

Creates a default TestResult object.
protected createResult ( ) : PHPUnit_Framework_TestResult
Résultat PHPUnit_Framework_TestResult

createTest() public static méthode

public static createTest ( ReflectionClass $theClass, string $name ) : PHPUnit_Framework_Test
$theClass ReflectionClass
$name string
Résultat PHPUnit_Framework_Test

getGroupDetails() public méthode

public getGroupDetails ( )

getGroups() public méthode

Returns the test groups of the suite.
public getGroups ( ) : array
Résultat array

getIterator() public méthode

Returns an iterator for this test suite.

getName() public méthode

Returns the name of the suite.
public getName ( ) : string
Résultat string

incompleteTest() protected static méthode

protected static incompleteTest ( string $class, string $methodName, string $message ) : PHPUnit_Framework_IncompleteTestCase
$class string
$methodName string
$message string
Résultat PHPUnit_Framework_IncompleteTestCase

injectFilter() public méthode

public injectFilter ( PHPUnit_Runner_Filter_Factory $filter )
$filter PHPUnit_Runner_Filter_Factory

isTestMethod() public static méthode

public static isTestMethod ( ReflectionMethod $method ) : boolean
$method ReflectionMethod
Résultat boolean

markTestSuiteSkipped() public méthode

Mark the test suite as skipped.
public markTestSuiteSkipped ( string $message = '' )
$message string

run() public méthode

Runs the tests and collects their result in a TestResult.
public run ( PHPUnit_Framework_TestResult $result = null ) : PHPUnit_Framework_TestResult
$result PHPUnit_Framework_TestResult
Résultat PHPUnit_Framework_TestResult

runTest() public méthode

Runs a test.
Deprecation:
public runTest ( PHPUnit_Framework_Test $test, PHPUnit_Framework_TestResult $result )
$test PHPUnit_Framework_Test
$result PHPUnit_Framework_TestResult

setBackupGlobals() public méthode

public setBackupGlobals ( boolean $backupGlobals )
$backupGlobals boolean

setBackupStaticAttributes() public méthode

public setBackupStaticAttributes ( boolean $backupStaticAttributes )
$backupStaticAttributes boolean

setGroupDetails() public méthode

Set tests groups of the test case
public setGroupDetails ( array $groups )
$groups array

setName() public méthode

Sets the name of the suite.
public setName ( $name )

setRunTestInSeparateProcess() public méthode

public setRunTestInSeparateProcess ( boolean $runTestInSeparateProcess )
$runTestInSeparateProcess boolean

setTests() public méthode

Set tests of the test suite
public setTests ( array $tests )
$tests array

setUp() protected méthode

Template Method that is called before the tests of this test suite are run.
protected setUp ( )

setbeStrictAboutChangesToGlobalState() public méthode

public setbeStrictAboutChangesToGlobalState ( boolean $beStrictAboutChangesToGlobalState )
$beStrictAboutChangesToGlobalState boolean

skipTest() protected static méthode

protected static skipTest ( string $class, string $methodName, string $message ) : PHPUnit_Framework_SkippedTestCase
$class string
$methodName string
$message string
Résultat PHPUnit_Framework_SkippedTestCase

tearDown() protected méthode

Template Method that is called after the tests of this test suite have finished running.
protected tearDown ( )

testAt() public méthode

Returns the test at the given index.
public testAt ( $index ) : PHPUnit_Framework_Test
Résultat PHPUnit_Framework_Test

tests() public méthode

Returns the tests as an enumeration.
public tests ( ) : array
Résultat array

toString() public méthode

Returns a string representation of the test suite.
public toString ( ) : string
Résultat string

warning() protected static méthode

protected static warning ( string $message ) : PHPUnit_Framework_WarningTestCase
$message string
Résultat PHPUnit_Framework_WarningTestCase

Property Details

$backupGlobals protected_oe property

Enable or disable the backup and restoration of the $GLOBALS array.
protected bool $backupGlobals
Résultat boolean

$backupStaticAttributes protected_oe property

Enable or disable the backup and restoration of static attributes.
protected bool $backupStaticAttributes
Résultat boolean

$foundClasses protected_oe property

protected array $foundClasses
Résultat array

$groups protected_oe property

The test groups of the test suite.
protected array $groups
Résultat array

$name protected_oe property

The name of the test suite.
protected string $name
Résultat string

$numTests protected_oe property

The number of tests in the test suite.
protected int $numTests
Résultat integer

$runTestInSeparateProcess protected_oe property

protected bool $runTestInSeparateProcess
Résultat boolean

$testCase protected_oe property

protected bool $testCase
Résultat boolean

$tests protected_oe property

The tests in the test suite.
protected array $tests
Résultat array