{"action":"created","issue":{"url":"https://api.github.com/repos/pact-foundation/pact-php/issues/54","repository_url":"https://api.github.com/repos/pact-foundation/pact-php","labels_url":"https://api.github.com/repos/pact-foundation/pact-php/issues/54/labels{/name}","comments_url":"https://api.github.com/repos/pact-foundation/pact-php/issues/54/comments","events_url":"https://api.github.com/repos/pact-foundation/pact-php/issues/54/events","html_url":"https://github.com/pact-foundation/pact-php/issues/54","id":315572799,"number":54,"title":"'given' and 'uponReceiving' should be swapped in InteractionBuilderInterface","user":{"login":"samuelnogueira","id":12846646,"avatar_url":"https://avatars1.githubusercontent.com/u/12846646?v=4","gravatar_id":"","url":"https://api.github.com/users/samuelnogueira","html_url":"https://github.com/samuelnogueira","followers_url":"https://api.github.com/users/samuelnogueira/followers","following_url":"https://api.github.com/users/samuelnogueira/following{/other_user}","gists_url":"https://api.github.com/users/samuelnogueira/gists{/gist_id}","starred_url":"https://api.github.com/users/samuelnogueira/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samuelnogueira/subscriptions","organizations_url":"https://api.github.com/users/samuelnogueira/orgs","repos_url":"https://api.github.com/users/samuelnogueira/repos","events_url":"https://api.github.com/users/samuelnogueira/events{/privacy}","received_events_url":"https://api.github.com/users/samuelnogueira/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-18T17:28:29Z","updated_at":"2018-04-18T19:11:36Z","closed_at":"2018-04-18T19:11:36Z","author_association":"CONTRIBUTOR","body":"According to documentation, provider state should be set in the `given` clause of the interation: https://docs.pact.io/documentation/provider_states.html\r\nThe methods `given` and `uponReceiving` in `\\PhpPact\\Consumer\\InteractionBuilderInterface` seem to be swapped in this library, as provider state is being set by `uponReceiving` and request description is being set by `given`.\r\nThe issue in readability becomes clear when comparing the Ruby example with the PHP one:\r\n**Ruby**\r\n```ruby\r\ndescribe MyServiceProviderClient do\r\n\r\n  subject { MyServiceProviderClient.new }\r\n\r\n  describe \"get_something\" do\r\n    context \"when a thing exists\" do\r\n      before do\r\n        my_service.given('a thing exists').\r\n          upon_receiving('a request for a thing').\r\n          with(method: 'GET', path: '/thing').\r\n          will_respond_with(\r\n            status: 200,\r\n            headers: { 'Content-Type' => 'application/json' },\r\n            body: { name: 'A small something'})\r\n      end\r\n    end\r\n  end\r\nend\r\n```\r\n\r\n**PHP**\r\n```php\r\n(new InteractionBuilder($mockServerConfig))\r\n    ->given('a request for a thing')\r\n    ->uponReceiving('a thing exists')\r\n    ->with(\r\n        // (...)\r\n    )\r\n    ->willRespondWith(\r\n        // (...)\r\n    );"},"comment":{"url":"https://api.github.com/repos/pact-foundation/pact-php/issues/comments/382497316","html_url":"https://github.com/pact-foundation/pact-php/issues/54#issuecomment-382497316","issue_url":"https://api.github.com/repos/pact-foundation/pact-php/issues/54","id":382497316,"user":{"login":"nbrink91","id":19517049,"avatar_url":"https://avatars3.githubusercontent.com/u/19517049?v=4","gravatar_id":"","url":"https://api.github.com/users/nbrink91","html_url":"https://github.com/nbrink91","followers_url":"https://api.github.com/users/nbrink91/followers","following_url":"https://api.github.com/users/nbrink91/following{/other_user}","gists_url":"https://api.github.com/users/nbrink91/gists{/gist_id}","starred_url":"https://api.github.com/users/nbrink91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nbrink91/subscriptions","organizations_url":"https://api.github.com/users/nbrink91/orgs","repos_url":"https://api.github.com/users/nbrink91/repos","events_url":"https://api.github.com/users/nbrink91/events{/privacy}","received_events_url":"https://api.github.com/users/nbrink91/received_events","type":"User","site_admin":false},"created_at":"2018-04-18T19:11:36Z","updated_at":"2018-04-18T19:11:36Z","author_association":"COLLABORATOR","body":"@samuelnogueira, thanks for catching this. It has been fixed and the documentations been modified to hopefully make the example more clear."}}
{"actor":{"display_login":"nbrink91"}}