Skip to content

TestCase::assertEqualsCanonicalizing() not converts and sorts data recursively #4897

Open
@WinterSilence

Description

Q A
PHPUnit version >7.5.*
PHP version >7.0.*
Installation Method Composer

Summary

Assertion method TestCase::assertEqualsCanonicalizing():

  1. not converts/sorts data recursively
  2. undocumented and invalid comparing object's classes
  3. use algorithm same to assertEquals() instead assertEqualsWithDelta() to compare float properties

Current behavior

undocumented and not usable to tests

How to reproduce

$this->assertEqualsCanonicalizing([(object) ['a' => 1, 'b' => 1]], [(object) ['b' => 1, 'a' => 1]])

class Dummy
{
}

$expected = new Dummy();
$expected->a = 1;
$expected->b = 0.333;

$actual = new Dummy();
$actual->b = 0.33333;
$actual->a = 1;
$this->assertEqualsCanonicalizing($expected, $actual);
class Parent
{
    public $a = 'Foo';
}

class Child extend Parent
{
}

$this->assertEqualsCanonicalizing(new Parent(), new Child());

Epic fail...

Expected behavior

inverse of current behavior

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugSomething is broken

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions