Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 39 and 310] [Versions 39 and 311] [Versions 39 and 400] [Versions 39 and 401] [Versions 39 and 402] [Versions 39 and 403]

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: 100 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:: (3 methods):
  __construct()
  add_exception()
  evaluate()


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, $description = '', $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