You are here

public function EntityStorageBaseTest::testLoad in Drupal 10

@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));
}