Skip to content

assertObjectNotEquals() #5811

@lstrojny

Description

@lstrojny

assertObjectEquals is great for VOs and it would be lovely to have the opposite available as well, assertObjectNotEquals. Sure, it’s trivial to polyfill but still it would be lovely if PHPUnit could offer it out of the box.

public static function assertObjectNotEquals(object $expected, object $actual, string $method = 'equals', string $message = ''): void
{
    self::assertThat(
        $actual,
        self::logicalNot(self::objectEquals($expected, $method)),
        $message,
    );
}

Metadata

Metadata

Labels

feature/assertionIssues related to assertions and expectationstype/enhancementA new idea that should be implemented

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions