You are here

class TestTracker in Search API 8

Provides a tracker implementation which uses a FIFO-like processing order.

Plugin annotation


@SearchApiTracker(
  id = "search_api_test",
  label = @Translation(""Test" tracker"),
  description = @Translation("This is the <em>test tracker</em> plugin description."),
)

Hierarchy

Expanded class hierarchy of TestTracker

1 file declares its use of TestTracker
IntegrationTest.php in tests/src/Functional/IntegrationTest.php

File

tests/search_api_test/src/Plugin/search_api/tracker/TestTracker.php, line 20

Namespace

Drupal\search_api_test\Plugin\search_api\tracker
View source
class TestTracker extends TrackerPluginBase implements PluginFormInterface {
  use PluginFormTrait;
  use TestPluginTrait;

  /**
   * {@inheritdoc}
   */
  public function defaultConfiguration() {
    return [
      'foo' => 'test',
      'dependencies' => [],
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
    return [
      'foo' => [
        '#type' => 'textfield',
        '#title' => 'Foo',
        '#default_value' => $this->configuration['foo'],
      ],
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function trackItemsInserted(array $ids) {
    $this
      ->logMethodCall(__FUNCTION__, func_get_args());
  }

  /**
   * {@inheritdoc}
   */
  public function trackItemsUpdated(array $ids) {
    $this
      ->logMethodCall(__FUNCTION__, func_get_args());
  }

  /**
   * {@inheritdoc}
   */
  public function trackAllItemsUpdated($datasource_id = NULL) {
    $this
      ->logMethodCall(__FUNCTION__, func_get_args());
  }

  /**
   * {@inheritdoc}
   */
  public function trackItemsIndexed(array $ids) {
    $this
      ->logMethodCall(__FUNCTION__, func_get_args());
  }

  /**
   * {@inheritdoc}
   */
  public function trackItemsDeleted(array $ids = NULL) {
    $this
      ->logMethodCall(__FUNCTION__, func_get_args());
  }

  /**
   * {@inheritdoc}
   */
  public function trackAllItemsDeleted($datasource_id = NULL) {
    $this
      ->logMethodCall(__FUNCTION__, func_get_args());
  }

  /**
   * {@inheritdoc}
   */
  public function getRemainingItems($limit = -1, $datasource_id = NULL) {
    $this
      ->logMethodCall(__FUNCTION__, func_get_args());
    return [];
  }

  /**
   * {@inheritdoc}
   */
  public function getTotalItemsCount($datasource_id = NULL) {
    $this
      ->logMethodCall(__FUNCTION__, func_get_args());
    return 0;
  }

  /**
   * {@inheritdoc}
   */
  public function getIndexedItemsCount($datasource_id = NULL) {
    $this
      ->logMethodCall(__FUNCTION__, func_get_args());
    return 0;
  }

  /**
   * {@inheritdoc}
   */
  public function getRemainingItemsCount($datasource_id = NULL) {
    $this
      ->logMethodCall(__FUNCTION__, func_get_args());
    return 0;
  }

  /**
   * {@inheritdoc}
   */
  public function calculateDependencies() {
    return $this->configuration['dependencies'];
  }

  /**
   * {@inheritdoc}
   */
  public function onDependencyRemoval(array $dependencies) {
    $remove = $this
      ->getReturnValue(__FUNCTION__, FALSE);
    if ($remove) {
      $this->configuration['dependencies'] = [];
    }
    return $remove;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ConfigurablePluginBase::calculatePluginDependencies Deprecated protected function Calculates and adds dependencies of a specific plugin instance.
ConfigurablePluginBase::create public static function Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface::create 4
ConfigurablePluginBase::getConfiguration public function Gets this plugin's configuration. Overrides ConfigurableInterface::getConfiguration
ConfigurablePluginBase::getDescription public function Returns the plugin's description. Overrides ConfigurablePluginInterface::getDescription
ConfigurablePluginBase::getPluginDependencies Deprecated protected function Calculates and returns dependencies of a specific plugin instance.
ConfigurablePluginBase::label public function Returns the label for use on the administration pages. Overrides ConfigurablePluginInterface::label
ConfigurablePluginBase::moduleHandler Deprecated protected function Wraps the module handler.
ConfigurablePluginBase::setConfiguration public function Sets the configuration for this plugin instance. Overrides ConfigurableInterface::setConfiguration 3
ConfigurablePluginBase::themeHandler Deprecated protected function Wraps the theme handler.
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function 1
DependencySerializationTrait::__wakeup public function 2
DependencyTrait::$dependencies protected property The object's dependencies.
DependencyTrait::addDependencies protected function Adds multiple dependencies.
DependencyTrait::addDependency protected function Adds a dependency.
HideablePluginBase::isHidden public function Determines whether this plugin should be hidden in the UI. Overrides HideablePluginInterface::isHidden 1
IndexPluginBase::$index protected property The index this processor is configured for.
IndexPluginBase::getIndex public function Retrieves the index this plugin is configured for. Overrides IndexPluginInterface::getIndex
IndexPluginBase::setIndex public function Sets the index this plugin is configured for. Overrides IndexPluginInterface::setIndex
IndexPluginBase::__construct public function Constructs a \Drupal\Component\Plugin\PluginBase object. Overrides ConfigurablePluginBase::__construct 2
MessengerTrait::$messenger protected property The messenger. 29
MessengerTrait::messenger public function Gets the messenger. 29
MessengerTrait::setMessenger public function Sets the messenger.
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 3
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.
PluginDependencyTrait::calculatePluginDependencies protected function Calculates and adds dependencies of a specific plugin instance. Aliased as: traitCalculatePluginDependencies 1
PluginDependencyTrait::getPluginDependencies protected function Calculates and returns dependencies of a specific plugin instance. Aliased as: traitGetPluginDependencies
PluginDependencyTrait::moduleHandler protected function Wraps the module handler. Aliased as: traitModuleHandler 1
PluginDependencyTrait::themeHandler protected function Wraps the theme handler. Aliased as: traitThemeHandler 1
PluginFormTrait::submitConfigurationForm public function Form submission handler. 7
PluginFormTrait::validateConfigurationForm public function Form validation handler. 2
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.
TestPluginTrait::$pluginType protected property This object's plugin type.
TestPluginTrait::checkError protected function Throws an exception if set in the Drupal state for the given method.
TestPluginTrait::getMethodOverride protected function Retrieves a possible override set for the given method.
TestPluginTrait::getPluginType protected function Returns the plugin type of this object.
TestPluginTrait::getReturnValue protected function Retrieves the value to return for a certain method.
TestPluginTrait::logMethodCall protected function Logs a method call to the site state.
TestPluginTrait::__call public function Implements the magic __call() method.
TestTracker::buildConfigurationForm public function Form constructor. Overrides PluginFormInterface::buildConfigurationForm
TestTracker::calculateDependencies public function Calculates dependencies for the configured plugin. Overrides ConfigurablePluginBase::calculateDependencies
TestTracker::defaultConfiguration public function Gets default configuration for this plugin. Overrides ConfigurablePluginBase::defaultConfiguration
TestTracker::getIndexedItemsCount public function Retrieves the number of indexed items for this index. Overrides TrackerInterface::getIndexedItemsCount
TestTracker::getRemainingItems public function Retrieves a list of item IDs that need to be indexed. Overrides TrackerInterface::getRemainingItems
TestTracker::getRemainingItemsCount public function Retrieves the total number of pending items for this index. Overrides TrackerInterface::getRemainingItemsCount
TestTracker::getTotalItemsCount public function Retrieves the total number of items that are being tracked for this index. Overrides TrackerInterface::getTotalItemsCount
TestTracker::onDependencyRemoval public function Informs the plugin that some of its dependencies are being removed. Overrides ConfigurablePluginBase::onDependencyRemoval
TestTracker::trackAllItemsDeleted public function Removes all items from the tracker, or only those of a specific datasource. Overrides TrackerInterface::trackAllItemsDeleted
TestTracker::trackAllItemsUpdated public function Marks all items as updated, or only those of a specific datasource. Overrides TrackerInterface::trackAllItemsUpdated
TestTracker::trackItemsDeleted public function Removes items from the tracking system for this index. Overrides TrackerInterface::trackItemsDeleted
TestTracker::trackItemsIndexed public function Marks items as indexed for this index. Overrides TrackerInterface::trackItemsIndexed
TestTracker::trackItemsInserted public function Inserts new items into the tracking system for this index. Overrides TrackerInterface::trackItemsInserted
TestTracker::trackItemsUpdated public function Marks the given items as updated for this index. Overrides TrackerInterface::trackItemsUpdated