function IconExtractorTest::testConstruct

Test the IconExtractor::_construct method.

File

core/tests/Drupal/Tests/Core/Theme/Icon/IconExtractorTest.php, line 41

Class

IconExtractorTest
@coversDefaultClass \Drupal\Core\Theme\Icon\Attribute\IconExtractor

Namespace

Drupal\Tests\Core\Theme\Icon

Code

public function testConstruct() : void {
    $plugin = new IconExtractor('foo', new TranslatableMarkup('Foo'), new TranslatableMarkup('Foo description'), NULL, [
        'bar' => 'baz',
    ]);
    $plugin->setProvider('example');
    $this->assertEquals('example', $plugin->getProvider());
    $this->assertEquals('foo', $plugin->getId());
    $plugin->setClass('\\Drupal\\Foo');
    $this->assertEquals('\\Drupal\\Foo', $plugin->getClass());
    $this->assertEquals('Foo', $plugin->label
        ->getUntranslatedString());
    $this->assertSame('Foo description', $plugin->description
        ->getUntranslatedString());
    $this->assertSame([
        'bar' => 'baz',
    ], $plugin->forms);
}

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