Skip to content

Commit b52516d

Browse files
marac19901990sebastianbergmann
authored andcommitted
better test
1 parent c69b2fa commit b52516d

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

tests/unit/Framework/Assert/AssertNotEqualsTest.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,22 @@
22

33
namespace PHPUnit\Framework;
44

5+
use PHPUnit\Framework\Constraint\IsEqual;
6+
use PHPUnit\Framework\Constraint\LogicalNot;
7+
58
class AssertNotEqualsTest extends TestCase
69
{
710
public function testConfusingMessagesForLogicalNot()
811
{
12+
$expectedMessage = "Failed asserting that 'test contains something' is not equal to 'test contains something'.";
913
$a = 'test contains something';
1014
$b = 'test contains something';
11-
12-
$this->assertNotEquals($b, $a);
15+
$constraint = new LogicalNot(new IsEqual($a));
16+
try {
17+
Assert::assertThat($b, $constraint);
18+
} catch (\Exception $e) {
19+
$actualMessage = $e->getMessage();
20+
$this->assertSame($expectedMessage, $actualMessage);
21+
}
1322
}
1423
}

0 commit comments

Comments
 (0)