You are here

public function BreakpointDiscoveryTest::testBreakpointGroups in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/breakpoint/tests/src/Kernel/BreakpointDiscoveryTest.php \Drupal\Tests\breakpoint\Kernel\BreakpointDiscoveryTest::testBreakpointGroups()
  2. 10 core/modules/breakpoint/tests/src/Kernel/BreakpointDiscoveryTest.php \Drupal\Tests\breakpoint\Kernel\BreakpointDiscoveryTest::testBreakpointGroups()

Test the collection of breakpoint groups.

File

core/modules/breakpoint/tests/src/Kernel/BreakpointDiscoveryTest.php, line 182

Class

BreakpointDiscoveryTest
Tests discovery of breakpoints provided by themes and modules.

Namespace

Drupal\Tests\breakpoint\Kernel

Code

public function testBreakpointGroups() {
  $expected = [
    'bartik' => 'Bartik',
    'breakpoint_module_test' => 'Breakpoint test module',
    'breakpoint_theme_test' => 'Breakpoint test theme',
    'breakpoint_theme_test.group2' => 'breakpoint_theme_test.group2',
  ];
  $breakpoint_groups = \Drupal::service('breakpoint.manager')
    ->getGroups();

  // Ensure the order is as expected. Should be sorted by label.
  $this
    ->assertIdentical($expected, $this
    ->castSafeStrings($breakpoint_groups));
  $expected = [
    'breakpoint_theme_test' => 'theme',
    'breakpoint_module_test' => 'module',
  ];
  $breakpoint_group_providers = \Drupal::service('breakpoint.manager')
    ->getGroupProviders('breakpoint_theme_test.group2');
  $this
    ->assertEqual($expected, $breakpoint_group_providers);
}