ParseModeTest.php in Search API Pages 8
File
tests/src/Functional/ParseModeTest.php
View source
<?php
namespace Drupal\Tests\search_api_page\Functional;
class ParseModeTest extends FunctionalTestBase {
public function setUp() {
parent::setUp();
$this
->drupalLogin($this->adminUser);
$this
->setupSearchApi();
}
public function testAdminFormParseMode() {
$assert_session = $this
->assertSession();
$step1 = [
'label' => 'Search Page Test',
'id' => 'search_page_test',
'index' => $this->index
->id(),
];
$this
->drupalPostForm('admin/config/search/search-api-pages/add', $step1, 'Next');
$step2 = [
'path' => 'search-page-test',
];
$this
->drupalPostForm(NULL, $step2, 'Save');
$this
->drupalGet('admin/config/search/search-api-pages');
$assert_session
->statusCodeEquals(200);
$assert_session
->pageTextContains('Search Page Test');
$this
->drupalGet('admin/config/search/search-api-pages/search_page_test');
$assert_session
->statusCodeEquals(200);
$assert_session
->pageTextContains('Parse mode for search keywords');
$plugin_manager = \Drupal::service('plugin.manager.search_api.parse_mode');
$instances = $plugin_manager
->getInstances();
foreach ($instances as $name => $instance) {
$assert_session
->responseContains($name);
}
$edit = [
'parse_mode' => 'terms',
];
$this
->drupalPostForm('admin/config/search/search-api-pages/search_page_test', $edit, 'Save');
$this
->drupalGet('admin/config/search/search-api-pages/search_page_test');
$assert_session
->statusCodeEquals(200);
$assert_session
->responseContains('terms');
}
}
Classes
Name |
Description |
ParseModeTest |
Provides web tests for the parse mode option of Search API Pages. |