function EntityTest::testValidateArgumentNoAccess

Same name and namespace in other branches
  1. 9 core/modules/views/tests/src/Unit/Plugin/argument_validator/EntityTest.php \Drupal\Tests\views\Unit\Plugin\argument_validator\EntityTest::testValidateArgumentNoAccess()
  2. 8.9.x core/modules/views/tests/src/Unit/Plugin/argument_validator/EntityTest.php \Drupal\Tests\views\Unit\Plugin\argument_validator\EntityTest::testValidateArgumentNoAccess()
  3. 11.x core/modules/views/tests/src/Unit/Plugin/argument_validator/EntityTest.php \Drupal\Tests\views\Unit\Plugin\argument_validator\EntityTest::testValidateArgumentNoAccess()

Tests the validate argument method with no access and bundles.

See also

\Drupal\views\Plugin\views\argument_validator\Entity::validateArgument()

File

core/modules/views/tests/src/Unit/Plugin/argument_validator/EntityTest.php, line 126

Class

EntityTest
@coversDefaultClass \Drupal\views\Plugin\views\argument_validator\Entity[[api-linebreak]] @group views

Namespace

Drupal\Tests\views\Unit\Plugin\argument_validator

Code

public function testValidateArgumentNoAccess() : void {
  $options = [];
  $options['access'] = FALSE;
  $options['bundles'] = [];
  $this->argumentValidator
    ->init($this->executable, $this->display, $options);
  $this->assertFalse($this->argumentValidator
    ->validateArgument(3));
  $this->assertFalse($this->argumentValidator
    ->validateArgument(''));
  $this->assertFalse($this->argumentValidator
    ->validateArgument(NULL));
  $this->assertTrue($this->argumentValidator
    ->validateArgument(1));
  $this->assertTrue($this->argumentValidator
    ->validateArgument(2));
  $this->assertFalse($this->argumentValidator
    ->validateArgument('1,2'));
}

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