簡體   English   中英

expectExceptionMessageRegExp() function 在 phpunit 中被棄用 9. 我可以使用的其他替代 function 是什么?

[英]expectExceptionMessageRegExp() function is deprecated in phpunit 9 . What's the other alternate function that i can use instead?

將 phpunit 版本從 7.1 切換到 9.5.28 后出現以下問題無法斷言“錯誤”類型的異常與預期的異常“異常”匹配。 expectExceptionMessageRegExp() 已棄用。

expectExceptionMessageRegExp() 已在 PHPUnit 8 中棄用,並將在 PHPUnit 9 中刪除。改用 expectExceptionMessageMatches()。

例子:

function testResponse(){
 $this->expectExceptionMessageRegExp("/Unable to emit response/");
}

用。。。來代替:

function testResponse(){
  $this->expectExceptionMessageMatches("/Unable to emit response/");
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM