class PluginTest

Same name in this branch
  1. 10 core/tests/Drupal/Tests/Component/Annotation/PluginTest.php \Drupal\Tests\Component\Annotation\PluginTest
Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Component/Annotation/PluginTest.php \Drupal\Tests\Component\Annotation\PluginTest
  2. 8.9.x core/tests/Drupal/Tests/Component/Annotation/PluginTest.php \Drupal\Tests\Component\Annotation\PluginTest
  3. 11.x core/tests/Drupal/Tests/Component/Annotation/PluginTest.php \Drupal\Tests\Component\Annotation\PluginTest
  4. 11.x core/tests/Drupal/Tests/Component/Plugin/Attribute/PluginTest.php \Drupal\Tests\Component\Plugin\Attribute\PluginTest

@coversDefaultClass \Drupal\Component\Annotation\Plugin @group Attribute

Hierarchy

  • class \Drupal\Tests\Component\Plugin\Attribute\PluginTest extends \PHPUnit\Framework\TestCase

Expanded class hierarchy of PluginTest

File

core/tests/Drupal/Tests/Component/Plugin/Attribute/PluginTest.php, line 14

Namespace

Drupal\Tests\Component\Plugin\Attribute
View source
class PluginTest extends TestCase {
    
    /**
     * @covers ::__construct
     * @covers ::get
     */
    public function testGet() : void {
        $plugin = new PluginStub(id: 'example', deriver: 'test');
        $plugin->setClass('foo');
        $this->assertEquals([
            'id' => 'example',
            'class' => 'foo',
            'deriver' => 'test',
        ], $plugin->get());
    }
    
    /**
     * @covers ::setProvider
     * @covers ::getProvider
     */
    public function testSetProvider() : void {
        $plugin = new Plugin(id: 'example');
        $plugin->setProvider('example');
        $this->assertEquals('example', $plugin->getProvider());
    }
    
    /**
     * @covers ::getId
     */
    public function testGetId() : void {
        $plugin = new Plugin(id: 'example');
        $this->assertEquals('example', $plugin->getId());
    }
    
    /**
     * @covers ::setClass
     * @covers ::getClass
     */
    public function testSetClass() : void {
        $plugin = new Plugin(id: 'test');
        $plugin->setClass('example');
        $this->assertEquals('example', $plugin->getClass());
    }

}

Members

Title Sort descending Modifiers Object type Summary
PluginTest::testGet public function @covers ::__construct
@covers ::get
PluginTest::testGetId public function @covers ::getId
PluginTest::testSetClass public function @covers ::setClass
@covers ::getClass
PluginTest::testSetProvider public function @covers ::setProvider
@covers ::getProvider

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