Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicit message for "json node should have :nb elements" #31

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jdeniau
Copy link

@jdeniau jdeniau commented May 13, 2024

Q A
Branch? main
Bug fix? no
New feature? yes
Deprecations? no
Tickets N/A
License MIT
Doc PR N/A

Make the output of @Then the JSON node :node should have :count element(s) more explicit

Here the diff of the before / after output:

 - The element '2' is not equal to '1'
 + The JSON node "some.node" contains 2 elements (1 expected).

@Jean-Beru
Copy link
Collaborator

Good catch @jdeniau ! It seems that theJsonNodeShouldContain and theJsonNodeShouldNotContain methods also don't have an explicit message. Can you update them ?

@jdeniau
Copy link
Author

jdeniau commented Jun 4, 2024

Hi @Jean-Beru .

I created #33 for that 👍

Copy link
Collaborator

@Jean-Beru Jean-Beru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a unit test too ?

$this->assertSame(
$count,
$actualCount,
'The node "'.$node.'" contains '.$actualCount.' elements ('.$count.' expected).'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'The node "'.$node.'" contains '.$actualCount.' elements ('.$count.' expected).'
sprintf("The node '%s' contains %d elements, %d expected.", $node, $actualCount, $count)

$count,
$actualCount,
'The node "'.$node.'" contains '.$actualCount.' elements ('.$count.' expected).'
);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a unit test too ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants