diff --git a/core/tests/Drupal/Tests/Component/Annotation/PluginTest.php b/core/tests/Drupal/Tests/Component/Annotation/PluginTest.php new file mode 100644 index 0000000..4a905e5 --- /dev/null +++ b/core/tests/Drupal/Tests/Component/Annotation/PluginTest.php @@ -0,0 +1,93 @@ +annotationValue = [ + 'id' => $this->randomMachineName(), + 'class' => $this->getMockClass('\stdClass'), + 'provider' => $this->randomMachineName(), + ]; + + $this->sut = new Plugin($this->annotationValue); + } + + /** + * @covers ::__construct + * @covers ::parse + */ + public function testConstruct() { + $this->sut = new Plugin($this->annotationValue); + } + + /** + * @covers ::get + */ + public function testGet() { + $this->assertNotNull($this->sut->get()); + } + + /** + * @covers ::getId + */ + public function testGetId() { + $this->assertSame($this->annotationValue['id'], $this->sut->getId()); + } + + /** + * @covers ::getClass + * @covers ::setClass + */ + public function testGetClass() { + $this->assertSame($this->annotationValue['class'], $this->sut->getClass()); + $class = $this->getMockClass('\stdClass'); + $this->sut->setClass($class); + $this->assertSame($class, $this->sut->getClass()); + } + + /** + * @covers ::getProvider + * @covers ::setProvider + */ + public function testGetProvider() { + $this->assertSame($this->annotationValue['provider'], $this->sut->getProvider()); + $provider = $this->randomMachineName(); + $this->sut->setProvider($provider); + $this->assertSame($provider, $this->sut->getProvider()); + } + +}