You are here

public function BreakpointDiscoveryTest::testBreakpointGroups in Drupal 10

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

Tests the collection of breakpoint groups.

File

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

Class

BreakpointDiscoveryTest
Tests discovery of breakpoints provided by themes and modules.

Namespace

Drupal\Tests\breakpoint\Kernel

Code

public function testBreakpointGroups() {
  $expected = [
    'olivero' => 'Olivero',
    '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
    ->assertEquals($expected, $breakpoint_groups);
  $expected = [
    'breakpoint_theme_test' => 'theme',
    'breakpoint_module_test' => 'module',
  ];
  $breakpoint_group_providers = \Drupal::service('breakpoint.manager')
    ->getGroupProviders('breakpoint_theme_test.group2');
  $this
    ->assertEquals($expected, $breakpoint_group_providers);
}