protected function UncacheableQueryAccessTest::setUp in Entity API 8
Overrides EntityKernelTestBase::setUp
File
- tests/
src/ Kernel/ QueryAccess/ UncacheableQueryAccessTest.php, line 51
Class
- UncacheableQueryAccessTest
- Test uncacheable query access filtering for EntityQuery and Views.
Namespace
Drupal\Tests\entity\Kernel\QueryAccessCode
protected function setUp() {
parent::setUp();
$this
->installEntitySchema('entity_test_enhanced_with_owner');
$this
->installConfig([
'entity_module_test',
]);
// Create uid: 1 here so that it's skipped in test cases.
$admin_user = $this
->createUser();
$first_entity = EnhancedEntityWithOwner::create([
'type' => 'first',
'name' => 'First',
'status' => 1,
]);
$first_entity
->save();
$first_entity
->set('name', 'First!');
$first_entity
->set('status', 0);
$first_entity
->setNewRevision(TRUE);
$first_entity
->save();
$second_entity = EnhancedEntityWithOwner::create([
'type' => 'first',
'name' => 'Second',
'status' => 0,
]);
$second_entity
->save();
$second_entity
->set('name', 'Second!');
$second_entity
->set('status', 1);
$second_entity
->setNewRevision(TRUE);
$second_entity
->save();
$third_entity = EnhancedEntityWithOwner::create([
'type' => 'second',
'name' => 'Third',
'status' => 1,
]);
$third_entity
->save();
$third_entity
->set('name', 'Third!');
$third_entity
->setNewRevision(TRUE);
$third_entity
->save();
$this->entities = [
$first_entity,
$second_entity,
$third_entity,
];
$this->storage = $this->entityTypeManager
->getStorage('entity_test_enhanced_with_owner');
}