MigrateFieldPluginManagerTestClass example


  public function testWeights($field_type$core$expected_plugin_id) {
    /** @var \Drupal\Core\Cache\CacheBackendInterface $cache */
    $cache = $this->prophesize(CacheBackendInterface::class)->reveal();
    /** @var \Drupal\Core\Extension\ModuleHandlerInterfaceModuleHandlerInterface $module_handler */
    $module_handler = $this->prophesize(ModuleHandlerInterface::class)->reveal();
    $discovery = $this->prophesize(AnnotatedClassDiscovery::class);
    $discovery->getDefinitions()->willReturn($this->pluginFixtureData());
    $manager = new MigrateFieldPluginManagerTestClass('field', new \ArrayObject()$cache$module_handler, MigrateField::class$discovery->reveal());
    if (!$expected_plugin_id) {
      $this->expectException(PluginNotFoundException::class);
      $this->expectExceptionMessage(sprintf("Plugin ID '%s' was not found.", $field_type));
    }
    $actual_plugin_id = $manager->getPluginIdFromFieldType($field_type['core' => $core]);
    $this->assertSame($expected_plugin_id$actual_plugin_id);

  }

  /** * Provides data for testWeights(). * * @return array * The data. */
Home | Imprint | This part of the site doesn't use cookies.