function ThemeExtensionListTest::providerTestGetBaseThemes

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Extension/ThemeExtensionListTest.php \Drupal\Tests\Core\Extension\ThemeExtensionListTest::providerTestGetBaseThemes()

Provides test data for testGetBaseThemes.

Return value

array An array of theme test data.

File

core/tests/Drupal/Tests/Core/Extension/ThemeExtensionListTest.php, line 140

Class

ThemeExtensionListTest
@coversDefaultClass \Drupal\Core\Extension\ThemeExtensionList @group Extension

Namespace

Drupal\Tests\Core\Extension

Code

public function providerTestGetBaseThemes() {
    $data = [];
    // Tests a theme without any base theme.
    $themes = [];
    $themes['test_1'] = (object) [
        'name' => 'test_1',
        'info' => [
            'name' => 'test_1',
        ],
    ];
    $data[] = [
        $themes,
        'test_1',
        [],
    ];
    // Tests a theme with a non existing base theme.
    $themes = [];
    $themes['test_1'] = (object) [
        'name' => 'test_1',
        'info' => [
            'name' => 'test_1',
            'base theme' => 'test_2',
        ],
    ];
    $data[] = [
        $themes,
        'test_1',
        [
            'test_2' => NULL,
        ],
    ];
    // Tests a theme with a single existing base theme.
    $themes = [];
    $themes['test_1'] = (object) [
        'name' => 'test_1',
        'info' => [
            'name' => 'test_1',
            'base theme' => 'test_2',
        ],
    ];
    $themes['test_2'] = (object) [
        'name' => 'test_2',
        'info' => [
            'name' => 'test_2',
        ],
    ];
    $data[] = [
        $themes,
        'test_1',
        [
            'test_2' => 'test_2',
        ],
    ];
    // Tests a theme with multiple base themes.
    $themes = [];
    $themes['test_1'] = (object) [
        'name' => 'test_1',
        'info' => [
            'name' => 'test_1',
            'base theme' => 'test_2',
        ],
    ];
    $themes['test_2'] = (object) [
        'name' => 'test_2',
        'info' => [
            'name' => 'test_2',
            'base theme' => 'test_3',
        ],
    ];
    $themes['test_3'] = (object) [
        'name' => 'test_3',
        'info' => [
            'name' => 'test_3',
        ],
    ];
    $data[] = [
        $themes,
        'test_1',
        [
            'test_2' => 'test_2',
            'test_3' => 'test_3',
        ],
    ];
    return $data;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.