public function BreakpointThemeTest::testThemeBreakpoints

Test the breakpoints provided by a theme.

File

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

Class

BreakpointThemeTest
Test breakpoints provided by themes.

Namespace

Drupal\breakpoint\Tests

Code

public function testThemeBreakpoints() {

  // Verify the breakpoint group for breakpoint_test_theme was created.
  $breakpoint_group_obj = entity_create('breakpoint_group', array(
    'label' => 'Breakpoint test theme',
    'name' => 'breakpoint_test_theme',
    'source' => 'breakpoint_test_theme',
    'sourceType' => Breakpoint::SOURCE_TYPE_THEME,
    'id' => Breakpoint::SOURCE_TYPE_THEME . '.breakpoint_test_theme.breakpoint_test_theme',
  ));
  $breakpoint_group_obj->breakpoints = array(
    'theme.breakpoint_test_theme.mobile' => array(),
    'theme.breakpoint_test_theme.narrow' => array(),
    'theme.breakpoint_test_theme.wide' => array(),
    'theme.breakpoint_test_theme.tv' => 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');
}