You are here

public function RangeUpdatePathTest::testUpdateHook8101 in Range 8

Tests \range_update_8101().

Tests that 'range_combine' settings is set to FALSE for the existing range_unformatted formatters.

See also

\range_update_8101()

File

tests/src/Functional/Update/RangeUpdatePathTest.php, line 54

Class

RangeUpdatePathTest
Tests range module update path.

Namespace

Drupal\Tests\range\Functional\Update

Code

public function testUpdateHook8101() {

  // Ensure that 'range_combine' settings is not available.
  foreach (EntityViewDisplay::load('node.page.unformatted_formatter')
    ->getComponents() as $component) {
    if (!empty($component['type']) && $component['type'] === 'range_unformatted') {
      $this
        ->assertArrayNotHasKey('range_combine', $component['settings']);
    }
  }

  // Run the updates.
  $this
    ->runUpdates();

  // Ensure that 'range_combine' settings is set to FALSE.
  foreach (EntityViewDisplay::load('node.page.unformatted_formatter')
    ->getComponents() as $component) {
    if (!empty($component['type']) && $component['type'] === 'range_unformatted') {
      $this
        ->assertFalse($component['settings']['range_combine']);
    }
  }
}