Overview

Namespaces

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

Classes

  • Assertion
  • Leo

Traits

  • DynamicObjectTrait
  • Overview
  • Namespace
  • Class
  • Tree

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
Final
Namespace: Peridot\Leo
Package: Peridot\Leo
Located at Assertion.php
Methods summary
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

Peridot\Leo\Responder\ResponderInterface
public mixed
# __call( mixed $method, mixed $args )

Delegate methods to assertion methods

Delegate methods to assertion methods

Parameters

$method
$args

Returns

mixed
public mixed
# __get( mixed $name )

Parameters

$name

Returns

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
# setActual( mixed $actual )

Set the actual value used for matching expectations against.

Set the actual value used for matching expectations against.

Parameters

$actual

Returns

mixed
$this
public mixed
# getActual( )

Return the actual value being asserted against.

Return the actual value being asserted against.

Returns

mixed
public mixed
# assert( Peridot\Leo\Matcher\MatcherInterface $matcher )

Assert against the given matcher.

Assert against the given matcher.

Parameters

$matcher

Returns

mixed
$this
Methods used from Peridot\Leo\DynamicObjectTrait
addMethod(), addProperty(), clearFlags(), flag()
Magic methods summary
public Peridot\Leo\Assertion
# equal( string $message = "" )

Asserts that actual and expected values are strictly equal

Asserts that actual and expected values are strictly equal

Parameters

$message

Returns

Peridot\Leo\Assertion
public Peridot\Leo\Assertion
# with( )

Stores an array of values to be used with callable assertions

Stores an array of values to be used with callable assertions

Returns

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

Peridot\Leo\Assertion
public Peridot\Leo\Assertion
# a( string $message = "" )

Asserts that the actual value given has the same type as the expected type string

Asserts that the actual value given has the same type as the expected type string

Parameters

$message

Returns

Peridot\Leo\Assertion
public Peridot\Leo\Assertion
# an( string $message = "" )

Asserts that the actual value given has the same type as the expected type string

Asserts that the actual value given has the same type as the expected type string

Parameters

$message

Returns

Peridot\Leo\Assertion
public Peridot\Leo\Assertion
# include( string $message = "" )

Asserts that the actual string or array includes the expected value

Asserts that the actual string or array includes the expected value

Parameters

$message

Returns

Peridot\Leo\Assertion
public Peridot\Leo\Assertion
# contain( string $message = "" )

Asserts that the actual string or array includes the expected value

Asserts that the actual string or array includes the expected value

Parameters

$message

Returns

Peridot\Leo\Assertion
public Peridot\Leo\Assertion
# ok( )

Returns

Peridot\Leo\Assertion
public Peridot\Leo\Assertion
# true( )

Asserts that the actual value is strictly equal to true

Asserts that the actual value is strictly equal to true

Returns

Peridot\Leo\Assertion
public Peridot\Leo\Assertion
# false( )

Asserts that the actual value is strictly equal to false

Asserts that the actual value is strictly equal to false

Returns

Peridot\Leo\Assertion
public Peridot\Leo\Assertion
# null( )

Asserts that the actual value is null

Asserts that the actual value is null

Returns

Peridot\Leo\Assertion
public Peridot\Leo\Assertion
# empty( )

Asserts that the actual value is empty

Asserts that the actual value is empty

Returns

Peridot\Leo\Assertion
public Peridot\Leo\Assertion
# above( string $message = "" )

Asserts that the actual value is greater than the expected value

Asserts that the actual value is greater than the expected value

Parameters

$message

Returns

Peridot\Leo\Assertion
public Peridot\Leo\Assertion
# least( string $message = "" )

Asserts that the actual value is greater than or equal to the expected value

Asserts that the actual value is greater than or equal to the expected value

Parameters

$message

Returns

Peridot\Leo\Assertion
public Peridot\Leo\Assertion
# below( string $message = "" )

Asserts that the actual value is less than the expected value

Asserts that the actual value is less than the expected value

Parameters

$message

Returns

Peridot\Leo\Assertion
public Peridot\Leo\Assertion
# most( string $message = "" )

Asserts that the actual value is less than or equal to the expected value

Asserts that the actual value is less than or equal to the expected value

Parameters

$message

Returns

Peridot\Leo\Assertion
public Peridot\Leo\Assertion
# within( integer $upperBound, string $message = "") Asserts that the actual value is between the upper and lower bounds (inclusive )

Parameters

$upperBound
$message
$message

Returns

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

Peridot\Leo\Assertion
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

Peridot\Leo\Assertion
public Peridot\Leo\Assertion
# length( string $message = "" )

Asserts the actual array, string, or Countable has the expected length

Asserts the actual array, string, or Countable has the expected length

Parameters

$message

Returns

Peridot\Leo\Assertion
public Peridot\Leo\Assertion
# match( string $message = "" )

Asserts that the actual value matches the expected regular expression

Asserts that the actual value matches the expected regular expression

Parameters

$message

Returns

Peridot\Leo\Assertion
public Peridot\Leo\Assertion
# string( string $message = "" )

Asserts that the actual string contains the expected substring

Asserts that the actual string contains the expected substring

Parameters

$message

Returns

Peridot\Leo\Assertion
public Peridot\Leo\Assertion
# keys( string $message = "" )

Asserts the actual object or array has keys equivalent to the expected keys

Asserts the actual object or array has keys equivalent to the expected keys

Parameters

$message

Returns

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

Peridot\Leo\Assertion
Properties summary
protected Peridot\Leo\Responder\ResponderInterface $responder
#
protected mixed $actual
#
Properties used from Peridot\Leo\DynamicObjectTrait
$flags, $methods, $properties
Magic properties summary
public Peridot\Leo\Assertion $to

a language chain

public Peridot\Leo\Assertion $be

a language chain

public Peridot\Leo\Assertion $been

a language chain

public Peridot\Leo\Assertion $is

a language chain

public Peridot\Leo\Assertion $and

a language chain

public Peridot\Leo\Assertion $has

a language chain

public Peridot\Leo\Assertion $have

a language chain

public Peridot\Leo\Assertion $with

a language chain

public Peridot\Leo\Assertion $that

a language chain

public Peridot\Leo\Assertion $at

a language chain

public Peridot\Leo\Assertion $of

a language chain

public Peridot\Leo\Assertion $same

a language chain

public Peridot\Leo\Assertion $an

a language chain

public Peridot\Leo\Assertion $a

a language chain

public Peridot\Leo\Assertion $not

flags the Assertion as negated

public Peridot\Leo\Assertion $loosely

enables loose equality assertion using the ->equal() assertion

public Peridot\Leo\Assertion $contain

enables the contain flag for use with the ->keys() assertion

public Peridot\Leo\Assertion $include

enables the contain flag for use with the ->keys() assertion

public Peridot\Leo\Assertion $ok

a lazy property that performs an ->ok() assertion

public Peridot\Leo\Assertion $true

a lazy property that performs a ->true() assertion

public Peridot\Leo\Assertion $false

a lazy property that performs a ->false() assertion

public Peridot\Leo\Assertion $null

a lazy property that performs a ->null() assertion

public Peridot\Leo\Assertion $empty

a lazy property that performs an ->empty() 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

Leo API documentation generated by ApiGen