MDL-65204 phpunit: tweak constraint_object_is_equal_with_exceptions
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Thu, 28 Mar 2019 00:37:28 +0000 (01:37 +0100)
committerJun Pataleta <jun@moodle.com>
Wed, 3 Apr 2019 02:39:19 +0000 (10:39 +0800)
commit032c75ec4371121b5d1b0e002e12df9bd026f58d
tree40609918117ad2b633ef2f533669cd7892c4e00c
parent85f47bae7f3e7ded3bce20396b166ff97d500219
MDL-65204 phpunit: tweak constraint_object_is_equal_with_exceptions

In PHPUnit 7.x and above, IsEqual->value became private and, as far
as our with exceptions class inherits from it, we cannot access to
that anymore.

So, in order to avoid that, we are overriding the constructor, capturing
the original value for own use and forgetting.

A more formal, alternative, solution would be to make our
exceptional class to inherit from Constraint and make the
class a pure dispatcher to different constraints, with IsEqual being
just one of them.

But we followed the easiest path here. Not ideal, but efective.
lib/phpunit/classes/constraint_object_is_equal_with_exceptions.php