PHPUnit Mock Objects never expect by default
问题 Is there a way to tell a phpunit mock object to never expect the method calls if there are no formally defined expectations for them? 回答1: In my opinion it's not got idea to never expectation for every method. So phpunit doesn't have any functionality. Can should use "never" expectations only if you want totally ensure that some method won't be called. Anyway you can use some matchers to get closer your goal. Examples: Never expectations for all object's methods (fails if any of mocked