You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In PhpUnit setMethods() is deprecated (sebastianbergmann/phpunit#3687) and will be removed in version 10 (sebastianbergmann/phpunit#3769). The method was split into two methods (onlyMethods and addMethods) according to their responsibilities.
But it's not that simple: setMethods() allows to mock non-existent class. So in PhpUnit 10 we will lose this feature, because onlyMethods and addMethods work with ReflectionClass internally. In this package setMethods() is used to mock non-existent classes, see:
In PhpUnit
setMethods()
is deprecated (sebastianbergmann/phpunit#3687) and will be removed in version 10 (sebastianbergmann/phpunit#3769). The method was split into two methods (onlyMethods
andaddMethods
) according to their responsibilities.But it's not that simple:
setMethods()
allows to mock non-existent class. So in PhpUnit 10 we will lose this feature, becauseonlyMethods
andaddMethods
work withReflectionClass
internally. In this packagesetMethods()
is used to mock non-existent classes, see:UriTest
(strings: 140, 306, 360)ResponseTest
(string 147)What's the solution?
\stdClass
instead of a non-existent class:Source - https://stackoverflow.com/questions/60535649/mock-non-existing-class-in-phpunit-10?rq=1
The text was updated successfully, but these errors were encountered: