Skip to content

[Feature] Add PHPUnit-Like Array Difference Visualization #208

@jakubtobiasz

Description

@jakubtobiasz

Inspired by great job done by @Rafikooo in Sylius, I would like to port PHPUnit-Like array difference visualization directly to the package.

Reference: Sylius/Sylius#16863

Description

Currently, when there's a difference between expected respons and actual response, we are getting the whole response body with difference embedded into it.

Example:

{
  "id": "123",
  "name": "Jacob",
-  "favorite_fruit": "apple"
+  "favorite_fruit": "banana"
}

When we deal with short responses it isn't a big deal, however in bigger ones it becomes a real trouble. This task is aiming to fix this.

Goal

We want to use work done by our colleagues from Sylius, and implement it in the package. For any differences, the expected result is following:

Image instead of Image Image

Acceptance criteria

  • The error result display only diffs, up to 3 lines above, up to 3 lines below the diffs
  • Expected line that is not being present is marked with a red color
  • Actual line that is present instead of expected one is marked with a green color
  • The expected response file path used to comparison is displayed

Technical acceptance criteria

  • The solution is written without any breaking changes
  • The solution is tested to make sure it works as expected

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions