public function EntityAccessControlHandlerTest::testHooks in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/system/src/Tests/Entity/EntityAccessControlHandlerTest.php \Drupal\system\Tests\Entity\EntityAccessControlHandlerTest::testHooks()
Tests hook invocations.
File
- core/
modules/ system/ src/ Tests/ Entity/ EntityAccessControlHandlerTest.php, line 149 - Contains \Drupal\system\Tests\Entity\EntityAccessControlHandlerTest.
Class
- EntityAccessControlHandlerTest
- Tests the entity access control handler.
Namespace
Drupal\system\Tests\EntityCode
public function testHooks() {
$state = $this->container
->get('state');
$entity = entity_create('entity_test', array(
'name' => 'test',
));
// Test hook_entity_create_access() and hook_ENTITY_TYPE_create_access().
$entity
->access('create');
$this
->assertEqual($state
->get('entity_test_entity_create_access'), TRUE);
$this
->assertEqual($state
->get('entity_test_entity_test_create_access'), TRUE);
// Test hook_entity_access() and hook_ENTITY_TYPE_access().
$entity
->access('view');
$this
->assertEqual($state
->get('entity_test_entity_access'), TRUE);
$this
->assertEqual($state
->get('entity_test_entity_test_access'), TRUE);
}