RangeUnformattedFormatterUiTest.php in Range 8        
                          
                  
                        
  
  
  
  
  
File
  tests/src/Functional/Formatter/RangeUnformattedFormatterUiTest.php
  
    View source  
  <?php
namespace Drupal\Tests\range\Functional\Formatter;
class RangeUnformattedFormatterUiTest extends RangeFormatterUiTestBase {
  
  protected function setUp() : void {
    $this->fieldType = 'range_float';
    $this->formatterType = 'range_unformatted';
    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.123456789-4321.0987654321');
    
    $this
      ->submitForm([], $this->fieldName . '_settings_edit');
    
    $this->session
      ->fieldValueEquals('Range separator', '-');
    $this->session
      ->fieldNotExists('Thousand marker');
    $this->session
      ->fieldNotExists('Decimal marker');
    $this->session
      ->fieldNotExists('Scale');
    $this->session
      ->fieldNotExists('Format');
    
    $edit = [
      "fields[{$this->fieldName}][settings_edit_form][settings][range_separator]" => '=',
    ];
    $this
      ->submitForm($edit, 'Save');
    
    $this->session
      ->pageTextContains('1234.123456789=4321.0987654321');
    
    $this
      ->submitForm([], $this->fieldName . '_settings_edit');
    
    $this->session
      ->fieldValueEquals('Range separator', '=');
  }
}