【发布时间】:2017-05-05 08:08:09
【问题描述】:
我正在尝试测试将Symfony\Component\HttpKernel\Kernel 作为依赖项的服务。
这是我为了模拟内核所做的。
$this->kernel = $this->getMock('Symfony\Component\HttpKernel\KernelInterface');
$this->kernel->expects($this->any())
->method('getEnvironment')
->will($this->returnValue('dev'));
当我运行测试时,我得到以下错误。
致命错误:无法将静态 foo\foo\WebTestCase::$kernel 重新声明为非静态 foo\foo\MyTest::$kernel in ...
任何想法为什么?
【问题讨论】:
标签: php symfony unit-testing phpunit