PHP Class PHPUnit_Extension_FunctionMocker

Afficher le fichier Open project: lstrojny/phpunit-function-mocker Class Usage Examples

Méthodes publiques

Méthode Description
getMock ( )
mockFunction ( $function )
start ( PHPUnit_Framework_TestCase $testCase, string $namespace ) : PHPUnit_Extension_FunctionMocker Create a mock for the given namespace to override global namespace functions.
tearDown ( )

Private Methods

Méthode Description
__construct ( PHPUnit_Framework_TestCase $testCase, $namespace )

Method Details

getMock() public méthode

public getMock ( )

mockFunction() public méthode

public mockFunction ( $function )

start() public static méthode

Example: PHP global namespace function setcookie() needs to be overridden in order to test if a cookie gets set. When setcookie() is called from inside a class in the namespace \Foo\Bar the mock setcookie() created here will be used instead to the real function.
public static start ( PHPUnit_Framework_TestCase $testCase, string $namespace ) : PHPUnit_Extension_FunctionMocker
$testCase PHPUnit_Framework_TestCase
$namespace string
Résultat PHPUnit_Extension_FunctionMocker

tearDown() public static méthode

public static tearDown ( )