function BreakpointDiscoveryTest::testCustomBreakpointGroups

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

Test the custom breakpoint group provided by a theme and a module.

File

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

Class

BreakpointDiscoveryTest
Tests discovery of breakpoints provided by themes and modules.

Namespace

Drupal\Tests\breakpoint\Kernel

Code

public function testCustomBreakpointGroups() {
    // Verify the breakpoint group for breakpoint_theme_test.group2 was created.
    $expected_breakpoints = [
        'breakpoint_theme_test.group2.narrow' => [
            'label' => 'narrow',
            'mediaQuery' => '(min-width: 560px)',
            'weight' => 0,
            'multipliers' => [
                '1x',
                '2x',
            ],
            'provider' => 'breakpoint_theme_test',
            'id' => 'breakpoint_theme_test.group2.narrow',
            'group' => 'breakpoint_theme_test.group2',
            'class' => 'Drupal\\breakpoint\\Breakpoint',
        ],
        'breakpoint_theme_test.group2.wide' => [
            'label' => 'wide',
            'mediaQuery' => '(min-width: 851px)',
            'weight' => 1,
            'multipliers' => [
                '1x',
                '2x',
            ],
            'provider' => 'breakpoint_theme_test',
            'id' => 'breakpoint_theme_test.group2.wide',
            'group' => 'breakpoint_theme_test.group2',
            'class' => 'Drupal\\breakpoint\\Breakpoint',
        ],
        'breakpoint_module_test.breakpoint_theme_test.group2.tv' => [
            'label' => 'tv',
            'mediaQuery' => '(min-width: 6000px)',
            'weight' => 2,
            'multipliers' => [
                '1x',
            ],
            'provider' => 'breakpoint_module_test',
            'id' => 'breakpoint_module_test.breakpoint_theme_test.group2.tv',
            'group' => 'breakpoint_theme_test.group2',
            'class' => 'Drupal\\breakpoint\\Breakpoint',
        ],
    ];
    $breakpoints = \Drupal::service('breakpoint.manager')->getBreakpointsByGroup('breakpoint_theme_test.group2');
    foreach ($expected_breakpoints as $id => $expected_breakpoint) {
        $this->assertEqual($expected_breakpoint, $breakpoints[$id]->getPluginDefinition());
    }
}

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