php - Alias mock persists over test classes -
i have created alias mock using mockery in class mock calls public static methods made in class want test.
in different test class b want use these public static methods (not mocked) seems alias mock created in test class persists when test class b executed. when running tests in test class b exception: badmethodcallexception: static method helper::formatdate() not exist on mock object
, though helper class should not mocked in class b.
i have tried add:
/** * @runtestsinseparateprocesses * @preserveglobalstate disabled */
in test classes make them run separately, error:
phpunit_framework_exception: php fatal error: class 'testcase' not found
anyone has ideas how solve this?
try using aspectmock, supposed mock static methods: https://github.com/codeception/aspectmock
anyway problem indication of code not being testable. should consider refactoring , not using static calls need mocked.
Comments
Post a Comment