function BreakpointDiscoveryTest::testBreakpointGroups

Same name in other branches
  1. 9 core/modules/breakpoint/tests/src/Kernel/BreakpointDiscoveryTest.php \Drupal\Tests\breakpoint\Kernel\BreakpointDiscoveryTest::testBreakpointGroups()
  2. 8.9.x core/modules/breakpoint/tests/src/Kernel/BreakpointDiscoveryTest.php \Drupal\Tests\breakpoint\Kernel\BreakpointDiscoveryTest::testBreakpointGroups()
  3. 11.x 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 189

Class

BreakpointDiscoveryTest
Tests discovery of breakpoints provided by themes and modules.

Namespace

Drupal\Tests\breakpoint\Kernel

Code

public function testBreakpointGroups() : void {
    $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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.