2

我正在使用带有 Laravel 和 PHPunit 的 padraic/mockery 包。我在 PHP 5.4.3 上。

当试图创建一个模拟对象来测试控制器时,我收到一个错误:

"BadMethodCallException: Method ... shouldRecieve() is not found on this mock object"

我的代码在下面,我非常密切地关注教程,但无法弄清楚为什么我的模拟对象似乎没有正确实例化。

public function testItWorks()
{
    $mocked = m::mock('SearchRepositoryInterface');
    App::instance('SearchRepositoryInterface', $mocked);

    $mocked->shouldRecieve('test')->once()->andReturn('NOT hitting the db');
    $response = $this->call('GET', 'search');

    $this->assertTrue($response->isOK());
}
4

1 回答 1

6

你有一个错字。它shouldReceive不是shouldRecieve

于 2013-03-14T22:26:18.390 回答