PHP Class PHPUnit_Extension_FunctionMocker

Mostrar archivo Open project: lstrojny/phpunit-function-mocker Class Usage Examples

Public Methods

Method 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

Method Description
__construct ( PHPUnit_Framework_TestCase $testCase, $namespace )

Method Details

getMock() public method

public getMock ( )

mockFunction() public method

public mockFunction ( $function )

start() public static method

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
return PHPUnit_Extension_FunctionMocker

tearDown() public static method

public static tearDown ( )