-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
feature/assertionIssues related to assertions and expectationsIssues related to assertions and expectationstype/bugSomething is brokenSomething is brokenversion/11Something affects PHPUnit 11Something affects PHPUnit 11version/12Something affects PHPUnit 12Something affects PHPUnit 12
Description
Q | A |
---|---|
PHPUnit version | 12.0.5 |
PHP version | 8.4.4 |
Installation Method | Composer |
Summary
If failing assertJsonFileEqualsJsonFile expected, actual are mixed up
Current behavior
If assertJsonFileEqualsJsonFile is failing, the output of expected, actual are mixed up.
How to reproduce
File expected.json:
{"key": true}
File actual.json:
{"key": false}
<?php
declare(strict_types=1);
use PHPUnit\Framework\TestCase;
class JsonTest extends TestCase
{
public function testAssertJson(): void
{
$expected =__DIR__ . '/expected.json';
$actual =__DIR__ . '/actual.json';
$this->assertJsonFileEqualsJsonFile($expected, $actual);
}
}
PHP 8.4.4 (cli) (built: Feb 25 2025 02:19:56) (NTS)
Copyright (c) The PHP Group
Built by https://github.com/docker-library/php
Zend Engine v4.4.4, Copyright (c) Zend Technologies
with Xdebug v3.4.1, Copyright (c) 2002-2025, by Derick Rethans
PHPUnit 12.0.5 by Sebastian Bergmann and contributors.
Runtime: PHP 8.4.4
.F...... 8 / 8 (100%)
Time: 00:00.024, Memory: 12.00 MB
There was 1 failure:
1) placementDetermination\book\PageTest::testName
Failed asserting that '{\n
"key": true\n
}' matches JSON string "{
"key": false
}".
--- Expected
+++ Actual
@@ @@
{
- "key": false
+ "key": true
}
Expected behavior
--- Expected
+++ Actual
@@ @@
{
- "key": true
+ "key": false
}
Metadata
Metadata
Assignees
Labels
feature/assertionIssues related to assertions and expectationsIssues related to assertions and expectationstype/bugSomething is brokenSomething is brokenversion/11Something affects PHPUnit 11Something affects PHPUnit 11version/12Something affects PHPUnit 12Something affects PHPUnit 12