function DevelEntityToArrayTest::setUp

Overrides EntityKernelTestBase::setUp

File

tests/src/Kernel/DevelEntityToArrayTest.php, line 56

Class

DevelEntityToArrayTest
Test Load with References.

Namespace

Drupal\Tests\devel\Kernel

Code

protected function setUp() : void {
    parent::setUp();
    $this->installEntitySchema('entity_test_rev');
    $user = $this->createUser(permissions: [
        'access devel information',
    ], values: [
        'name' => 'test',
    ]);
    
    /** @var \Drupal\Core\Session\AccountProxyInterface $current_user */
    $current_user = $this->container
        ->get('current_user');
    $current_user->setAccount($user);
    // Create a field.
    $this->createEntityReferenceField($this->entityType, $this->bundle, $this->fieldName, 'Field test', $this->referencedEntityType, 'default', [
        'target_bundles' => [
            $this->bundle,
        ],
    ], FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);
}