function FieldStorageConfigAccessControlHandlerTest::assertAllowOperations

Same name in other branches
  1. 9 core/modules/field/tests/src/Unit/FieldStorageConfigAccessControlHandlerTest.php \Drupal\Tests\field\Unit\FieldStorageConfigAccessControlHandlerTest::assertAllowOperations()
  2. 8.9.x core/modules/field/tests/src/Unit/FieldStorageConfigAccessControlHandlerTest.php \Drupal\Tests\field\Unit\FieldStorageConfigAccessControlHandlerTest::assertAllowOperations()
  3. 10 core/modules/field/tests/src/Unit/FieldStorageConfigAccessControlHandlerTest.php \Drupal\Tests\field\Unit\FieldStorageConfigAccessControlHandlerTest::assertAllowOperations()

Assert method to verify the access by operations.

@internal

Parameters

array $allow_operations: A list of allowed operations.

\Drupal\Core\Session\AccountInterface $user: The account to use for get access.

2 calls to FieldStorageConfigAccessControlHandlerTest::assertAllowOperations()
FieldConfigAccessControlHandlerTest::testAccess in core/modules/field/tests/src/Unit/FieldConfigAccessControlHandlerTest.php
Ensures field config access is working properly.
FieldStorageConfigAccessControlHandlerTest::testAccess in core/modules/field/tests/src/Unit/FieldStorageConfigAccessControlHandlerTest.php
Ensures field storage config access is working properly.

File

core/modules/field/tests/src/Unit/FieldStorageConfigAccessControlHandlerTest.php, line 168

Class

FieldStorageConfigAccessControlHandlerTest
Tests the field storage config access controller.

Namespace

Drupal\Tests\field\Unit

Code

public function assertAllowOperations(array $allow_operations, AccountInterface $user) : void {
    foreach ([
        'view',
        'update',
        'delete',
    ] as $operation) {
        $expected = in_array($operation, $allow_operations);
        $actual = $this->accessControlHandler
            ->access($this->entity, $operation, $user);
        $this->assertSame($expected, $actual, "Access problem with '{$operation}' operation.");
    }
}

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