You are here

public function IntegrationTest::testIntegerIndex in Search API 8

Tests what happens when an index has an integer as id/label.

This needs to be in a separate test because we want to test the content tracking behavior as well as the fields / processors editing and adding without messing with the other index. This test also makes sure that the server also has an integer as id/label.

File

tests/src/Functional/IntegrationTest.php, line 138

Class

IntegrationTest
Tests the overall functionality of the Search API framework and admin UI.

Namespace

Drupal\Tests\search_api\Functional

Code

public function testIntegerIndex() {
  Server::create([
    'id' => 456,
    'name' => 789,
    'description' => 'WebTest server description',
    'backend' => $this->serverBackend,
    'backend_config' => [],
  ])
    ->save();
  $this
    ->drupalCreateNode([
    'type' => 'article',
  ]);
  $this
    ->drupalCreateNode([
    'type' => 'article',
  ]);
  $this
    ->drupalGet('admin/config/search/search-api/add-index');
  $this->indexId = 123;
  $edit = [
    'name' => $this->indexId,
    'id' => $this->indexId,
    'status' => 1,
    'description' => 'test Index:: 123~',
    'server' => 456,
    'datasources[entity:node]' => TRUE,
  ];
  $this
    ->submitForm($edit, 'Save');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->pageTextContains('Please configure the used datasources.');
  $this
    ->submitForm([], 'Save');
  $this
    ->checkForMetaRefresh();
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->pageTextContains('The index was successfully saved.');
  $this
    ->assertEquals(2, $this
    ->countTrackedItems());
  $this
    ->enableAllProcessors();
  $this
    ->checkFieldLabels();
  $this
    ->addFieldsToIndex();
  $this
    ->addFieldsWithDependenciesToIndex();
  $this
    ->removeFieldsDependencies();
  $this
    ->removeFieldsFromIndex();
  $this
    ->checkUnsavedChanges();
  $this
    ->configureFilter();
  $this
    ->configureFilterPage();
  $this
    ->checkProcessorChanges();
  $this
    ->changeProcessorFieldBoost();
  $this
    ->setReadOnly();
  $this
    ->disableEnableIndex();
  $this
    ->changeIndexDatasource();
  $this
    ->changeIndexServer();
  $this
    ->checkIndexing();
  $this
    ->checkIndexActions();
}