View 如何使用Drupal8为视图定制插件编写单元测试?

View 如何使用Drupal8为视图定制插件编写单元测试?,view,phpunit,drupal-8,View,Phpunit,Drupal 8,嗨,我正在用drupal 8为我的自定义模块编写单元测试。请告诉我如何为自定义viewField插件类编写单元测试 需要将ResultRow类的实体作为_实体参数传递 $result = $this->prophesize(ResultRow::class); $result->_entity->willReturn((object) ['question' => 'sample question']); $build = $component->render($r

嗨,我正在用drupal 8为我的自定义模块编写单元测试。请告诉我如何为自定义viewField插件类编写单元测试

需要将ResultRow类的实体作为_实体参数传递

$result = $this->prophesize(ResultRow::class);
$result->_entity->willReturn((object) ['question' => 'sample question']);
$build = $component->render($result->reveal());