{"action":"created","issue":{"url":"https://api.github.com/repos/phpspec/phpspec/issues/707","labels_url":"https://api.github.com/repos/phpspec/phpspec/issues/707/labels{/name}","comments_url":"https://api.github.com/repos/phpspec/phpspec/issues/707/comments","events_url":"https://api.github.com/repos/phpspec/phpspec/issues/707/events","html_url":"https://github.com/phpspec/phpspec/issues/707","id":79494541,"number":707,"title":"Creating a collaborator without passing a param","user":{"login":"wheelsandcogs","id":1880478,"avatar_url":"https://avatars.githubusercontent.com/u/1880478?v=3","gravatar_id":"","url":"https://api.github.com/users/wheelsandcogs","html_url":"https://github.com/wheelsandcogs","followers_url":"https://api.github.com/users/wheelsandcogs/followers","following_url":"https://api.github.com/users/wheelsandcogs/following{/other_user}","gists_url":"https://api.github.com/users/wheelsandcogs/gists{/gist_id}","starred_url":"https://api.github.com/users/wheelsandcogs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wheelsandcogs/subscriptions","organizations_url":"https://api.github.com/users/wheelsandcogs/orgs","repos_url":"https://api.github.com/users/wheelsandcogs/repos","events_url":"https://api.github.com/users/wheelsandcogs/events{/privacy}","received_events_url":"https://api.github.com/users/wheelsandcogs/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-05-22T15:22:15Z","updated_at":"2015-05-22T15:52:56Z","closed_at":"2015-05-22T15:52:56Z","body":"Is there a way to create a collaborator without passing it in as a param?\r\n\r\nI need a helper function that creates a new collaborator each time it is called, but I need to pass other params into the helper, e.g. something like:\r\n\r\n```php\r\nclass MySpec extends ObjectBehaviour\r\n{\r\n\tfunction it_does_something()\r\n\t{\r\n\t    $this->mockStripeRequest($method, $path, $params, $mockResponse);\r\n\r\n\t    $order->setStripeFee($amount)->shouldBeCalled();\r\n\t    $this->someFunctionThatUsesStripeAPI($order);\r\n\t}\r\n\r\n\tprotected function mockStripeRequest($method, $path, $params, $mockResponse)\r\n\t{\r\n\t\t$client = Collaborator::beADoubleOf('Stripe\\HttpClient\\ClientInterface');\r\n\r\n\t\t$client->request($method, $path, $data)\r\n\t\t\t->willReturn([json_encode($response), 200]);\r\n\r\n\t\tStripe\\ApiRequestor::setHttpClient($client->getWrappedObject());\r\n\t}\r\n}\r\n```\r\n\r\nBasically I need a mocked $client, but I can't pass it in..."},"comment":{"url":"https://api.github.com/repos/phpspec/phpspec/issues/comments/104696703","html_url":"https://github.com/phpspec/phpspec/issues/707#issuecomment-104696703","issue_url":"https://api.github.com/repos/phpspec/phpspec/issues/707","id":104696703,"user":{"login":"wheelsandcogs","id":1880478,"avatar_url":"https://avatars.githubusercontent.com/u/1880478?v=3","gravatar_id":"","url":"https://api.github.com/users/wheelsandcogs","html_url":"https://github.com/wheelsandcogs","followers_url":"https://api.github.com/users/wheelsandcogs/followers","following_url":"https://api.github.com/users/wheelsandcogs/following{/other_user}","gists_url":"https://api.github.com/users/wheelsandcogs/gists{/gist_id}","starred_url":"https://api.github.com/users/wheelsandcogs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wheelsandcogs/subscriptions","organizations_url":"https://api.github.com/users/wheelsandcogs/orgs","repos_url":"https://api.github.com/users/wheelsandcogs/repos","events_url":"https://api.github.com/users/wheelsandcogs/events{/privacy}","received_events_url":"https://api.github.com/users/wheelsandcogs/received_events","type":"User","site_admin":false},"created_at":"2015-05-22T15:52:56Z","updated_at":"2015-05-22T15:52:56Z","body":"If anyone needs to do this, as @ciaranmcnulty says just use the Prophet object and remember to call `->reveal()` instead of `->getWrappedObject()`.\r\n\r\n```php\r\n$client = $this->prophet->prophesize('Stripe\\HttpClient\\ClientInterface');\r\n$client->request(...)->willReturn(...);\r\nApiRequestor::setHttpClient($client->reveal());\r\n```"}}