如何解决带有Reg的PHPunit测试与注释冲突

如何解决带有Reg的PHPunit测试与注释冲突,php,unit-testing,phpunit,Php,Unit Testing,Phpunit,正如您在代码中看到的那样 /** * @expectedException InvalidArgumentException * @expectedExceptionMessageRegExp /Right.*/ */ public function testExceptionMessageMatchesRegExp() { throw new InvalidArgumentException('Some Message', 10); } /Right.*/与注释冲突。 当我删除*以测试其他内

正如您在代码中看到的那样

/**
* @expectedException InvalidArgumentException
* @expectedExceptionMessageRegExp /Right.*/
*/
public function testExceptionMessageMatchesRegExp()
{
throw new InvalidArgumentException('Some Message', 10);
}
/Right.*/
与注释冲突。 当我删除
*
以测试其他内容(例如/???/)时,没有失败消息。 这是怎么发生的? 谢谢你的帮助

/**
* @expectedException InvalidArgumentException
* @expectedExceptionMessageRegExp |Right.*|
*/
public function testExceptionMessageMatchesRegExp()
{
    throw new InvalidArgumentException('Some Message', 10);
}
使用另一个字符作为分隔符,如管道