You are here

class FieldDiscoveryTestClass in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/migrate_drupal/tests/modules/field_discovery_test/src/FieldDiscoveryTestClass.php \Drupal\field_discovery_test\FieldDiscoveryTestClass
  2. 9 core/modules/migrate_drupal/tests/modules/field_discovery_test/src/FieldDiscoveryTestClass.php \Drupal\field_discovery_test\FieldDiscoveryTestClass

A test class to expose protected methods.

Hierarchy

Expanded class hierarchy of FieldDiscoveryTestClass

4 files declare their use of FieldDiscoveryTestClass
FieldDiscoveryTest.php in core/modules/migrate_drupal/tests/src/Unit/FieldDiscoveryTest.php
FieldDiscoveryTest.php in core/modules/migrate_drupal/tests/src/Kernel/d6/FieldDiscoveryTest.php
FieldDiscoveryTest.php in core/modules/migrate_drupal/tests/src/Kernel/d7/FieldDiscoveryTest.php
FieldDiscoveryTestTrait.php in core/modules/migrate_drupal/tests/src/Traits/FieldDiscoveryTestTrait.php

File

core/modules/migrate_drupal/tests/modules/field_discovery_test/src/FieldDiscoveryTestClass.php, line 14

Namespace

Drupal\field_discovery_test
View source
class FieldDiscoveryTestClass extends FieldDiscovery {

  /**
   * An array of test data.
   *
   * @var array
   */
  protected $testData;

  /**
   * Constructs a FieldDiscoveryTestClass object.
   *
   * @param \Drupal\migrate_drupal\Plugin\MigrateFieldPluginManagerInterface $field_plugin_manager
   *   The field plugin manager.
   * @param \Drupal\migrate\Plugin\MigrationPluginManagerInterface $migration_plugin_manager
   *   The migration plugin manager.
   * @param \Psr\Log\LoggerInterface $logger
   *   The logger.
   * @param array $test_data
   *   An array of test data, keyed by method name, for overridden methods to
   *   return for the purposes of testing other methods.
   */
  public function __construct(MigrateFieldPluginManagerInterface $field_plugin_manager, MigrationPluginManagerInterface $migration_plugin_manager, LoggerInterface $logger, array $test_data = []) {
    parent::__construct($field_plugin_manager, $migration_plugin_manager, $logger);
    $this->testData = $test_data;
  }

  /**
   * {@inheritdoc}
   */
  public function getAllFields($core) {
    if (!empty($this->testData['getAllFields'][$core])) {
      return $this->testData['getAllFields'][$core];
    }
    return parent::getAllFields($core);
  }

  /**
   * {@inheritdoc}
   */
  public function getBundleFields($core, $entity_type_id, $bundle) {
    return parent::getBundleFields($core, $entity_type_id, $bundle);
  }

  /**
   * {@inheritdoc}
   */
  public function getEntityFields($core, $entity_type_id) {
    return parent::getEntityFields($core, $entity_type_id);
  }

  /**
   * {@inheritdoc}
   */
  public function getFieldInstanceStubMigrationDefinition($core) {
    return parent::getFieldInstanceStubMigrationDefinition($core);
  }

  /**
   * {@inheritdoc}
   */
  public function getCoreVersion(MigrationInterface $migration) {
    return parent::getCoreVersion($migration);
  }

  /**
   * {@inheritdoc}
   */
  public function getFieldPlugin($field_type, MigrationInterface $migration) {
    return parent::getFieldPlugin($field_type, $migration);
  }

  /**
   * {@inheritdoc}
   */
  public function getSourcePlugin($core) {
    return parent::getSourcePlugin($core);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
FieldDiscovery::$bundleKeys protected property An array of bundle keys, keyed by drupal core version.
FieldDiscovery::$discoveredFieldsCache protected property A cache of discovered fields.
FieldDiscovery::$fieldPluginCache protected property An array of already discovered field plugin information.
FieldDiscovery::$fieldPluginManager protected property The field plugin manager.
FieldDiscovery::$logger protected property The logger channel service.
FieldDiscovery::$migrationPluginManager protected property The migration plugin manager.
FieldDiscovery::$sourcePluginIds protected property An array of source plugin ids, keyed by Drupal core version.
FieldDiscovery::$supportedCoreVersions protected property An array of supported Drupal core versions.
FieldDiscovery::addAllFieldProcesses public function Adds the field processes to a migration. Overrides FieldDiscoveryInterface::addAllFieldProcesses
FieldDiscovery::addBundleFieldProcesses public function Adds the field processes for a bundle to a migration. Overrides FieldDiscoveryInterface::addBundleFieldProcesses
FieldDiscovery::addEntityFieldProcesses public function Adds the field processes for an entity to a migration. Overrides FieldDiscoveryInterface::addEntityFieldProcesses
FieldDiscoveryInterface::DRUPAL_6 constant
FieldDiscoveryInterface::DRUPAL_7 constant
FieldDiscoveryTestClass::$testData protected property An array of test data.
FieldDiscoveryTestClass::getAllFields public function Gets all field information related to this migration. Overrides FieldDiscovery::getAllFields
FieldDiscoveryTestClass::getBundleFields public function Gets all field information for a particular entity type and bundle. Overrides FieldDiscovery::getBundleFields
FieldDiscoveryTestClass::getCoreVersion public function Finds the core version of a Drupal migration. Overrides FieldDiscovery::getCoreVersion
FieldDiscoveryTestClass::getEntityFields public function Gets all field information for a particular entity type. Overrides FieldDiscovery::getEntityFields
FieldDiscoveryTestClass::getFieldInstanceStubMigrationDefinition public function Provides the stub migration definition for a given Drupal core version. Overrides FieldDiscovery::getFieldInstanceStubMigrationDefinition
FieldDiscoveryTestClass::getFieldPlugin public function Returns the appropriate field plugin for a given field type. Overrides FieldDiscovery::getFieldPlugin
FieldDiscoveryTestClass::getSourcePlugin public function Gets the source plugin to use to gather field information. Overrides FieldDiscovery::getSourcePlugin
FieldDiscoveryTestClass::__construct public function Constructs a FieldDiscoveryTestClass object. Overrides FieldDiscovery::__construct