You are here

protected function IntegrationTest::createServerDuplicate in Search API 8

Tests creating a search server with an existing machine name.

1 call to IntegrationTest::createServerDuplicate()
IntegrationTest::testFramework in tests/src/Functional/IntegrationTest.php
Tests various operations via the Search API's admin UI.

File

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

Class

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

Namespace

Drupal\Tests\search_api\Functional

Code

protected function createServerDuplicate() {
  $server_add_page = 'admin/config/search/search-api/add-server';
  $this
    ->drupalGet($server_add_page);
  $edit = [
    'name' => $this->serverId,
    'id' => $this->serverId,
    'backend' => $this->serverBackend,
  ];

  // Try to submit an server with a duplicate machine name.
  $this
    ->submitForm($edit, 'Save');
  $this
    ->assertSession()
    ->pageTextContains('The machine-readable name is already in use. It must be unique.');
}