public function FieldNumericTest::testFieldNumeric in Drupal 9
Same name and namespace in other branches
- 8 core/modules/views/tests/src/Kernel/Handler/FieldNumericTest.php \Drupal\Tests\views\Kernel\Handler\FieldNumericTest::testFieldNumeric()
Tests the Numeric handler with different settings.
@dataProvider providerTestFieldNumeric
File
- core/
modules/ views/ tests/ src/ Kernel/ Handler/ FieldNumericTest.php, line 28
Class
- FieldNumericTest
- Tests the core Drupal\views\Plugin\views\field\Numeric handler.
Namespace
Drupal\Tests\views\Kernel\HandlerCode
public function testFieldNumeric($field_settings, $values, $expected_values) {
$view = Views::getView('test_view');
$view
->setDisplay();
if (!empty($field_settings)) {
$view->displayHandlers
->get('default')
->overrideOption('fields', [
'age' => $field_settings,
]);
}
$this
->executeView($view);
foreach ($values as $key => $value) {
$view->result[0]->views_test_data_age = $value;
$this
->assertSame($expected_values[$key], $view->field['age']
->advancedRender($view->result[0]));
}
}