public function BreakpointThemeTest::testThemeBreakpointGroup

Test the breakpoints defined by the custom group.

File

drupal/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointThemeTest.php, line 68
Definition of Drupal\breakpoint\Tests\BreakpointsThemeTest.

Class

BreakpointThemeTest
Test breakpoints provided by themes.

Namespace

Drupal\breakpoint\Tests

Code

public function testThemeBreakpointGroup() {

  // Verify the breakpoint group 'test' was created by breakpoint_test_theme.
  $breakpoint_group_obj = entity_create('breakpoint_group', array(
    'label' => 'Test Theme',
    'name' => 'test',
    'sourceType' => Breakpoint::SOURCE_TYPE_THEME,
    'source' => 'breakpoint_test_theme',
    'id' => Breakpoint::SOURCE_TYPE_THEME . '.breakpoint_test_theme.test',
  ));
  $breakpoint_group_obj->breakpoints = array(
    'theme.breakpoint_test_theme.mobile' => array(
      '1.5x',
      '2.x',
    ),
    'theme.breakpoint_test_theme.narrow' => array(),
    'theme.breakpoint_test_theme.wide' => array(),
  );

  // Verify we can load this breakpoint defined by the theme.
  $this
    ->verifyBreakpointGroup($breakpoint_group_obj);

  // Disable the test theme and verify the breakpoint group is deleted.
  theme_disable(array(
    'breakpoint_test_theme',
  ));
  $this
    ->assertFalse(entity_load('breakpoint_group', $breakpoint_group_obj
    ->id()), 'breakpoint_group_load: Loading a deleted breakpoint group returns false.', 'Breakpoint API');
}