You are here

public function RabbitHoleBehaviorPluginTest::testPageNotFoundPlugin in Rabbit Hole 8

Same name and namespace in other branches
  1. 2.x tests/src/Functional/RabbitHoleBehaviorPluginTest.php \Drupal\Tests\rabbit_hole\Functional\RabbitHoleBehaviorPluginTest::testPageNotFoundPlugin()

Test the page not found plugin.

File

tests/src/Functional/RabbitHoleBehaviorPluginTest.php, line 117

Class

RabbitHoleBehaviorPluginTest
Test the functionality of the RabbitHoleBehavior plugin.

Namespace

Drupal\Tests\rabbit_hole\Functional

Code

public function testPageNotFoundPlugin() {

  // Check we can create an instance of the plugin.
  $plugin = $this->manager
    ->createInstance('page_not_found', [
    'of' => 'configuration values',
  ]);
  $this
    ->assertInstanceOf(PageNotFound::class, $plugin, 'The page not found plugin is the correct type.');

  // Check that the plugin performs the expected action.
  $this
    ->expectException(NotFoundHttpException::class);
  $plugin
    ->performAction($this->entity);
}