function HandlerBaseTest::testAccessThrowsExceptionWithAccessCallback

Tests that access throws AccessException when access callback is set.

File

core/modules/views/tests/src/Unit/Plugin/HandlerBaseTest.php, line 102

Class

HandlerBaseTest
Tests Drupal\views\Plugin\views\HandlerBase.

Namespace

Drupal\Tests\views\Unit\Plugin

Code

public function testAccessThrowsExceptionWithAccessCallback() : void {
  $definition = [
    'access callback' => 'test_callback',
  ];
  $handler = new TestHandler([], 'test_handler', $definition);
  $this->expectException(AccessException::class);
  $this->expectExceptionMessage("The 'access callback' key in Views handler definitions is no longer supported in drupal:12.0.0. Use a custom access method on the handler instead.");
  $handler->access($this->createStub(AccountInterface::class));
}

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