You are here

public function BreakpointThemeTest::testThemeBreakpointGroup in Breakpoints 8

Test the breakpoints defined by the custom group.

File

lib/Drupal/breakpoint/Tests/BreakpointThemeTest.php, line 100
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',
    'id' => 'test',
    'sourceType' => Breakpoint::SOURCE_TYPE_THEME,
    'source' => 'breakpoint_test_theme',
    'overridden' => FALSE,
  ));
  $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', 'test'), t('breakpoint_group_load: Loading a deleted breakpoint group returns false.'), t('Breakpoints API'));
}