function IconPackManagerKernelTest::testGetIcons

Test the IconPackManager::getIcons method.

File

core/tests/Drupal/KernelTests/Core/Theme/Icon/IconPackManagerKernelTest.php, line 87

Class

IconPackManagerKernelTest
@coversDefaultClass \Drupal\Core\Theme\Icon\Plugin\IconPackManager

Namespace

Drupal\KernelTests\Core\Theme\Icon

Code

public function testGetIcons() : void {
    $icons = $this->pluginManagerIconPack
        ->getIcons();
    $this->assertCount(self::EXPECTED_TOTAL_TEST_ICONS, $icons);
    foreach ($icons as $icon) {
        $this->assertArrayHasKey('source', $icon);
        $this->assertArrayHasKey('group', $icon);
    }
    $icons = $this->pluginManagerIconPack
        ->getIcons([
        'test_minimal',
    ]);
    $this->assertCount(1, $icons);
    foreach ($icons as $icon) {
        $this->assertArrayHasKey('source', $icon);
        $this->assertArrayHasKey('group', $icon);
    }
    $icons = $this->pluginManagerIconPack
        ->getIcons([
        'do_not_exist',
    ]);
    $this->assertEmpty($icons);
}

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