PHP Class Kraken\Test\TUnit

Inheritance: extends PHPUnit_Framework_TestCase
Show file Open project: kraken-php/framework Class Usage Examples

Public Methods

Method Description
basePath ( ) : string Return project root.
callProtectedMethod ( object | string $objectOrClass, string $method, mixed[] $args = [] ) : mixed Call protected method on a given object via reflection.
createCallableMock ( ) : callable | PHPUnit_Framework_MockObject_MockObject Creates a callable mock.
createLoopMock ( ) : Kraken\Loop\LoopInterface | PHPUnit_Framework_MockObject_MockObject
createReadableLoopMock ( ) : Kraken\Loop\LoopInterface | PHPUnit_Framework_MockObject_MockObject
createWritableLoopMock ( ) : Kraken\Loop\LoopInterface | PHPUnit_Framework_MockObject_MockObject
existsProtectedProperty ( object $object, string $property ) : boolean Check if protected property exists.
expectCallableExactly ( $amount ) : callable | PHPUnit_Framework_MockObject_MockObject Creates a callback that must be called $amount times or the test will fail.
expectCallableNever ( ) : callable | PHPUnit_Framework_MockObject_MockObject Creates a callable that must not be called once.
expectCallableOnce ( ) : callable | PHPUnit_Framework_MockObject_MockObject Creates a callback that must be called once.
expectCallableTwice ( ) : callable | PHPUnit_Framework_MockObject_MockObject Creates a callback that must be called twice.
getProtectedProperty ( object $object, string $property ) : mixed Get protected property from given object via reflection.
getTest ( ) : TUnit
setProtectedProperty ( object $object, string $property, mixed $value ) : object Set protected property on a given object via reflection.
twice ( ) : PHPUnit_Framework_MockObject_Matcher_InvokedCount

Method Details

basePath() public method

Return project root.
public basePath ( ) : string
return string

callProtectedMethod() public method

Call protected method on a given object via reflection.
public callProtectedMethod ( object | string $objectOrClass, string $method, mixed[] $args = [] ) : mixed
$objectOrClass object | string
$method string
$args mixed[]
return mixed

createCallableMock() public method

Creates a callable mock.
public createCallableMock ( ) : callable | PHPUnit_Framework_MockObject_MockObject
return callable | PHPUnit_Framework_MockObject_MockObject

createLoopMock() public method

public createLoopMock ( ) : Kraken\Loop\LoopInterface | PHPUnit_Framework_MockObject_MockObject
return Kraken\Loop\LoopInterface | PHPUnit_Framework_MockObject_MockObject

createReadableLoopMock() public method

public createReadableLoopMock ( ) : Kraken\Loop\LoopInterface | PHPUnit_Framework_MockObject_MockObject
return Kraken\Loop\LoopInterface | PHPUnit_Framework_MockObject_MockObject

createWritableLoopMock() public method

public createWritableLoopMock ( ) : Kraken\Loop\LoopInterface | PHPUnit_Framework_MockObject_MockObject
return Kraken\Loop\LoopInterface | PHPUnit_Framework_MockObject_MockObject

existsProtectedProperty() public method

Check if protected property exists.
public existsProtectedProperty ( object $object, string $property ) : boolean
$object object
$property string
return boolean

expectCallableExactly() public method

Creates a callback that must be called $amount times or the test will fail.
public expectCallableExactly ( $amount ) : callable | PHPUnit_Framework_MockObject_MockObject
$amount
return callable | PHPUnit_Framework_MockObject_MockObject

expectCallableNever() public method

Creates a callable that must not be called once.
public expectCallableNever ( ) : callable | PHPUnit_Framework_MockObject_MockObject
return callable | PHPUnit_Framework_MockObject_MockObject

expectCallableOnce() public method

Creates a callback that must be called once.
public expectCallableOnce ( ) : callable | PHPUnit_Framework_MockObject_MockObject
return callable | PHPUnit_Framework_MockObject_MockObject

expectCallableTwice() public method

Creates a callback that must be called twice.
public expectCallableTwice ( ) : callable | PHPUnit_Framework_MockObject_MockObject
return callable | PHPUnit_Framework_MockObject_MockObject

getProtectedProperty() public method

Get protected property from given object via reflection.
public getProtectedProperty ( object $object, string $property ) : mixed
$object object
$property string
return mixed

getTest() public method

public getTest ( ) : TUnit
return TUnit

setProtectedProperty() public method

Set protected property on a given object via reflection.
public setProtectedProperty ( object $object, string $property, mixed $value ) : object
$object object
$property string
$value mixed
return object

twice() public method

public twice ( ) : PHPUnit_Framework_MockObject_Matcher_InvokedCount
return PHPUnit_Framework_MockObject_Matcher_InvokedCount