【问题标题】:Codeception with CakePHP gives PHPUnit array to string conversion error使用 CakePHP 的 Codeception 给 PHPUnit 数组到字符串的转换错误
【发布时间】:2018-02-05 13:30:15
【问题描述】:

我在 CakePHP 3.5 中使用 Codeception,并编写了一些测试步骤。但是在执行它们时,它会给我一个错误,而据我所知应该没有错误。前几个步骤运行良好,但是当我进入单击按钮的步骤时,我收到错误“PHPUnit 框架异常:数组到字符串的转换”。

我正在使用 codeception 代码: $I->click(['button' => ['title' => '删除testtest, tt']]);

试图点击元素:

<button class="btn btn-primary btn-xs delete-namestring" title="Delete testtest, tt" id="20867"><span class="glyphicon glyphicon-trash"></span> Delete</button>

手动点击它可以正常工作。

【问题讨论】:

    标签: cakephp codeception


    【解决方案1】:

    出现此错误是因为您有一个数组作为button 的值。

    尝试以下方法之一:

    $I->click(['css' => 'button.delete-namestring']);
    
    $I->click('button.delete-namestring');
    
    $I->click('class', 'delete-namestring');
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-02
      • 1970-01-01
      • 1970-01-01
      • 2015-02-26
      • 2012-07-15
      相关资源
      最近更新 更多