You are here

public function BreakpointDiscoveryTest::testModuleBreakpoints in Drupal 9

Same name and namespace in other branches
  1. 8 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()

Tests the breakpoint group created for a module.

File

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

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
    ->assertEquals(array_keys($expected_breakpoints), array_keys($breakpoints));
}