-
-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Diff of PHPMatcherConstraint ignores patterns #202
Comments
Hey, Thanks in advance! |
Hey, sorry, I accidentally closed wrong PR, #212 was the one I wanted to close. |
Hey, so now the diff definitely changed, version 6.0.2 brings totally new, more precise error messages, I'm closing this issue, if you are still using the library don't hesitate to leave some feedback, thanks! |
Really like the new error messages! Thanks a lot for your work! |
Just a small proposal - the output for the following test case looks like this at the moment: use Coduo\PHPMatcher\PHPUnit\PHPMatcherConstraint;
use PHPUnit\Framework\TestCase;
class PatternTest extends TestCase
{
public function testPattern(): void
{
$pattern = <<<EOF
{
"name": "@string@",
"description": "test-1"
}
EOF;
$value = <<<EOF
{
"name": "test-2",
"description": "test-2"
}
EOF;
TestCase::assertThat(
$value,
new PHPMatcherConstraint($pattern)
);
}
}
The new error message is great, but it is hard to spot in the middle of the output. What do you think about adjusting the
Would you accept a pull request for this? Thanks for your time! |
hey @nnatter it makes perfect sense now to remove the pattern from that message. I would be happy to merge a pull request with this change 🙌 |
Just created #226. Not sure if I adjusted the test cases correctly - feel free to add some comments 🙂 |
Hey,
we are using this library for asserting the content of JSON responses in our functional tests. Apart from a few minor issues, this is working great. So thanks for your effort!
As we are using the library for testing API responses, we need to use a lot of value-patterns to match values such as autogenerated ids and timestamps. This works great as long as the response matches our response-pattern. Unfortunately, if the response does not match our response-pattern, the
PHPMatcherConstraint
includes all lines that use a value-pattern in its diff. This makes it hard to find out what line actually contains an error.For example, the diff of the following test-case includes
"name": "@string@"
even though"name": "test-2"
would match the pattern:Is it possible somehow to exclude the lines that do match the pattern from the diff?
Thanks in advance!
The text was updated successfully, but these errors were encountered: