{"action":"created","issue":{"url":"https://api.github.com/repos/phpspec/phpspec/issues/620","labels_url":"https://api.github.com/repos/phpspec/phpspec/issues/620/labels{/name}","comments_url":"https://api.github.com/repos/phpspec/phpspec/issues/620/comments","events_url":"https://api.github.com/repos/phpspec/phpspec/issues/620/events","html_url":"https://github.com/phpspec/phpspec/issues/620","id":55279583,"number":620,"title":"Mock doesn't implement Interface correctly ","user":{"login":"kanedo","id":660158,"avatar_url":"https://avatars.githubusercontent.com/u/660158?v=3","gravatar_id":"","url":"https://api.github.com/users/kanedo","html_url":"https://github.com/kanedo","followers_url":"https://api.github.com/users/kanedo/followers","following_url":"https://api.github.com/users/kanedo/following{/other_user}","gists_url":"https://api.github.com/users/kanedo/gists{/gist_id}","starred_url":"https://api.github.com/users/kanedo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kanedo/subscriptions","organizations_url":"https://api.github.com/users/kanedo/orgs","repos_url":"https://api.github.com/users/kanedo/repos","events_url":"https://api.github.com/users/kanedo/events{/privacy}","received_events_url":"https://api.github.com/users/kanedo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-23T13:09:40Z","updated_at":"2015-01-23T13:23:48Z","closed_at":null,"body":"Hi,\r\nI'm trying to mock a Interface which is implemented like this:\r\n```php\r\ninterface HTTPInterface {\r\n\r\n  /**\r\n   * returns content of the url given as parameter\r\n   *\r\n   * @param string $url\r\n   *\r\n   * @return string\r\n   */\r\n  public function getUrlContents( $url );\r\n}\r\n```\r\n\r\nthe application uses an dependency injector `$app` which returns the wanted HTTP class (implementing the Interface). My spec looks like this:\r\n```php\r\n    function it_should_export_sites( ConfigStore $configStore, HTTPInterface $httpHelper, FileSystem $fileSystem ){\r\n        // [...]\r\n        $app = AppContainer::getInstance();\r\n        $app['extension.static_exporter.helper.http'] = $httpHelper;\r\n\r\n        $this->setAppContainer( $app );\r\n\r\n        $this->exportSites();\r\n    }\r\n\r\n```\r\n\r\nWhen I run the spec I get the following error:\r\n```\r\nerror: Argument 1 passed to Sitemap::setHTTPAdapter() must implement interface\r\n     HTTPInterface, instance of PhpSpec\\Wrapper\\Collaborator given\r\n```\r\n\r\nWhat went wrong? I also tried to mock it on my own but it didn't work. "},"comment":{"url":"https://api.github.com/repos/phpspec/phpspec/issues/comments/71192285","html_url":"https://github.com/phpspec/phpspec/issues/620#issuecomment-71192285","issue_url":"https://api.github.com/repos/phpspec/phpspec/issues/620","id":71192285,"user":{"login":"stof","id":439401,"avatar_url":"https://avatars.githubusercontent.com/u/439401?v=3","gravatar_id":"","url":"https://api.github.com/users/stof","html_url":"https://github.com/stof","followers_url":"https://api.github.com/users/stof/followers","following_url":"https://api.github.com/users/stof/following{/other_user}","gists_url":"https://api.github.com/users/stof/gists{/gist_id}","starred_url":"https://api.github.com/users/stof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stof/subscriptions","organizations_url":"https://api.github.com/users/stof/orgs","repos_url":"https://api.github.com/users/stof/repos","events_url":"https://api.github.com/users/stof/events{/privacy}","received_events_url":"https://api.github.com/users/stof/received_events","type":"User","site_admin":false},"created_at":"2015-01-23T13:23:48Z","updated_at":"2015-01-23T13:23:48Z","body":"Inside the spec, arguments are not the real mock. they are PhpSpec Collaborator objects. If you need to pass it explicitly to a method which is not wrapped by PhpSpec, you need to call ``getWrappedObject()``."}}