You are here

public function PluginIdTest::testGet in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Component/Annotation/PluginIdTest.php \Drupal\Tests\Component\Annotation\PluginIdTest::testGet()

@covers ::get

File

core/tests/Drupal/Tests/Component/Annotation/PluginIdTest.php, line 17

Class

PluginIdTest
@coversDefaultClass \Drupal\Component\Annotation\PluginId @group Annotation

Namespace

Drupal\Tests\Component\Annotation

Code

public function testGet() {

  // Assert plugin starts empty.
  $plugin = new PluginID();
  $this
    ->assertEquals([
    'id' => NULL,
    'class' => NULL,
    'provider' => NULL,
  ], $plugin
    ->get());

  // Set values and ensure we can retrieve them.
  $plugin->value = 'foo';
  $plugin
    ->setClass('bar');
  $plugin
    ->setProvider('baz');
  $this
    ->assertEquals([
    'id' => 'foo',
    'class' => 'bar',
    'provider' => 'baz',
  ], $plugin
    ->get());
}