public function BreakpointDiscoveryTest::testCustomBreakpointGroups in Drupal 10
Same name and namespace in other branches
- 8 core/modules/breakpoint/tests/src/Kernel/BreakpointDiscoveryTest.php \Drupal\Tests\breakpoint\Kernel\BreakpointDiscoveryTest::testCustomBreakpointGroups()
- 9 core/modules/breakpoint/tests/src/Kernel/BreakpointDiscoveryTest.php \Drupal\Tests\breakpoint\Kernel\BreakpointDiscoveryTest::testCustomBreakpointGroups()
Tests the custom breakpoint group provided by a theme and a module.
File
- core/
modules/ breakpoint/ tests/ src/ Kernel/ BreakpointDiscoveryTest.php, line 98
Class
- BreakpointDiscoveryTest
- Tests discovery of breakpoints provided by themes and modules.
Namespace
Drupal\Tests\breakpoint\KernelCode
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
->assertEquals($expected_breakpoint, $breakpoints[$id]
->getPluginDefinition());
}
}