【问题标题】:PHPUnit annotation throwing ReflectionException: Class does not existPHPUnit注释抛出ReflectionException:类不存在
【发布时间】:2016-06-21 02:15:15
【问题描述】:

我正在尝试使用 phpUnit 注释来捕获异常:

/**
 * @expectedException Drupal\apple_news\Api\Exception\ApiException.
*/
public function testDecodeResponse() {
  $this->client->decodeResponse('');
}

看起来不错,事实上如果我使用 setExpectedException 工作正常,但我得到:

ReflectionException: Class Drupal\apple_news\Api\Exception\ApiException. does not exist

知道为什么会这样吗?

谢谢。

【问题讨论】:

    标签: php phpunit


    【解决方案1】:

    删除一个点。

    /**
     * @expectedException Drupal\apple_news\Api\Exception\ApiException // <- here
    */
    

    【讨论】:

    • 啊,说真的,我现在觉得自己很蠢 :-D。谢谢老哥
    猜你喜欢
    • 2012-01-08
    • 2018-04-11
    • 1970-01-01
    • 2016-07-26
    • 2014-12-11
    • 2017-11-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多