You are here

protected function BlazyUnitTestTrait::getDataBreakpoints in Blazy 8

Add partially empty data for breakpoints.

Parameters

string $clean: The flag for clean breakpoints.

Return value

array The dummy breakpoints.

7 calls to BlazyUnitTestTrait::getDataBreakpoints()
BlazyAdminFormatterUnitTest::testGetSettingsSummary in tests/src/Unit/Form/BlazyAdminFormatterUnitTest.php
Tests the Blazy admin ::getSettingsSummary().
BlazyFormatterTest::testBlazyFormatterMethods in tests/src/Kernel/BlazyFormatterTest.php
Tests the Blazy formatter methods.
BlazyManagerTest::providerBuildAttributes in tests/src/Kernel/BlazyManagerTest.php
Provider for ::testBuildAttributes.
BlazyManagerTest::testBlazyManagerMethods in tests/src/Kernel/BlazyManagerTest.php
Tests cases for various methods.
BlazyManagerUnitTest::providerTestCleanUpBreakpoints in tests/src/Unit/BlazyManagerUnitTest.php
Provider for ::testCleanUpBreakpoints().

... See full list

File

tests/src/Traits/BlazyUnitTestTrait.php, line 48

Class

BlazyUnitTestTrait
A Trait common for Blazy Unit tests.

Namespace

Drupal\Tests\blazy\Traits

Code

protected function getDataBreakpoints($clean = FALSE) {
  $build = [];
  $widths = [
    'xs' => 210,
    'sm' => 1024,
    'md' => 1900,
  ];
  $styles = [
    'xs' => 'blazy_crop',
    'sm' => 'blazy_crop',
    'md' => 'blazy_crop',
  ];
  foreach (BlazyDefault::getConstantBreakpoints() as $breakpoint) {
    if ($clean && (!isset($styles[$breakpoint]) || !isset($widths[$breakpoint]))) {
      continue;
    }
    $build[$breakpoint]['image_style'] = isset($styles[$breakpoint]) ? $styles[$breakpoint] : '';
    $build[$breakpoint]['width'] = isset($widths[$breakpoint]) ? $widths[$breakpoint] : '';
  }
  return $build;
}