PHPUnit2
[ class tree: PHPUnit2 ] [ index: PHPUnit2 ] [ all elements ]

Class: PHPUnit2_Framework_Constraint

Source Location: /PHPUnit2-3.0.0alpha11/Framework/Constraint.php

Class Overview

PHPUnit2_Framework_SelfDescribing
   |
   --PHPUnit2_Framework_Constraint

Interface for constraints which are placed upon any value.


Author(s):

  • Jan Borsodi <jb at ez.no> Sebastian Bergmann <sb at sebastian-bergmann.de>

Version:

  • Release: @package_version@

Copyright:

  • 2002-2006 Sebastian Bergmann <sb@sebastian-bergmann.de>

Methods


Inherited Variables

Inherited Methods

Class: PHPUnit2_Framework_SelfDescribing

PHPUnit2_Framework_SelfDescribing::toString()
Returns a string representation of the object.

Class Details

[line 78]
Interface for constraints which are placed upon any value.

The constraint can be used in method name matching and parameter value matching to perform more advanced checking than simply matching two values with ==.

A constraint must provides the following methods:

  • evaluate() check if a given object meets the constraint. If it does not, fail() can be called to create an exception.
  • toStrint() returns a description of the constraint.

  • Author: Jan Borsodi <jb@ez.no> Sebastian Bergmann <sb@sebastian-bergmann.de>
  • Version: Release: @package_version@
  • Copyright: 2002-2006 Sebastian Bergmann <sb@sebastian-bergmann.de>
  • Link: http://pear.php.net/package/PHPUnit2
  • Since: Interface available since Release 3.0.0
  • License: BSD License


[ Top ]


Method Detail

evaluate   [line 87]

bool evaluate( mixed $other)

Evaluates the constraint for parameter $other. Returns TRUE if the constraint is met, FALSE otherwise.
  • Access: public

Parameters:

mixed   $other   —  Value or object to evaluate.

[ Top ]

fail   [line 99]

void fail( mixed $other, string $description)

Creates the appropriate exception for the constraint which can be caught by the unit test system. This can be called if a call to evaluate() fails.
  • Throws: PHPUnit2_Framework_ExpectationFailedException
  • Access: public

Parameters:

mixed   $other   —  The value passed to evaluate() which failed the constraint check.
string   $description   —  A string with extra description of what was going on while the evaluation failed.

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:40:38 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.