function BreakpointDiscoveryTest::testModuleBreakpoints

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

Test the breakpoint group created for a module.

File

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

Class

BreakpointDiscoveryTest
Tests discovery of breakpoints provided by themes and modules.

Namespace

Drupal\Tests\breakpoint\Kernel

Code

public function testModuleBreakpoints() {
    $expected_breakpoints = [
        'breakpoint_module_test.mobile' => [
            'label' => 'mobile',
            'mediaQuery' => '(min-width: 0px)',
            'weight' => 0,
            'multipliers' => [
                '1x',
            ],
            'provider' => 'breakpoint_module_test',
            'id' => 'breakpoint_module_test.mobile',
            'group' => 'breakpoint_module_test',
            'class' => 'Drupal\\breakpoint\\Breakpoint',
        ],
        'breakpoint_module_test.standard' => [
            'label' => 'standard',
            'mediaQuery' => '(min-width: 560px)',
            'weight' => 1,
            'multipliers' => [
                '1x',
                '2x',
            ],
            'provider' => 'breakpoint_module_test',
            'id' => 'breakpoint_module_test.standard',
            'group' => 'breakpoint_module_test',
            'class' => 'Drupal\\breakpoint\\Breakpoint',
        ],
    ];
    $breakpoints = \Drupal::service('breakpoint.manager')->getBreakpointsByGroup('breakpoint_module_test');
    $this->assertEqual(array_keys($expected_breakpoints), array_keys($breakpoints));
}

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