You are here

public function ThemeHandlerTest::providerTestGetBaseThemes in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php \Drupal\Tests\Core\Extension\ThemeHandlerTest::providerTestGetBaseThemes()

Provides test data for testGetBaseThemes.

Return value

array An array of theme test data.

File

core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php, line 220
Contains \Drupal\Tests\Core\Extension\ThemeHandlerTest.

Class

ThemeHandlerTest
@coversDefaultClass \Drupal\Core\Extension\ThemeHandler @group Extension

Namespace

Drupal\Tests\Core\Extension

Code

public function providerTestGetBaseThemes() {
  $data = array();

  // Tests a theme without any base theme.
  $themes = array();
  $themes['test_1'] = (object) array(
    'name' => 'test_1',
    'info' => array(
      'name' => 'test_1',
    ),
  );
  $data[] = array(
    $themes,
    'test_1',
    array(),
  );

  // Tests a theme with a non existing base theme.
  $themes = array();
  $themes['test_1'] = (object) array(
    'name' => 'test_1',
    'info' => array(
      'name' => 'test_1',
      'base theme' => 'test_2',
    ),
  );
  $data[] = array(
    $themes,
    'test_1',
    array(
      'test_2' => NULL,
    ),
  );

  // Tests a theme with a single existing base theme.
  $themes = array();
  $themes['test_1'] = (object) array(
    'name' => 'test_1',
    'info' => array(
      'name' => 'test_1',
      'base theme' => 'test_2',
    ),
  );
  $themes['test_2'] = (object) array(
    'name' => 'test_2',
    'info' => array(
      'name' => 'test_2',
    ),
  );
  $data[] = array(
    $themes,
    'test_1',
    array(
      'test_2' => 'test_2',
    ),
  );

  // Tests a theme with multiple base themes.
  $themes = array();
  $themes['test_1'] = (object) array(
    'name' => 'test_1',
    'info' => array(
      'name' => 'test_1',
      'base theme' => 'test_2',
    ),
  );
  $themes['test_2'] = (object) array(
    'name' => 'test_2',
    'info' => array(
      'name' => 'test_2',
      'base theme' => 'test_3',
    ),
  );
  $themes['test_3'] = (object) array(
    'name' => 'test_3',
    'info' => array(
      'name' => 'test_3',
    ),
  );
  $data[] = array(
    $themes,
    'test_1',
    array(
      'test_2' => 'test_2',
      'test_3' => 'test_3',
    ),
  );
  return $data;
}