PHP Class phpmock\AbstractMockTest

See also: Mock
Author: Markus Malkusch ([email protected])
Inheritance: extends PHPUnit_Framework_TestCase
Show file Open project: php-mock/php-mock Class Usage Examples

Public Methods

Method Description
provideTestBackupStaticAttributes ( ) : array Just repeat testBackupStaticAttributes a few times.
testBackupStaticAttributes ( ) Tests declaring repeatedly a mock with enabled backupStaticAttributes.
testCVariadic ( ) Tests some methods which use the varname ".
testCVariadicReset ( ) Tests some methods which use the varname ".
testDisable ( ) Tests disable().
testDisableSetup ( ) Setup a mock for testDisable().
testExplicitDefine ( ) Tests explicit function defining.
testFailEnable ( ) Tests failing enabling an already enabled mock.
testImplicitDefine ( ) Tests mocking the function implicitely defines the function.
testMockFunctionWithParameters ( ) Tests mocking a function without parameters.
testMockFunctionWithoutParameters ( ) Tests mocking a function without parameters.
testPassingByReference ( ) Test passing by reference.
testPassingByValue ( ) Tests passing by value.
testPreserveArgumentDefaultValue ( ) Tests that the mock preserves the default argument
testRedefine ( ) Tests mocking a previously mocked function again.
testResetToDefaultArgumentOfOriginalFunction ( ) Tests that the disabled mock uses the default argument of the original function.
testRunInSeparateProcess ( ) Tests the mock in a separate process.
testUndefinedFunction ( ) Tests mocking of an undefined function.

Protected Methods

Method Description
defineFunction ( string $namespace, string $functionName ) Defines the function mock.
disableMocks ( ) Disable all mocks.
mockFunction ( string $namespace, string $functionName, callable $function ) Builds an enabled function mock.
tearDown ( )

Private Methods

Method Description
buildPrivateFunctionName ( string $name ) : string Builds a function name which is has a postfix for the current class.
escapeshellcmd ( string $command ) : string Returns the built-in call to escapeshellcmd().

Method Details

defineFunction() abstract protected method

Defines the function mock.
abstract protected defineFunction ( string $namespace, string $functionName )
$namespace string The namespace.
$functionName string The function name.

disableMocks() abstract protected method

Disable all mocks.
abstract protected disableMocks ( )

mockFunction() abstract protected method

Builds an enabled function mock.
abstract protected mockFunction ( string $namespace, string $functionName, callable $function )
$namespace string The namespace.
$functionName string The function name.
$function callable The function mock.

provideTestBackupStaticAttributes() public method

Just repeat testBackupStaticAttributes a few times.
public provideTestBackupStaticAttributes ( ) : array
return array Test cases.

tearDown() protected method

protected tearDown ( )

testBackupStaticAttributes() public method

Tests declaring repeatedly a mock with enabled backupStaticAttributes.

testCVariadic() public method

..".
public testCVariadic ( )

testCVariadicReset() public method

.." after a mock was defined.
public testCVariadicReset ( )

testDisable() public method

Tests disable().
public testDisable ( )

testDisableSetup() public method

Setup a mock for testDisable().
public testDisableSetup ( )

testExplicitDefine() public method

Tests explicit function defining.
public testExplicitDefine ( )

testFailEnable() public method

Tests failing enabling an already enabled mock.
public testFailEnable ( )

testImplicitDefine() public method

Tests mocking the function implicitely defines the function.
public testImplicitDefine ( )

testMockFunctionWithParameters() public method

Tests mocking a function without parameters.

testMockFunctionWithoutParameters() public method

Tests mocking a function without parameters.

testPassingByReference() public method

Test passing by reference.

testPassingByValue() public method

Tests passing by value.
public testPassingByValue ( )

testPreserveArgumentDefaultValue() public method

Tests that the mock preserves the default argument

testRedefine() public method

Tests mocking a previously mocked function again.
public testRedefine ( )

testResetToDefaultArgumentOfOriginalFunction() public method

Tests that the disabled mock uses the default argument of the original function.

testRunInSeparateProcess() public method

Tests the mock in a separate process.

testUndefinedFunction() public method

Tests mocking of an undefined function.