PHPUnit 注释抛出 ReflectionException:Class 不存在

PHPUnit annotation throwing ReflectionException: Class does not exist

我正在尝试使用 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

知道为什么会这样吗?

谢谢。

删除一个点。

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