You are here

public function SearchBlockTest::testSearchBlock in Google Search Appliance 8

Test search block form.

File

tests/src/Functional/SearchBlockTest.php, line 21

Class

SearchBlockTest
Test search block.

Namespace

Drupal\Tests\google_appliance\Functional

Code

public function testSearchBlock() {
  $this
    ->placeBlock('google_appliance_search');

  // Test redirect.
  // Go to the front page and submit the search form.
  $this
    ->drupalGet(Url::fromRoute('<front>'));
  $terms = [
    'search_keys' => 'ponies',
  ];
  $this
    ->submitForm($terms, $this
    ->t('Search'));
  $this
    ->assertEquals(Url::fromRoute(SearchViewRoute::ROUTE_NAME, [
    'search_query' => 'ponies',
  ])
    ->setAbsolute()
    ->toString(), $this
    ->getSession()
    ->getCurrentUrl());
  $assert = $this
    ->assertSession();
  $assert
    ->statusCodeEquals(200);
}