function FieldNumericTest::testFieldNumeric
Same name in other branches
- 9 core/modules/views/tests/src/Kernel/Handler/FieldNumericTest.php \Drupal\Tests\views\Kernel\Handler\FieldNumericTest::testFieldNumeric()
- 8.9.x core/modules/views/tests/src/Kernel/Handler/FieldNumericTest.php \Drupal\Tests\views\Kernel\Handler\FieldNumericTest::testFieldNumeric()
- 11.x 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 30
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) : void {
$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]));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.