You are here

public function ExtraFieldManagerBaseTest::testSupportedEntityBundles in Extra Field 8.2

@covers ::supportedEntityBundles

@dataProvider supportedEntityBundlesProvider

File

tests/src/Unit/ExtraFieldManagerBaseTest.php, line 132

Class

ExtraFieldManagerBaseTest
@coversDefaultClass \Drupal\extra_field\Plugin\ExtraFieldManagerBase

Namespace

Drupal\Tests\extra_field\Unit

Code

public function testSupportedEntityBundles($entityBundleKeys, $result) {
  $this->baseManager
    ->expects($this
    ->any())
    ->method('getEntityBundleType')
    ->will($this
    ->returnValueMap([
    [
      'without_bundles',
      NULL,
    ],
    [
      'node',
      'node_type',
    ],
  ]));
  $this->baseManager
    ->expects($this
    ->any())
    ->method('getEntityBundles')
    ->will($this
    ->returnValueMap([
    [
      'node_type',
      [
        'article' => 'article',
        'page' => 'page',
      ],
    ],
  ]));
  $supportedEntityBundles = self::callMethod($this->baseManager, 'supportedEntityBundles', [
    $entityBundleKeys,
  ]);
  $this
    ->assertEquals($result, $supportedEntityBundles);
}