public function FieldFormatterTest::testThirdPartySettings in Drupal 8
Same name and namespace in other branches
- 9 core/modules/field/tests/src/Kernel/FieldFormatterTest.php \Drupal\Tests\field\Kernel\FieldFormatterTest::testThirdPartySettings()
- 10 core/modules/field/tests/src/Kernel/FieldFormatterTest.php \Drupal\Tests\field\Kernel\FieldFormatterTest::testThirdPartySettings()
Tests availability of third party settings in field render arrays.
File
- core/
modules/ field/ tests/ src/ Kernel/ FieldFormatterTest.php, line 88
Class
- FieldFormatterTest
- Tests for field formatters.
Namespace
Drupal\Tests\field\KernelCode
public function testThirdPartySettings() {
$third_party_settings = [
'field_test' => [
'foo' => 'bar',
],
];
$component = $this->display
->getComponent($this->fieldName);
$component['third_party_settings'] = $third_party_settings;
$this->display
->setComponent($this->fieldName, $component)
->save();
$entity = EntityTestRev::create([]);
$entity->{$this->fieldName}->value = $this
->randomString();
$build = $entity->{$this->fieldName}
->view('default');
$this
->assertEquals($third_party_settings, $build['#third_party_settings']);
}