You are here

public function SearchCrudTest::testUpdate in Search API Autocomplete 8

Tests whether updating a search entity works correctly.

File

tests/src/Kernel/SearchCrudTest.php, line 145

Class

SearchCrudTest
Tests saving a Search API autocomplete config entity.

Namespace

Drupal\Tests\search_api_autocomplete\Kernel

Code

public function testUpdate() {
  $values = $this
    ->getSearchTestValues();
  $search = Search::create($values);
  $search
    ->save();
  $search
    ->set('label', 'foobar');
  $search
    ->save();
  $this
    ->assertEquals('foobar', $search
    ->label());
  $loaded_search = Search::load($search
    ->id());
  $this
    ->assertInstanceOf(SearchInterface::class, $loaded_search);
  $this
    ->assertEquals($search
    ->toArray(), $loaded_search
    ->toArray());
}