如何使用Drupal 8为Views自定义插件编写单元测试?

时间:2019-06-11 11:56:26

标签: view phpunit drupal-8

您好,我用drupal 8为自定义模块编写了单元测试,请让我知道我们如何为自定义viewField插件类编写单元测试。

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

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

0 个答案:

没有答案