You are here

function DefaultPluginTypeOperationsProviderTest::testCreate in Plugin 8.2

@covers ::create @covers ::__construct

File

tests/src/Unit/PluginType/DefaultPluginTypeOperationsProviderTest.php, line 55

Class

DefaultPluginTypeOperationsProviderTest
@coversDefaultClass \Drupal\plugin\PluginType\DefaultPluginTypeOperationsProvider

Namespace

Drupal\Tests\plugin\Unit\PluginType

Code

function testCreate() {
  $container = $this
    ->createMock(ContainerInterface::class);
  $map = [];
  foreach ($this->services as $service_id => $service) {
    $map[] = [
      $service_id,
      ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE,
      $service,
    ];
  }
  $container
    ->expects($this
    ->any())
    ->method('get')
    ->willReturnMap($map);

  /** @var \Drupal\plugin\PluginType\DefaultPluginTypeOperationsProvider $sut_class */
  $sut_class = get_class($this->sut);
  $sut = $sut_class::create($container);
  $this
    ->assertInstanceOf($sut_class, $sut);
}