function VariantCollectionTraitTest::testGetVariantException

Same name in other branches
  1. 4.0.x tests/src/Unit/VariantCollectionTraitTest.php \Drupal\Tests\ctools\Unit\VariantCollectionTraitTest::testGetVariantException()

@covers ::getVariant

@depends testRemoveVariant

File

tests/src/Unit/VariantCollectionTraitTest.php, line 149

Class

VariantCollectionTraitTest
Tests the methods of a variant-aware class.

Namespace

Drupal\Tests\ctools\Unit

Code

public function testGetVariantException($data) {
    [
        $trait_object,
        $uuid,
    ] = $data;
    // Attempt to retrieve a variant that has been removed.
    $this->expectException('\\Drupal\\Component\\Plugin\\Exception\\PluginNotFoundException');
    $this->expectExceptionMessage("Plugin ID 'test-uuid' was not found.");
    $this->assertNull($trait_object->getVariant($uuid));
}