You are here

class EditableTest in Views Node Access Filter 8

Test file.

@group views_node_access_filter

Hierarchy

Expanded class hierarchy of EditableTest

File

tests/src/Unit/EditableTest.php, line 13

Namespace

Drupal\Tests\views_node_access_filter\Unit
View source
class EditableTest extends UnitTestCase {

  /**
   * The views filter plugin.
   *
   * @var \Drupal\views_node_access_filter\Plugin\views\filter\Editable
   */
  private $plugin;

  /**
   * {@inheritdoc}
   */
  protected function setUp() : void {
    parent::setUp();
    $this->plugin = new Editable([], 'foo', []);
  }

  /**
   * Ensure the plugin has no query.
   */
  public function testQuery() {
    $this
      ->expectException(\Exception::class);
    $this->plugin
      ->query();
  }

  /**
   * Ensure user cache context.
   */
  public function testGetCacheContexts() {
    $this
      ->assertContains('user', $this->plugin
      ->getCacheContexts());
  }

  /**
   * Ensure the filter cannot be exposed.
   */
  public function testCanExpose() {
    $this
      ->assertFalse($this->plugin
      ->canExpose());
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EditableTest::$plugin private property The views filter plugin.
EditableTest::setUp protected function Overrides UnitTestCase::setUp
EditableTest::testCanExpose public function Ensure the filter cannot be exposed.
EditableTest::testGetCacheContexts public function Ensure user cache context.
EditableTest::testQuery public function Ensure the plugin has no query.
PhpunitCompatibilityTrait::getMock Deprecated public function Returns a mock object for the specified class using the available method.
PhpunitCompatibilityTrait::setExpectedException Deprecated public function Compatibility layer for PHPUnit 6 to support PHPUnit 4 code.
UnitTestCase::$randomGenerator protected property The random generator.
UnitTestCase::$root protected property The app root. 1
UnitTestCase::assertArrayEquals protected function Asserts if two arrays are equal by sorting them first.
UnitTestCase::getBlockMockWithMachineName Deprecated protected function Mocks a block with a block plugin. 1
UnitTestCase::getClassResolverStub protected function Returns a stub class resolver.
UnitTestCase::getConfigFactoryStub public function Returns a stub config factory that behaves according to the passed array.
UnitTestCase::getConfigStorageStub public function Returns a stub config storage that returns the supplied configuration.
UnitTestCase::getContainerWithCacheTagsInvalidator protected function Sets up a container with a cache tags invalidator.
UnitTestCase::getRandomGenerator protected function Gets the random generator for the utility methods.
UnitTestCase::getStringTranslationStub public function Returns a stub translation manager that just returns the passed string.
UnitTestCase::randomMachineName public function Generates a unique random string containing letters and numbers.