protected function SearchConfigSettingsFormTest::setUp in Drupal 8
Same name and namespace in other branches
- 9 core/modules/search/tests/src/Functional/SearchConfigSettingsFormTest.php \Drupal\Tests\search\Functional\SearchConfigSettingsFormTest::setUp()
Overrides BrowserTestBase::setUp
File
- core/
modules/ search/ tests/ src/ Functional/ SearchConfigSettingsFormTest.php, line 49
Class
- SearchConfigSettingsFormTest
- Verify the search config settings form.
Namespace
Drupal\Tests\search\FunctionalCode
protected function setUp() {
parent::setUp();
$this
->drupalCreateContentType([
'type' => 'page',
'name' => 'Basic page',
]);
// Log in as a user that can create and search content.
$this->searchUser = $this
->drupalCreateUser([
'search content',
'administer search',
'administer nodes',
'bypass node access',
'access user profiles',
'administer users',
'administer blocks',
'access site reports',
]);
$this
->drupalLogin($this->searchUser);
// Add a single piece of content and index it.
$node = $this
->drupalCreateNode();
$this->searchNode = $node;
// Link the node to itself to test that it's only indexed once. The content
// also needs the word "pizza" so we can use it as the search keyword.
$body_key = 'body[0][value]';
$edit[$body_key] = Link::fromTextAndUrl($node
->label(), $node
->toUrl())
->toString() . ' pizza sandwich';
$this
->drupalPostForm('node/' . $node
->id() . '/edit', $edit, t('Save'));
$this->container
->get('plugin.manager.search')
->createInstance('node_search')
->updateIndex();
// Enable the search block.
$this
->drupalPlaceBlock('search_form_block');
$this
->drupalPlaceBlock('local_tasks_block');
$this
->drupalPlaceBlock('page_title_block');
}