{"action":"closed","issue":{"url":"https://api.github.com/repos/mockery/mockery/issues/777","repository_url":"https://api.github.com/repos/mockery/mockery","labels_url":"https://api.github.com/repos/mockery/mockery/issues/777/labels{/name}","comments_url":"https://api.github.com/repos/mockery/mockery/issues/777/comments","events_url":"https://api.github.com/repos/mockery/mockery/issues/777/events","html_url":"https://github.com/mockery/mockery/issues/777","id":249726630,"number":777,"title":"Methods that clone a partially mocked parameter lead to infinite recursion when there is a missing expectation","user":{"login":"alexweissman","id":5004534,"avatar_url":"https://avatars2.githubusercontent.com/u/5004534?v=4","gravatar_id":"","url":"https://api.github.com/users/alexweissman","html_url":"https://github.com/alexweissman","followers_url":"https://api.github.com/users/alexweissman/followers","following_url":"https://api.github.com/users/alexweissman/following{/other_user}","gists_url":"https://api.github.com/users/alexweissman/gists{/gist_id}","starred_url":"https://api.github.com/users/alexweissman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexweissman/subscriptions","organizations_url":"https://api.github.com/users/alexweissman/orgs","repos_url":"https://api.github.com/users/alexweissman/repos","events_url":"https://api.github.com/users/alexweissman/events{/privacy}","received_events_url":"https://api.github.com/users/alexweissman/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2017-08-11T19:28:36Z","updated_at":"2017-08-11T21:16:46Z","closed_at":"2017-08-11T21:16:46Z","body":"I'm running PHP 5.6.15.\r\n\r\nI have a [method](https://github.com/userfrosting/UserFrosting/blob/62f382d8ec0ab0cc62cffd6b7b9af2e87d20bd64/app/sprinkles/core/src/Database/Relations/Concerns/Unique.php#L257-L298) that, as its first step, clones its instance of an `Eloquent\\Builder` parameter.\r\n\r\nSince `Eloquent\\Builder` has a member `Query\\Builder` that it passes through many of its method calls to, I ended up having to do a partial mock:\r\n\r\n```\r\n$relation = $this->getRelation();\r\n$baseQuery = m::mock('Illuminate\\Database\\Query\\Builder');\r\n$builder = m::mock('Illuminate\\Database\\Eloquent\\Builder', [$baseQuery])->makePartial();\r\n\r\n// Expectations on $builder\r\n...\r\n\r\n$paginatedQuery = $relation->getPaginatedQuery($builder, 2, 1);\r\n```\r\n\r\nWhen all of my expectations on `$builder` are correctly declared, the test passes without a problem.  However if I am missing an expectation, instead of getting the usual \"Call to undefined method\" error, PHPUnit halts with a `Segmentation fault 11` error.\r\n\r\nIt's a difficult problem to unpack - obviously the problem ultimately lies somewhere in PHP itself, but it's difficult to determine whether it is Mockery or Laravel that is triggering this problem."}}
{"actor":{"display_login":"alexweissman"}}