You are here

protected function EntityHelper::getStorageMock in Feeds Paragraphs 8

Return value

ObjectProphecy A storage instance.

File

tests/src/Unit/Helpers/EntityHelper.php, line 231

Class

EntityHelper

Namespace

Drupal\Tests\feeds_para_mapper\Unit\Helpers

Code

protected function getStorageMock() {
  $storage = $this->prophet
    ->prophesize(EntityStorageInterface::class);
  $that = $this;
  $storage
    ->create(Argument::type('array'))
    ->will(function ($args) use ($that) {
    $bundle = $args[0]['type'];
    $id = random_int(10, 10);
    return $that
      ->getEntity('paragraph', $bundle, $id)
      ->reveal();
  });
  $storage
    ->load(Argument::any())
    ->will(function ($args) use ($that) {
    $id = $args[0];
    return $that->paragraphs[$id];
  });
  return $storage;
}