Class Assertion
Assertion is responsible for asserting it's actual value against a MatcherInterface and responding to the results of a match.
- Peridot\Leo\Assertion uses Peridot\Leo\DynamicObjectTrait
public
__construct( Peridot\Leo\Responder\ResponderInterface
$responder, mixed $actual = null )
Parameters
- $responder
- $actual
public
Peridot\Leo\Responder\ResponderInterface
getResponder( )
Returns the current ResponderInterface assigned to this Assertion.
Returns the current ResponderInterface assigned to this Assertion.
Returns
public
mixed
public
mixed
request( callable $fn, array $arguments = [] )
A request to an Assertion will attempt to resolve the result as an assertion before returning the result.
A request to an Assertion will attempt to resolve the result as an assertion before returning the result.
Parameters
- $fn
- $arguments
Returns
mixed
public
extend( callable $fn )
Extend calls the given callable - or file that returns a callable - and passes the current Assertion instance to it. Assertion can be extended via the ->addMethod(), ->flag(), and ->addProperty() methods.
Extend calls the given callable - or file that returns a callable - and passes the current Assertion instance to it. Assertion can be extended via the ->addMethod(), ->flag(), and ->addProperty() methods.
Parameters
- $fn
public
mixed
public
mixed
public
mixed
assert( Peridot\Leo\Matcher\MatcherInterface
$matcher )
Assert against the given matcher.
Assert against the given matcher.
Parameters
- $matcher
Returns
mixed
$this
public
Peridot\Leo\Assertion
public
Peridot\Leo\Assertion
public
Peridot\Leo\Assertion
throw( string $exceptionMessage = "", mixed $message = "" )
Invokes the actual value as a function and matches the exception type was thrown, and optionally matches the exception message
Invokes the actual value as a function and matches the exception type was thrown, and optionally matches the exception message
Parameters
- $exceptionMessage
- $message
- $message
Returns
public
Peridot\Leo\Assertion
public
Peridot\Leo\Assertion
public
Peridot\Leo\Assertion
public
Peridot\Leo\Assertion
public
Peridot\Leo\Assertion
public
Peridot\Leo\Assertion
public
Peridot\Leo\Assertion
public
Peridot\Leo\Assertion
public
Peridot\Leo\Assertion
public
Peridot\Leo\Assertion
public
Peridot\Leo\Assertion
public
Peridot\Leo\Assertion
public
Peridot\Leo\Assertion
public
Peridot\Leo\Assertion
public
Peridot\Leo\Assertion
instanceof( string $message = "" )
Asserts that the actual value is an instance of the expected class string
Asserts that the actual value is an instance of the expected class string
Parameters
- $message
Returns
public
Peridot\Leo\Assertion
property( mixed $value = "", string $message = "" )
Asserts that the actual array or object has the expected property and optionally asserts the property value against an expected value
Asserts that the actual array or object has the expected property and optionally asserts the property value against an expected value
Parameters
- $value
- $message
- $message
Returns
public
Peridot\Leo\Assertion
public
Peridot\Leo\Assertion
public
Peridot\Leo\Assertion
public
Peridot\Leo\Assertion
public
Peridot\Leo\Assertion
satisfy( string $message = "" )
Asserts that the actual value satisfies the expected predicate. The expected predicate will be passed the actual value and should return true or false
Asserts that the actual value satisfies the expected predicate. The expected predicate will be passed the actual value and should return true or false
Parameters
- $message
Returns
public
Peridot\Leo\Assertion
$loosely
enables loose equality assertion using the ->equal() assertion
public
Peridot\Leo\Assertion
$length
enables the length flag for use with countable assertions such as ->above(), ->least(), ->below(), ->most(), and ->within()
public
Peridot\Leo\Assertion
$deep
enables the deep flag for use with assertions that need to traverse structures like the ->property() assertion