public function AgreementEntityTest::testRender in Agreement 8.2
Same name and namespace in other branches
- 3.0.x tests/src/Unit/Plugin/views/field/AgreementEntityTest.php \Drupal\Tests\agreement\Unit\Plugin\views\field\AgreementEntityTest::testRender()
Asserts that render builds markup based on options.
@dataProvider renderProvider
Parameters
array $options: An array of "display" options.
string $expected_key: The expected array key or result.
File
- tests/
src/ Unit/ Plugin/ views/ field/ AgreementEntityTest.php, line 105
Class
- AgreementEntityTest
- Tests the agreement entity views field plugin.
Namespace
Drupal\Tests\agreement\Unit\Plugin\views\fieldCode
public function testRender(array $options, $expected_key) {
$this->plugin->options += [
'display' => $options,
];
$values = [
new ResultRow([
'type' => 'default',
'uid' => 2,
]),
];
$this->plugin
->preRender($values);
$markup = $this->plugin
->render($values[0]);
if (empty($options)) {
$this
->assertEquals($expected_key, $markup);
}
else {
$this
->assertArrayHasKey($expected_key, $markup);
}
}