function EntityStorageBaseTest::testLoad

Same name in other branches
  1. 10 core/tests/Drupal/Tests/Core/Entity/EntityStorageBaseTest.php \Drupal\Tests\Core\Entity\EntityStorageBaseTest::testLoad()
  2. 11.x core/tests/Drupal/Tests/Core/Entity/EntityStorageBaseTest.php \Drupal\Tests\Core\Entity\EntityStorageBaseTest::testLoad()

@covers ::load

@dataProvider providerLoad

File

core/tests/Drupal/Tests/Core/Entity/EntityStorageBaseTest.php, line 59

Class

EntityStorageBaseTest
@coversDefaultClass \Drupal\Core\Entity\EntityStorageBase @group Entity

Namespace

Drupal\Tests\Core\Entity

Code

public function testLoad($expected, $entity_fixture, $query) {
    $mock_base = $this->getMockBuilder('\\Drupal\\Core\\Entity\\EntityStorageBase')
        ->disableOriginalConstructor()
        ->onlyMethods([
        'loadMultiple',
    ])
        ->getMockForAbstractClass();
    // load() always calls loadMultiple().
    $mock_base->expects($this->once())
        ->method('loadMultiple')
        ->with([
        $query,
    ])
        ->willReturn($entity_fixture);
    $this->assertEquals($expected, $mock_base->load($query));
}

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