function EntityUnitTest::setupTestLoad

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php \Drupal\Tests\Core\Entity\EntityUnitTest::setupTestLoad()
  2. 8.9.x core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php \Drupal\Tests\Core\Entity\EntityUnitTest::setupTestLoad()
  3. 10 core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php \Drupal\Tests\Core\Entity\EntityUnitTest::setupTestLoad()

Setup for the tests of the ::load() method.

3 calls to EntityUnitTest::setupTestLoad()
EntityUnitTest::testCreate in core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php
@covers ::create
EntityUnitTest::testLoad in core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php
Tests Entity::load().
EntityUnitTest::testLoadMultiple in core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php
Tests Entity::loadMultiple().

File

core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php, line 234

Class

EntityUnitTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Entity%21EntityBase.php/class/EntityBase/11.x" title="Defines a base entity class." class="local">\Drupal\Core\Entity\EntityBase</a> @group Entity @group Access

Namespace

Drupal\Tests\Core\Entity

Code

public function setupTestLoad() {
    // Base our mocked entity on a real entity class so we can test if calling
    // Entity::load() on the base class will bubble up to an actual entity.
    $this->entityTypeId = 'entity_test_mul';
    $methods = get_class_methods(EntityTestMul::class);
    unset($methods[array_search('load', $methods)]);
    unset($methods[array_search('loadMultiple', $methods)]);
    unset($methods[array_search('create', $methods)]);
    $this->entity = $this->getMockBuilder(EntityTestMul::class)
        ->disableOriginalConstructor()
        ->onlyMethods($methods)
        ->getMock();
}

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