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

Multiple mocoWriter #3

Open
tyx opened this issue Nov 9, 2016 · 2 comments
Open

Multiple mocoWriter #3

tyx opened this issue Nov 9, 2016 · 2 comments

Comments

@tyx
Copy link
Member

tyx commented Nov 9, 2016

If an application need to mock different hostname, it would be impossible currently.

Solutions :

  • Move out hostname from behat config and let people configure it at runtime when using MocoWriter
  • Configure multiple hostname in behat config, create as many MocoWriter as hostnames, and find a way to allow people injecting the good one in their context
@tyx tyx added the enhancement label Nov 9, 2016
@tyx tyx changed the title Think about allowing to have multiple mocoWriter Multiple mocoWriter Nov 9, 2016
@tyx tyx added the help wanted label Nov 9, 2016
@tyx
Copy link
Member Author

tyx commented Nov 17, 2016

In fact I was totally wrong. hostname is just used for heath check purpose. So we should consider to refactore that part to allow multiple health_check

@tyx
Copy link
Member Author

tyx commented Nov 17, 2016

So we could imagine change MocoWriter to add a collections of hostname:port indexed by name :

default:
    extensions:
        Rezzza\MocoBehatExtension\MocoExtension:
            json_file: features/fixtures.yml
            hosts:
                my_first_mock: { hostname: http://coucou.hibou, port: 2113 }
                my_other_mock: { hostname: http://coucou.filou, port: 2113 }

Then the MocoWriter::mockHttpCall should be changed to receive the name of the hosts targeted by this call. We should continue to enqueue the httpCall but also the hosts.

And add a BeforeStep hook, that will watch for the first When step and automatically call writeForMoco and wait for all mocos we queued

Big BC break, that would lead to v2.0

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

No branches or pull requests

1 participant