Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 39 and 401]

Constraint that checks a simple object with an isEqual constrain, allowing for exceptions to be made for some fields.

Copyright: 2015 Andrew Nicols <andrew@nicols.co.uk>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 110 lines (4 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

phpunit_constraint_object_is_equal_with_exceptions:: (4 methods):
  __construct()
  add_exception()
  evaluate()
  toString()


Class: phpunit_constraint_object_is_equal_with_exceptions  - X-Ref

Constraint that checks a simple object with an isEqual constrain, allowing for exceptions to be made for some fields.

__construct($value, float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false,bool $ignoreCase = false)   X-Ref
Override constructor to capture value


add_exception($key, $comparator)   X-Ref
Add an exception for the named key to use a different comparison
method. Any assertion provided by PHPUnit\Framework\Assert is
acceptable.

param: string $key The key to except.
param: string $comparator The assertion to use.

evaluate($other, string $description = '', bool $shouldreturnesult = false)   X-Ref
Evaluates the constraint for parameter $other

If $shouldreturnesult is set to false (the default), an exception is thrown
in case of a failure. null is returned otherwise.

If $shouldreturnesult is true, the result of the evaluation is returned as
a boolean value instead: true in case of success, false in case of a
failure.

param: mixed    $other              Value or object to evaluate.
param: string   $description        Additional information about the test
param: bool     $shouldreturnesult  Whether to return a result or throw an exception
return: mixed

toString()   X-Ref
No description