RangeIntegerSprintfFormatterUiTest.php in Range 8
File
tests/src/Functional/Formatter/RangeIntegerSprintfFormatterUiTest.php
View source
<?php
namespace Drupal\Tests\range\Functional\Formatter;
class RangeIntegerSprintfFormatterUiTest extends RangeFormatterUiTestBase {
protected function setUp() : void {
$this->fieldType = 'range_integer';
$this->formatterType = 'range_integer_sprintf';
parent::setUp();
}
public function testFormatterUi() {
parent::testFormatterUi();
$this
->drupalGet('entity_test/structure/entity_test/display');
$edit = [
"fields[{$this->fieldName}][parent]" => 'content',
"fields[{$this->fieldName}][region]" => 'content',
"fields[{$this->fieldName}][type]" => $this->formatterType,
];
$this
->submitForm($edit, 'Save');
$this->session
->pageTextContains('1234-4321');
$this
->submitForm([], $this->fieldName . '_settings_edit');
$this->session
->fieldValueEquals('Range separator', '-');
$this->session
->fieldValueEquals('Format', '%d');
$this->session
->fieldNotExists('Thousand marker');
$this->session
->fieldNotExists('Decimal marker');
$this->session
->fieldNotExists('Scale');
$edit = [
"fields[{$this->fieldName}][settings_edit_form][settings][range_separator]" => '|',
"fields[{$this->fieldName}][settings_edit_form][settings][format_string]" => '%06d',
];
$this
->submitForm($edit, 'Update');
$this->session
->pageTextContains('001234|004321');
$this
->submitForm([], $this->fieldName . '_settings_edit');
$this->session
->fieldValueEquals('Range separator', '|');
$this->session
->fieldValueEquals('Format', '%06d');
}
}