AnnotationBaseTest.php

Same filename in other branches
  1. 8.9.x core/tests/Drupal/Tests/Component/Annotation/AnnotationBaseTest.php
  2. 10 core/tests/Drupal/Tests/Component/Annotation/AnnotationBaseTest.php
  3. 11.x core/tests/Drupal/Tests/Component/Annotation/AnnotationBaseTest.php

Namespace

Drupal\Tests\Component\Annotation

File

core/tests/Drupal/Tests/Component/Annotation/AnnotationBaseTest.php

View source
<?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() {
    }

}

Classes

Title Deprecated Summary
AnnotationBaseStub
AnnotationBaseTest @coversDefaultClass \Drupal\Component\Annotation\AnnotationBase @group Annotation

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