Comparator
extends Comparator
in package
FinalYes
Use this Comparator to get nice output when using PHPUnit assertEquals() with Enums.
Add this to your PHPUnit bootstrap PHP file:
\SebastianBergmann\Comparator\Factory::getInstance()->register(new \MyCLabs\Enum\PHPUnit\Comparator());
Table of Contents
Properties
Methods
- __construct() : mixed
- accepts() : bool
- Returns whether the comparator can compare two values.
- assertEquals() : void
- Asserts that two values are equal.
- setFactory() : mixed
- formatEnum() : mixed
Properties
$exporter
protected
Exporter
$exporter
$factory
protected
Factory
$factory
Methods
__construct()
public
__construct() : mixed
accepts()
Returns whether the comparator can compare two values.
public
accepts(mixed $expected, mixed $actual) : bool
Parameters
- $expected : mixed
-
The first value to compare
- $actual : mixed
-
The second value to compare
Return values
boolassertEquals()
Asserts that two values are equal.
public
assertEquals(Enum $expected, Enum|null $actual[, mixed $delta = 0.0 ][, mixed $canonicalize = false ][, mixed $ignoreCase = false ]) : void
Parameters
setFactory()
public
setFactory(Factory $factory) : mixed
Parameters
- $factory : Factory
formatEnum()
private
formatEnum([Enum $enum = null ]) : mixed
Parameters
- $enum : Enum = null