PHPUnit的作者Sebastian Bergmann最近发表了一篇有关Stubbing和Mocking静态方法的博客文章。使用PHPUnit 3.5和PHP 5.3以及一致使用后期静态绑定,您可以
$class::staticExpects($this->any()) ->method('helper') ->will($this->returnValue('bar'));更新:
staticExpects被弃用的PHPUnit
3.8的,将被更高版本的完全去除。

PHPUnit的作者Sebastian Bergmann最近发表了一篇有关Stubbing和Mocking静态方法的博客文章。使用PHPUnit 3.5和PHP 5.3以及一致使用后期静态绑定,您可以
$class::staticExpects($this->any()) ->method('helper') ->will($this->returnValue('bar'));更新:
staticExpects被弃用的PHPUnit