/**
  * Asserts enable/disable operations for a search server or index.
  *
  * @param \Drupal\search_api\ServerInterface|\Drupal\search_api\IndexInterface $entity
  *   A search server or index.
  */
 protected function assertEntityStatusChange($entity)
 {
     $this->drupalGet($this->overviewPageUrl);
     $row_class = Html::cleanCssIdentifier($entity->getEntityTypeId() . '-' . $entity->id());
     $this->assertFieldByXPath('//tr[contains(@class,"' . $row_class . '") and contains(@class, "search-api-list-enabled")]', NULL, 'The newly created entity is enabled by default.');
     // The first "Disable" link on the page belongs to our server, the second
     // one to our index.
     $this->clickLink('Disable', $entity instanceof ServerInterface ? 0 : 1);
     // Submit the confirmation form and test that the entity has been disabled.
     $this->drupalPostForm(NULL, array(), 'Disable');
     $this->assertFieldByXPath('//tr[contains(@class,"' . $row_class . '") and contains(@class, "search-api-list-disabled")]', NULL, 'The entity has been disabled.');
     // Now enable the entity and verify that the operation succeeded.
     $this->clickLink('Enable');
     $this->drupalGet($this->overviewPageUrl);
     $this->assertFieldByXPath('//tr[contains(@class,"' . $row_class . '") and contains(@class, "search-api-list-enabled")]', NULL, 'The entity has benn enabled.');
 }