TestTracker.php in Search API 8
File
tests/search_api_test/src/Plugin/search_api/tracker/TestTracker.php
View source
<?php
namespace Drupal\search_api_test\Plugin\search_api\tracker;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\PluginFormInterface;
use Drupal\search_api\Plugin\PluginFormTrait;
use Drupal\search_api\Tracker\TrackerPluginBase;
use Drupal\search_api_test\TestPluginTrait;
class TestTracker extends TrackerPluginBase implements PluginFormInterface {
use PluginFormTrait;
use TestPluginTrait;
public function defaultConfiguration() {
return [
'foo' => 'test',
'dependencies' => [],
];
}
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
return [
'foo' => [
'#type' => 'textfield',
'#title' => 'Foo',
'#default_value' => $this->configuration['foo'],
],
];
}
public function trackItemsInserted(array $ids) {
$this
->logMethodCall(__FUNCTION__, func_get_args());
}
public function trackItemsUpdated(array $ids) {
$this
->logMethodCall(__FUNCTION__, func_get_args());
}
public function trackAllItemsUpdated($datasource_id = NULL) {
$this
->logMethodCall(__FUNCTION__, func_get_args());
}
public function trackItemsIndexed(array $ids) {
$this
->logMethodCall(__FUNCTION__, func_get_args());
}
public function trackItemsDeleted(array $ids = NULL) {
$this
->logMethodCall(__FUNCTION__, func_get_args());
}
public function trackAllItemsDeleted($datasource_id = NULL) {
$this
->logMethodCall(__FUNCTION__, func_get_args());
}
public function getRemainingItems($limit = -1, $datasource_id = NULL) {
$this
->logMethodCall(__FUNCTION__, func_get_args());
return [];
}
public function getTotalItemsCount($datasource_id = NULL) {
$this
->logMethodCall(__FUNCTION__, func_get_args());
return 0;
}
public function getIndexedItemsCount($datasource_id = NULL) {
$this
->logMethodCall(__FUNCTION__, func_get_args());
return 0;
}
public function getRemainingItemsCount($datasource_id = NULL) {
$this
->logMethodCall(__FUNCTION__, func_get_args());
return 0;
}
public function calculateDependencies() {
return $this->configuration['dependencies'];
}
public function onDependencyRemoval(array $dependencies) {
$remove = $this
->getReturnValue(__FUNCTION__, FALSE);
if ($remove) {
$this->configuration['dependencies'] = [];
}
return $remove;
}
}
Classes
Name |
Description |
TestTracker |
Provides a tracker implementation which uses a FIFO-like processing order. |