警告:缺少模拟的参数1

时间:2015-10-30 14:41:15

标签: symfony mocking behat

我试图模拟服务:

$this->mocker->mockService(
    'manager.mikrotik',
    new AtoumAdapter(
        '\MyBundle\Services\MikrotikManager'
    )
);

我收到此错误:

  

警告:缺少参数1   mock \ MyBundle \ Services \ MikrotikManager :: __ construct(),调用   第45行的vendor / rezzza / mock-extension / src / Adapter / AtoumAdapter.php   并在vendor / atoum / atoum / classes / mock / generator.php(183)中定义:   eval()' d代码行22

我的错误在哪里?

现在我解决使用orphanize:

$this
    ->mocker
    ->mockService(
        'manager.mikrotik',
        new AtoumAdapter(
            '\MyBundle\Services\MikrotikManager',
            function ($generator) {
                $generator->orphanize('__construct');
            }
        )
    );

这里有一个类__construct:

public function __construct($em,$mikrotikIp, $mikrotikUser, $mikrotikPassword)

0 个答案:

没有答案