You are here

public function CustomAccessTest::testInvalidOperation in Field Permissions 8

Same name and namespace in other branches
  1. 8.2 tests/src/Unit/Plugin/FieldPermissionType/CustomAccessTest.php \Drupal\Tests\field_permissions\Unit\Plugin\FieldPermissionType\CustomAccessTest::testInvalidOperation()

Test an invalid operation.

@covers ::hasFieldAccess

File

tests/src/Unit/Plugin/FieldPermissionType/CustomAccessTest.php, line 57

Class

CustomAccessTest
Tests for the custom access permission type plugin.

Namespace

Drupal\Tests\field_permissions\Unit\Plugin\FieldPermissionType

Code

public function testInvalidOperation() {

  // Edit|view access allowed.
  $account = $this
    ->prophesize(AccountInterface::class);
  $entity = $this
    ->prophesize(EntityInterface::class);
  $this
    ->expectException(\AssertionError::class, 'The operation is either "edit" or "view", "bad operation" given instead.');
  $this->plugin
    ->hasFieldAccess('bad operation', $entity
    ->reveal(), $account
    ->reveal());
}