function AreaEntityTest::testEntityArea

Same name in other branches
  1. 9 core/modules/views/tests/src/Kernel/Handler/AreaEntityTest.php \Drupal\Tests\views\Kernel\Handler\AreaEntityTest::testEntityArea()
  2. 8.9.x core/modules/views/tests/src/Kernel/Handler/AreaEntityTest.php \Drupal\Tests\views\Kernel\Handler\AreaEntityTest::testEntityArea()
  3. 10 core/modules/views/tests/src/Kernel/Handler/AreaEntityTest.php \Drupal\Tests\views\Kernel\Handler\AreaEntityTest::testEntityArea()

Tests the area handler.

File

core/modules/views/tests/src/Kernel/Handler/AreaEntityTest.php, line 91

Class

AreaEntityTest
Tests the generic entity area handler.

Namespace

Drupal\Tests\views\Kernel\Handler

Code

public function testEntityArea() : void {
    
    /** @var \Drupal\Core\Entity\EntityInterface[] $entities */
    $entities = [];
    for ($i = 0; $i < 3; $i++) {
        $random_label = $this->randomMachineName();
        $data = [
            'bundle' => 'entity_test',
            'name' => $random_label,
        ];
        $entity_test = $this->container
            ->get('entity_type.manager')
            ->getStorage('entity_test')
            ->create($data);
        $uuid_map[0] = 'aa0c61cb-b7bb-4795-972a-493dabcf529c';
        $uuid_map[1] = '62cef0ff-6f30-4f7a-b9d6-a8ed5a3a6bf3';
        $uuid_map[2] = '3161d6e9-3326-4719-b513-8fa68a731ba2';
        $entity_test->uuid->value = $uuid_map[$i];
        $entity_test->save();
        $entities[] = $entity_test;
        \Drupal::state()->set('entity_test_entity_access.view.' . $entity_test->id(), $i != 2);
    }
    $this->doTestCalculateDependencies();
    $this->doTestRender($entities);
}

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