【问题标题】:Cakephp test is breaking at middle of functionCakephp 测试在函数中间中断
【发布时间】:2017-12-15 19:28:23
【问题描述】:

我正在创建一个 cakephp 测试(使用 phpunit),不知何故它停在了函数的中间。

所以我正在测试 StartController,它调用函数 createInstitution。

在它的中间,我有以下代码:

(...)
var_dump("0");
$newEntry = $this->InstitutionRegistration->findEntryByEmail($email);
var_dump("1");
(...)

当我运行测试时,它会打印“0”,但之后就不再运行测试了。

作为这个控制器 $fixtures 变量,我有以下内容:

public $fixtures = [
    'app.users',
    'app.institution_registration',
    'app.institutions',
];

我在粘贴的代码之前使用了来自 UsersTable 的函数

我在日志上没有错误,在命令行上也没有。

感谢您的帮助。如果需要更多信息,请告诉我

【问题讨论】:

    标签: cakephp phpunit


    【解决方案1】:

    找到了问题。

    必须在该函数上放置一个 try-catch 并打印异常错误以发现问题所在。这是一个未列出的 Mysql 错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-26
      • 2017-10-14
      • 2011-07-29
      相关资源
      最近更新 更多