Class ParametersExpectation

Description

Parameter comparison assertion.

Located in /mock_objects.php (line 30)

SimpleExpectation
   |
   --ParametersExpectation
Method Summary
 ParametersExpectation __construct ([ $expected = false], [string $message = '%s'], array $parameters)
 string describeDifference (array $expected, array $parameters)
 string renderArguments (array $args)
 boolean test (array $parameters)
 string testMessage ( $parameters, array $comparison)
 boolean testParameter (mixed $parameter, mixed $expected)
Variables

Inherited Variables

Inherited from SimpleExpectation

SimpleExpectation::$dumper
Methods
Constructor __construct (line 41)

Sets the expected parameter list.

ParametersExpectation __construct ([ $expected = false], [string $message = '%s'], array $parameters)
  • array $parameters: Array of parameters including those that are wildcarded. If the value is not an array then it is considered to match any.
  • string $message: Customised message on failure.
  • $expected

Redefinition of:
SimpleExpectation::__construct()
Creates a dumper for displaying values and sets the test message.
coerceToExpectation (line 126)

Creates an identical expectation if the object/value is not already some type of expectation.

  • return: Expectation object.
  • access: protected
SimpleExpectation coerceToExpectation (mixed $expected)
  • mixed $expected: Expected value.
describeDifference (line 101)

Message to display if expectation differs from the parameters actually received.

  • return: Description of difference.
  • access: protected
string describeDifference (array $expected, array $parameters)
  • array $expected: Expected parameters as list.
  • array $parameters: Actual parameters received.
renderArguments (line 139)

Renders the argument list as a string for messages.

  • return: Simple description of type and value.
  • access: protected
string renderArguments (array $args)
  • array $args: Incoming arguments.
test (line 51)

Tests the assertion. True if correct.

  • return: True if correct.
boolean test (array $parameters)
  • array $parameters: Comparison values.

Redefinition of:
SimpleExpectation::test()
Tests the expectation. True if correct.
testMessage (line 84)

Returns a human readable test message.

  • return: Description of success or failure.
string testMessage ( $parameters, array $comparison)
  • array $comparison: Incoming parameter list.
  • $parameters

Redefinition of:
SimpleExpectation::testMessage()
Returns a human readable test message.
testParameter (line 73)

Tests an individual parameter.

  • return: True if expectation fulfilled.
  • access: protected
boolean testParameter (mixed $parameter, mixed $expected)
  • mixed $parameter: Value to test.
  • mixed $expected: Comparison value.

Inherited Methods

Inherited From SimpleExpectation

 SimpleExpectation::__construct()
 SimpleExpectation::getDumper()
 SimpleExpectation::isExpectation()
 SimpleExpectation::overlayMessage()
 SimpleExpectation::test()
 SimpleExpectation::testMessage()

Documentation generated on Sun, 31 Oct 2010 16:31:49 -0500 by phpDocumentor 1.4.3