Documentation

InvocationMocker
in package
implements InvocationStubber, MethodNameMatch

FinalYes
Tags
no-named-arguments

Parameter names are not covered by the backward compatibility promise for PHPUnit

Table of Contents

Interfaces

InvocationStubber
MethodNameMatch

Properties

$configurableMethodNames  : array<string, int>|null
$configurableMethods  : array<int, ConfigurableMethod>
$invocationHandler  : InvocationHandler
$matcher  : Matcher

Methods

__construct()  : mixed
after()  : $this
id()  : $this
method()  : $this
will()  : $this
willReturn()  : $this
willReturnArgument()  : $this
willReturnCallback()  : $this
willReturnMap()  : $this
willReturnOnConsecutiveCalls()  : $this
willReturnReference()  : $this
willReturnSelf()  : $this
willThrowException()  : $this
with()  : $this
withAnyParameters()  : $this
configuredMethod()  : ConfigurableMethod|null
ensureParametersCanBeConfigured()  : void
ensureTypeOfReturnValues()  : void

Properties

$configurableMethodNames

private array<string, int>|null $configurableMethodNames = null

$configurableMethods read-only

private array<int, ConfigurableMethod> $configurableMethods

$invocationHandler read-only

private InvocationHandler $invocationHandler

Methods

__construct()

public __construct(InvocationHandler $handler, Matcher $matcher, ConfigurableMethod ...$configurableMethods) : mixed
Parameters
$handler : InvocationHandler
$matcher : Matcher
$configurableMethods : ConfigurableMethod

after()

public after(string $id) : $this
Parameters
$id : string
Return values
$this

id()

public id(string $id) : $this
Parameters
$id : string
Tags
throws
MatcherAlreadyRegisteredException
Return values
$this

will()

public will(Stub $stub) : $this
Parameters
$stub : Stub
Return values
$this

willReturn()

public willReturn(mixed $value, mixed ...$nextValues) : $this
Parameters
$value : mixed
$nextValues : mixed
Tags
throws
IncompatibleReturnValueException
Return values
$this

willReturnArgument()

public willReturnArgument(int $argumentIndex) : $this
Parameters
$argumentIndex : int
Return values
$this

willReturnCallback()

public willReturnCallback(callable $callback) : $this
Parameters
$callback : callable
Return values
$this

willReturnMap()

public willReturnMap(array<string|int, mixed> $valueMap) : $this
Parameters
$valueMap : array<string|int, mixed>
Return values
$this

willReturnOnConsecutiveCalls()

public willReturnOnConsecutiveCalls(mixed ...$values) : $this
Parameters
$values : mixed
Return values
$this

willReturnReference()

public willReturnReference(mixed &$reference) : $this
Parameters
$reference : mixed
Return values
$this

willThrowException()

public willThrowException(Throwable $exception) : $this
Parameters
$exception : Throwable
Return values
$this

with()

public with(mixed ...$arguments) : $this
Parameters
$arguments : mixed
Tags
throws
Exception
MethodNameNotConfiguredException
MethodParametersAlreadyConfiguredException
Return values
$this

withAnyParameters()

public withAnyParameters() : $this
Tags
throws
MethodNameNotConfiguredException
MethodParametersAlreadyConfiguredException
Return values
$this

configuredMethod()

private configuredMethod() : ConfigurableMethod|null
Return values
ConfigurableMethod|null

ensureParametersCanBeConfigured()

private ensureParametersCanBeConfigured() : void
Tags
throws
MethodNameNotConfiguredException
MethodParametersAlreadyConfiguredException

ensureTypeOfReturnValues()

private ensureTypeOfReturnValues(array<string|int, mixed> $values) : void
Parameters
$values : array<string|int, mixed>
Tags
throws
IncompatibleReturnValueException
On this page

Search results