public function RadioactivityValueFormatterTest::testFormatter in Radioactivity 8.3
Same name and namespace in other branches
- 4.0.x tests/src/Kernel/RadioactivityValueFormatterTest.php \Drupal\Tests\radioactivity\Kernel\RadioactivityValueFormatterTest::testFormatter()
Tests the (rounded) value formatter.
@dataProvider formatterProvider
Parameters
int $decimals: Number of decimals to display.
string $expected: Expected output.
Throws
\Exception
File
- tests/
src/ Kernel/ RadioactivityValueFormatterTest.php, line 67
Class
- RadioactivityValueFormatterTest
- @coversDefaultClass \Drupal\radioactivity\Plugin\Field\FieldFormatter\RadioactivityValue @group radioactivity
Namespace
Drupal\Tests\radioactivity\KernelCode
public function testFormatter($decimals, $expected) {
$this->entityViewDisplay = $this
->createValueViewDisplay('field_radioactivity', $decimals);
$build = $this->entityViewDisplay
->build($this->entity);
$output = $this
->render($build);
$this
->assertTrue(strpos($output, $expected) !== FALSE, 'Output contains a rounded value');
}