public function DependencyRemovalTest::testViewsDependency in Search API Autocomplete 8
Tests that the Views dependency works correctly for a search view.
File
- tests/
src/ Kernel/ DependencyRemovalTest.php, line 117
Class
- DependencyRemovalTest
- Tests dependency handling of the search entity.
Namespace
Drupal\Tests\search_api_autocomplete\KernelCode
public function testViewsDependency() {
$this->search
->save();
$view = View::load('search_api_autocomplete_test_view');
// Verify that the dependencies are both included.
$dependencies = $this->search
->getDependencies();
$this
->assertArrayHasKey('config', $dependencies);
$this
->assertContains($view
->getConfigDependencyName(), $dependencies['config']);
$this
->assertArrayHasKey('module', $dependencies);
$this
->assertContains('views', $dependencies['module']);
// Verify that deleting the view will also delete the search.
$view
->delete();
$search = Search::load($this->search
->id());
$this
->assertNull($search);
}