function DateFormatAccessControlHandlerTest::testAccess
Same name in other branches
- 9 core/modules/system/tests/src/Kernel/DateFormatAccessControlHandlerTest.php \Drupal\Tests\system\Kernel\DateFormatAccessControlHandlerTest::testAccess()
- 8.9.x core/modules/system/tests/src/Kernel/DateFormatAccessControlHandlerTest.php \Drupal\Tests\system\Kernel\DateFormatAccessControlHandlerTest::testAccess()
- 11.x core/modules/system/tests/src/Kernel/DateFormatAccessControlHandlerTest.php \Drupal\Tests\system\Kernel\DateFormatAccessControlHandlerTest::testAccess()
@covers ::checkAccess @covers ::checkCreateAccess @dataProvider testAccessProvider
File
-
core/
modules/ system/ tests/ src/ Kernel/ DateFormatAccessControlHandlerTest.php, line 54
Class
- DateFormatAccessControlHandlerTest
- @coversDefaultClass \Drupal\system\DateFormatAccessControlHandler @group system
Namespace
Drupal\Tests\system\KernelCode
public function testAccess($permissions, $which_entity, $view_label_access_result, $view_access_result, $update_access_result, $delete_access_result, $create_access_result) : void {
$user = $this->drupalCreateUser($permissions);
$entity_values = $which_entity === 'unlocked' ? [
'locked' => FALSE,
] : [
'locked' => TRUE,
];
$entity_values['id'] = $entity_values['label'] = $this->randomMachineName();
$entity_values['pattern'] = 'Y-m-d';
$entity = DateFormat::create($entity_values);
$entity->save();
static::assertEquals($view_label_access_result, $this->accessControlHandler
->access($entity, 'view label', $user, TRUE));
static::assertEquals($view_access_result, $this->accessControlHandler
->access($entity, 'view', $user, TRUE));
static::assertEquals($update_access_result, $this->accessControlHandler
->access($entity, 'update', $user, TRUE));
static::assertEquals($delete_access_result, $this->accessControlHandler
->access($entity, 'delete', $user, TRUE));
static::assertEquals($create_access_result, $this->accessControlHandler
->createAccess(NULL, $user, [], TRUE));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.