HumHub Documentation (unofficial)

ResultMockFactory
in package

An easy way to create Result objects for your tests.

Tags
author

Tobias Nyholm tobias.nyholm@gmail.com

Table of Contents

Methods

create()  : T
Instantiate a Result class with some data.
createFailing()  : T
Instantiate a Result class that throws exception.
waiter()  : T
Instantiate a Waiter class with a final state.
addPropertiesOnResult()  : void
Set input and aws client to handle pagination.
addUndefinedProperties()  : void
Try to add some values to the properties not defined in $data.
getResponseObject()  : Response

Methods

create()

Instantiate a Result class with some data.

public static create(T> $class[, array<string, mixed> $data = [] ]) : T
ResultMockFactory::create(SendEmailResponse::class, ['MessageId'=>'foo123']);
Parameters
$class : T>
$data : array<string, mixed> = []
Tags
template

T of Result

Return values
T

createFailing()

Instantiate a Result class that throws exception.

public static createFailing(T> $class, int $code[, string|null $message = null ][, array<string, mixed> $additionalContent = [] ]) : T
ResultMockFactory::createFailing(SendEmailResponse::class, 400, 'invalid value');
Parameters
$class : T>
$code : int
$message : string|null = null
$additionalContent : array<string, mixed> = []
Tags
template

T of Result

Return values
T

waiter()

Instantiate a Waiter class with a final state.

public static waiter(string $class, string $finalState) : T
Parameters
$class : string
$finalState : string
Tags
template

T of Waiter

psalm-param

class-string<T> $class

Return values
T

addPropertiesOnResult()

Set input and aws client to handle pagination.

private static addPropertiesOnResult(ReflectionClass<string|int, object> $reflectionClass, object $object, string $class) : void
Parameters
$reflectionClass : ReflectionClass<string|int, object>
$object : object
$class : string

addUndefinedProperties()

Try to add some values to the properties not defined in $data.

private static addUndefinedProperties(ReflectionClass<string|int, object> $reflectionClass, object $object, array<string, mixed> $data) : void
Parameters
$reflectionClass : ReflectionClass<string|int, object>
$object : object
$data : array<string, mixed>
Tags
throws
ReflectionException

        
On this page

Search results