diff core/tests/Drupal/Tests/Component/Annotation/AnnotationBaseTest.php @ 0:c75dbcec494b

Initial commit from drush-created site
author Chris Cannam
date Thu, 05 Jul 2018 14:24:15 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/core/tests/Drupal/Tests/Component/Annotation/AnnotationBaseTest.php	Thu Jul 05 14:24:15 2018 +0000
@@ -0,0 +1,55 @@
+<?php
+
+namespace Drupal\Tests\Component\Annotation;
+
+use Drupal\Component\Annotation\AnnotationBase;
+use PHPUnit\Framework\TestCase;
+
+/**
+ * @coversDefaultClass \Drupal\Component\Annotation\AnnotationBase
+ * @group Annotation
+ */
+class AnnotationBaseTest extends TestCase {
+
+  /**
+   * @covers ::getProvider
+   * @covers ::setProvider
+   */
+  public function testSetProvider() {
+    $plugin = new AnnotationBaseStub();
+    $plugin->setProvider('example');
+    $this->assertEquals('example', $plugin->getProvider());
+  }
+
+  /**
+   * @covers ::getId
+   */
+  public function testGetId() {
+    $plugin = new AnnotationBaseStub();
+    // Doctrine sets the public prop directly.
+    $plugin->id = 'example';
+    $this->assertEquals('example', $plugin->getId());
+  }
+
+  /**
+   * @covers ::getClass
+   * @covers ::setClass
+   */
+  public function testSetClass() {
+    $plugin = new AnnotationBaseStub();
+    $plugin->setClass('example');
+    $this->assertEquals('example', $plugin->getClass());
+  }
+
+}
+/**
+ * {@inheritdoc}
+ */
+class AnnotationBaseStub extends AnnotationBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function get() {}
+
+}