【问题标题】:How to setup PHPUnit test with multi module setup of phalcon?如何使用 phalcon 的多模块设置设置 PHPUnit 测试?
【发布时间】:2015-05-10 16:23:54
【问题描述】:

我已经创建了一个单一设置的测试应用程序,并按照教程http://docs.phalconphp.com/en/latest/reference/unit-testing.html 使用了 PHPUnit,它运行良好。

谁能帮助我如何设置多模块设置?

【问题讨论】:

    标签: phpunit phalcon


    【解决方案1】:

    单元测试不关心应用是单模块还是多模块。给出的示例刚刚给出了测试套件中的 DI 和配置。例如,如果你想在 UserModule 中测试 AddUser 函数,你必须创建 User 对象并模拟它的依赖。然后在单元测试中调用它。

    $user = new \App\Module\User\User.php;
    $this->assertTrue($user->addUser());
    

    【讨论】:

      猜你喜欢
      • 2012-08-16
      • 2016-02-24
      • 2011-10-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-29
      • 2016-02-18
      • 2015-05-20
      • 1970-01-01
      相关资源
      最近更新 更多