You are here

public function FieldHelper::getEntityTypeBundleInfoMock in Feeds Paragraphs 8

Return value

EntityTypeBundleInfoInterface

File

tests/src/Unit/Helpers/FieldHelper.php, line 204

Class

FieldHelper

Namespace

Drupal\Tests\feeds_para_mapper\Unit\Helpers

Code

public function getEntityTypeBundleInfoMock() {
  $bundleInfo = $this->prophet
    ->prophesize(EntityTypeBundleInfoInterface::class);
  $that = $this;
  $bundleInfo
    ->getBundleInfo(Argument::type('string'))
    ->will(function ($args) use ($that) {
    if ($args[0] === 'paragraph') {
      $bundles = [];
      foreach ($that->bundles as $bundle) {
        $bundles[$bundle]['name'] = $bundle;
        $bundles[$bundle]['label'] = $bundle;
      }
      return $bundles;
    }
    return null;
  });
  return $bundleInfo
    ->reveal();
}