Skip to content
This repository was archived by the owner on Apr 20, 2021. It is now read-only.

Add PHP-matcher to contexts #249

Closed
wants to merge 1 commit into from
Closed

Add PHP-matcher to contexts #249

wants to merge 1 commit into from

Conversation

blazarecki
Copy link
Contributor

Hi,

This PR is an exemple of what I would like to add in this project.

But first of all, I want to discuss on it with you.

The idea is to use https://github.com/coduo/php-matcher with the JsonContext (and maybe others).

Sometime, you cannot predict some values of a response. Things like, uuid, date ...
The idea is to do something like this:

// ...
        "city": {
            "@id": "@[email protected]('city/')",
            "@type": "City",
            "name": "Lille",
            "zipcode": "59000",
            "createdAt": "@[email protected]()",
            "updatedAt": "@[email protected]()",
        },
// ...

I see two differents way of doing it:

  1. Update the behavior of assertSame and assertEquals methods of the Asserter.

Devs don't need to update there tests and can directly use it.
But we lost the meaning of the two methods of the Asserter.

  1. Create specific steps like The JSON should match: :pystring and The JSON node should match :expression, ...

Devs need to update there tests to use it.
We keep the assertSame and assertEquals.

What do you think of it @sanpii ?

@sanpii
Copy link
Member

sanpii commented Apr 13, 2018

Hi,

I dislike the notation I find illegible (it’s just my opinion) but many persons seems recalcitrant to use json schema and your proposal is more readable than #224.

I see two differents way of doing it:

I prefer a new step to prevent compatibility break.

@blazarecki
Copy link
Contributor Author

Ok I'll do this.

@blazarecki
Copy link
Contributor Author

Hi,

I just update the PR.
I add something to detect if your PHP version is compatible and suggest to install PHPMatcher.
If you want I can remove it if you plan to add this in the v4.

Tell me if I need to change something.

Thanks.

@thomasbisignani
Copy link

What is the status of this PR ?

I think it will be awesome to have PHP Matcher with the Behatch JsonContext.

This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants