public function SavedSearchCrudTest::testPostCreate in Search API Saved Searches 8
Tests creation of a new saved search.
@covers ::preCreate @covers ::postCreate
@dataProvider postCreateDataProvider
Parameters
string|null $set_label: The label to set when creating the saved search.
string|array|null $keys: The fulltext keywords to set on the query.
string $expected_label: The expected label set on the created saved search.
File
- tests/
src/ Kernel/ SavedSearchCrudTest.php, line 92
Class
- SavedSearchCrudTest
- Tests CRUD functionality for saved searches.
Namespace
Drupal\Tests\search_api_saved_searches\KernelCode
public function testPostCreate($set_label, $keys, $expected_label) {
$query = Index::create()
->query();
$query
->keys($keys);
$values = [
'type' => 'default',
'query' => $query,
];
if ($set_label !== NULL) {
$values['label'] = $set_label;
}
$search = SavedSearch::create($values);
$this
->assertEquals($expected_label, $search
->label());
}