WebformViewsArgumentTestBase.php in Webform Views Integration 8.5
File
tests/src/Kernel/argument/WebformViewsArgumentTestBase.php
View source
<?php
namespace Drupal\Tests\webform_views\Kernel\argument;
use Drupal\Tests\webform_views\Kernel\WebformViewsTestBase;
abstract class WebformViewsArgumentTestBase extends WebformViewsTestBase {
public function testArgument($argument, $expected) {
$this->webform = $this
->createWebform($this->webform_elements);
$this
->createWebformSubmissions($this->webform_submissions_data, $this->webform);
$this->view = $this
->initView($this->webform, $this->view_handlers);
$rendered_cells = $this
->renderView($this->view, [
$argument,
]);
$this
->assertSame($expected, $rendered_cells, 'Argument works for ' . $argument);
}
public function providerArgument() {
$tests = [];
foreach ($this->webform_submissions_data as $submission) {
$element = array_keys($submission);
$element = reset($element);
$tests[] = [
$submission[$element],
[
$submission,
],
];
}
return $tests;
}
}