You are here

public function IntegrationTest::testFramework in Search API Pages 8

Sets up an environment for testing + delegates to other methods for tests.

File

tests/src/Functional/IntegrationTest.php, line 111

Class

IntegrationTest
Provides web tests for Search API Pages.

Namespace

Drupal\Tests\search_api_page\Functional

Code

public function testFramework() {
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->setupSearchAPI();
  $this
    ->drupalGet('admin/config/search/search-api-pages');
  $step1 = [
    'label' => 'Search',
    'id' => 'search',
    'index' => $this->index
      ->id(),
  ];
  $this
    ->drupalPostForm('admin/config/search/search-api-pages/add', $step1, 'Next');
  $step2 = [
    'path' => 'search',
  ];
  $this
    ->drupalPostForm(NULL, $step2, 'Save');
  $this
    ->drupalGet('/search');
  $this
    ->assertSession()
    ->statusCodeEquals(200);

  // The setup was done, we now have a search page set up
  // at /search, we can use that to do the rest of our testing.
  $this
    ->checkMultipleWordSearch();
  $this
    ->checkSpacesinSearch();
  $this
    ->checkSlashSearch();
  $this
    ->checkUndefinedLanguageItemsAreFound();
}