Overview

Namespaces

  • None
  • Peridot
    • Leo
      • Formatter
      • Interfaces
        • Assert
      • Matcher
        • Template
      • ObjectPath
      • Responder
  • PHP

Classes

  • AbstractMatcher
  • CountableMatcher
  • EmptyMatcher
  • EqualMatcher
  • ExceptionMatcher
  • GreaterThanMatcher
  • GreaterThanOrEqualMatcher
  • InclusionMatcher
  • InstanceofMatcher
  • KeysMatcher
  • LengthMatcher
  • LessThanMatcher
  • LessThanOrEqualMatcher
  • Match
  • NullMatcher
  • PatternMatcher
  • PredicateMatcher
  • PropertyMatcher
  • RangeMatcher
  • SameMatcher
  • SubStringMatcher
  • TrueMatcher
  • TruthyMatcher
  • TypeMatcher

Interfaces

  • MatcherInterface
  • Overview
  • Namespace
  • Class
  • Tree

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
Namespace: Peridot\Leo\Matcher
Package: Peridot\Leo\Matcher
Located at Matcher/ExceptionMatcher.php
Methods summary
public
# __construct( callable $exceptionType )

Parameters

$exceptionType
$expected

Overrides

Peridot\Leo\Matcher\AbstractMatcher::__construct()
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

Peridot\Leo\Matcher\Template\TemplateInterface

Overrides

Peridot\Leo\Matcher\AbstractMatcher::getTemplate()
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

Peridot\Leo\Matcher\Template\TemplateInterface
public Peridot\Leo\Matcher\Template\ArrayTemplate
# getDefaultMessageTemplate( )

Return a default template for exception message assertions.

Return a default template for exception message assertions.

Returns

Peridot\Leo\Matcher\Template\ArrayTemplate
public Peridot\Leo\Matcher\Match
# match( mixed $actual )

Override match to set actual and expect match values to message values.

Override match to set actual and expect match values to message values.

Parameters

$actual

Returns

Peridot\Leo\Matcher\Match

Overrides

Peridot\Leo\Matcher\AbstractMatcher::match()
protected boolean
# doMatch( mixed $actual )

Executes the callable and matches the exception type and exception message.

Executes the callable and matches the exception type and exception message.

Parameters

$actual

Returns

boolean
protected
# validateCallable( mixed $callable )

Validate that expected is indeed a valid callable.

Validate that expected is indeed a valid callable.

Throws

BadFunctionCallException
Methods inherited from Peridot\Leo\Matcher\AbstractMatcher
invert(), isNegated(), setAssertion(), setTemplate()
Properties summary
protected array $arguments
# []
protected string $expectedMessage
# ""
protected string $message

A captured exception message

A captured exception message

#
protected Peridot\Leo\Matcher\Template\TemplateInterface $messageTemplate
#
Properties inherited from Peridot\Leo\Matcher\AbstractMatcher
$assertion, $expected, $negated, $template
Leo API documentation generated by ApiGen