public function PluginIdTest::testGet in Drupal 8
Same name and namespace in other branches
- 9 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\AnnotationCode
public function testGet() {
// Assert plugin starts empty regardless of constructor.
$plugin = new PluginID([
'foo' => 'bar',
'biz' => [
'baz' => 'boom',
],
'nestedAnnotation' => new PluginID([
'foo' => 'bar',
]),
'value' => 'biz',
]);
$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());
}