Overview

Namespaces

  • expect
    • config
    • configurator
    • context
    • factory
    • matcher
      • strategy
    • package
    • registry
    • reporter

Classes

  • PatternMatcher
  • ToBe
  • ToBeA
  • ToBeAbove
  • ToBeAn
  • ToBeAnInstanceOf
  • ToBeArray
  • ToBeBelow
  • ToBeBoolean
  • ToBeEmpty
  • ToBeFalse
  • ToBeFalsey
  • ToBeFloat
  • ToBeGreaterThan
  • ToBeInteger
  • ToBeLessThan
  • ToBeNull
  • ToBeString
  • ToBeTrue
  • ToBeTruthy
  • ToBeWithin
  • ToContain
  • ToEndWith
  • ToEqual
  • ToHaveKey
  • ToHaveLength
  • ToMatch
  • ToPrint
  • ToStartWith
  • ToThrow
  • TruthyMatcher

Interfaces

  • ReportableMatcher

Traits

  • EqualMatcherDelegatable
  • GreaterThanMatcherDelegatable
  • LengthMatcherDelegatable
  • LessThanMatcherDelegatable
  • TypeMatcherDelegatable
  • Overview
  • Namespace
  • Class

Class ToHaveKey

Verify key exists.

$matcher = new ToHaveKey('foo'); $matcher->match([ 'foo' => 1 ]); //return true

$matcher->match([ 'bar' => 1 ]); //return false

expect\matcher\ToHaveKey implements expect\matcher\ReportableMatcher
Final
Namespace: expect\matcher
Copyright: Noritaka Horio holy.shared.design@gmail.com
Author: Noritaka Horio holy.shared.design@gmail.com
Located at matcher/ToHaveKey.php
Methods summary
public
# __construct( string|integer $expected )

Parameters

$expected
public boolean
# match( mixed $actual )

Verify whether the value is consistent with what is expected. Returns true if the value matches the contents to be expected.

Verify whether the value is consistent with what is expected. Returns true if the value matches the contents to be expected.

Parameters

$actual
value of actual

Returns

boolean
results of evaluation

Implementation of

expect\Matcher::match()
public
# reportFailed( expect\FailedMessage $message )

Report the reason for the failure of positive evaluation.

Report the reason for the failure of positive evaluation.

Parameters

$message
message

Implementation of

expect\matcher\ReportableMatcher::reportFailed()
public
# reportNegativeFailed( expect\FailedMessage $message )

Report the reason for the failure of negative evaluation.

Report the reason for the failure of negative evaluation.

Parameters

$message
message

Implementation of

expect\matcher\ReportableMatcher::reportNegativeFailed()
Expect API documentation generated by ApiGen