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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to build interaction without given #117

Closed
arun290636 opened this issue Mar 21, 2019 · 3 comments
Closed

Unable to build interaction without given #117

arun290636 opened this issue Mar 21, 2019 · 3 comments
Assignees
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@arun290636
Copy link

when i build interaction as below 馃憤 $config = new MockServerEnvConfig();
$builder = new InteractionBuilder($config);
$builder
->uponReceiving('A get request to /hello/{name}')
->with($request)
->willRespondWith($response); // This has to be last. This is what makes an API request to the Mock Server to set the interaction.

Below error is thrown by phpPact:
TypeError: Return value of PhpPact\Consumer\Model\Interaction::getProviderState() must be of the type string, null returned

@cfmack
Copy link
Collaborator

cfmack commented Mar 22, 2019

Doing some quick research, it appears that providerState/given() is optional on other languages. Here is the ruby example: https://github.com/pact-foundation/pact-ruby-e2e-example/blob/master/consumer/spec/pacts/foo-bar.json

This appears to be a bug.

cfmack added a commit that referenced this issue Mar 22, 2019
Unable to build interaction without given #117
@cfmack
Copy link
Collaborator

cfmack commented Mar 22, 2019

Try now, pulling from dev-master. If that works, I can make a quick tag.

@cfmack cfmack added the bug Indicates an unexpected problem or unintended behavior label Mar 22, 2019
@cfmack cfmack self-assigned this Mar 22, 2019
@cfmack cfmack closed this as completed Mar 22, 2019
@mefellows
Copy link
Member

mefellows commented Mar 22, 2019

Yes it is definitely an optional field.

Thanks for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

3 participants