Class ExceptionMatcher
ExceptionMatcher executes a callable and determines if an exception of a given type was thrown. It optionally matches the exception message.
- Peridot\Leo\Matcher\AbstractMatcher implements Peridot\Leo\Matcher\MatcherInterface
- Extended by Peridot\Leo\Matcher\ExceptionMatcher
public
__construct( callable $exceptionType )
public
mixed
setArguments( array $arguments )
Set arguments to be passed to the callable.
Set arguments to be passed to the callable.
Parameters
- $arguments
Returns
mixed
$this
public
mixed
setExpectedMessage( string $message )
Set the expected message of the exception.
Set the expected message of the exception.
Parameters
- $message
Returns
mixed
$this
public
setMessage( string $message )
Set the message thrown from an exception resulting from the callable being invoked.
Set the message thrown from an exception resulting from the callable being invoked.
Parameters
- $message
public
array
getArguments( )
Returns the arguments passed to the callable.
Returns the arguments passed to the callable.
Returns
array
public
string
getExpectedMessage( )
Return the expected exception message.
Return the expected exception message.
Returns
string
public
string
getMessage( )
Return the message thrown by an exception resulting from the callable being invoked.
Return the message thrown by an exception resulting from the callable being invoked.
Returns
string
public
Peridot\Leo\Matcher\Template\TemplateInterface
getTemplate( )
Return the TemplateInterface being used by the matcher.
Return the TemplateInterface being used by the matcher.
If the expected message has been set, the message template will be used.
Returns
Overrides
public
mixed
setMessageTemplate( Peridot\Leo\Matcher\Template\TemplateInterface
$template )
Set the template to be used when an expected exception message is provided.
Set the template to be used when an expected exception message is provided.
Parameters
- $template
Returns
mixed
$this
public
getMessageTemplate( )
Return a template for rendering exception message templates.
Return a template for rendering exception message templates.
return TemplateInterface
public
Peridot\Leo\Matcher\Template\TemplateInterface
getDefaultTemplate( )
Return a default TemplateInterface if none was set.
Return a default TemplateInterface if none was set.
Returns
public
Peridot\Leo\Matcher\Template\ArrayTemplate
getDefaultMessageTemplate( )
Return a default template for exception message assertions.
Return a default template for exception message assertions.
Returns
public
Peridot\Leo\Matcher\Match
protected
boolean
protected