{"action":"created","issue":{"url":"https://api.github.com/repos/padraic/mockery/issues/581","repository_url":"https://api.github.com/repos/padraic/mockery","labels_url":"https://api.github.com/repos/padraic/mockery/issues/581/labels{/name}","comments_url":"https://api.github.com/repos/padraic/mockery/issues/581/comments","events_url":"https://api.github.com/repos/padraic/mockery/issues/581/events","html_url":"https://github.com/padraic/mockery/issues/581","id":149005716,"number":581,"title":"Full mock of exception with no expectations work","user":{"login":"zodiac","id":130362,"avatar_url":"https://avatars.githubusercontent.com/u/130362?v=3","gravatar_id":"","url":"https://api.github.com/users/zodiac","html_url":"https://github.com/zodiac","followers_url":"https://api.github.com/users/zodiac/followers","following_url":"https://api.github.com/users/zodiac/following{/other_user}","gists_url":"https://api.github.com/users/zodiac/gists{/gist_id}","starred_url":"https://api.github.com/users/zodiac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zodiac/subscriptions","organizations_url":"https://api.github.com/users/zodiac/orgs","repos_url":"https://api.github.com/users/zodiac/repos","events_url":"https://api.github.com/users/zodiac/events{/privacy}","received_events_url":"https://api.github.com/users/zodiac/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-17T23:24:40Z","updated_at":"2016-04-18T10:09:33Z","closed_at":null,"body":"I am trying to track down differences in mockery behavior under zend and hhvm and ran into what I think is a bug when full-mocking `Exception`.\r\n\r\n```\r\n<?php\r\n\r\ninclude('./vendor/autoload.php');\r\n\r\nclass K {\r\n  function getMessage() {\r\n    return 'hi';\r\n  }\r\n}\r\n\r\n$r1 = Mockery::Mock('K');\r\nvar_dump($r1->getMessage());\r\n\r\n$r2 = Mockery::Mock('K')->makePartial();\r\nvar_dump($r2->getMessage());\r\n\r\n$r3 = Mockery::Mock('Exception');\r\nvar_dump($r3->getMessage());\r\n\r\n$r4 = Mockery::Mock('Exception')->makePartial();\r\nvar_dump($r4->getMessage());\r\n```\r\n\r\nIn the code above, both partial mocks (`r2` and `r4`) should defer the call of `getMessage` to the class being mocked, and this is what happens in both zend and hhvm.\r\n\r\nAlso, in both engines, when calling `getMessage` on a non-partial mock of `K` (ie on `r1`), a `BadMethodCallException` is thrown, since no expectations were set on `r1`.\r\n\r\nThis leads me to believe that a `BadMethodCallException` should also be thrown on `r3`. This is what mockery does on hhvm, but on zend, the an empty string is returned. Is this expected behavior?"},"comment":{"url":"https://api.github.com/repos/padraic/mockery/issues/comments/211310002","html_url":"https://github.com/padraic/mockery/issues/581#issuecomment-211310002","issue_url":"https://api.github.com/repos/padraic/mockery/issues/581","id":211310002,"user":{"login":"davedevelopment","id":61351,"avatar_url":"https://avatars.githubusercontent.com/u/61351?v=3","gravatar_id":"","url":"https://api.github.com/users/davedevelopment","html_url":"https://github.com/davedevelopment","followers_url":"https://api.github.com/users/davedevelopment/followers","following_url":"https://api.github.com/users/davedevelopment/following{/other_user}","gists_url":"https://api.github.com/users/davedevelopment/gists{/gist_id}","starred_url":"https://api.github.com/users/davedevelopment/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davedevelopment/subscriptions","organizations_url":"https://api.github.com/users/davedevelopment/orgs","repos_url":"https://api.github.com/users/davedevelopment/repos","events_url":"https://api.github.com/users/davedevelopment/events{/privacy}","received_events_url":"https://api.github.com/users/davedevelopment/received_events","type":"User","site_admin":false},"created_at":"2016-04-18T10:09:33Z","updated_at":"2016-04-18T10:09:33Z","body":"Zend's implementation has `getMessage` (and most of the other methods on `Exception`) as `final`, so we can't generate code to intercept the call, I guess HHVM doesn't mark them as `final`."}}