SimpleGseSearchTest.php in Simple Google Custom Search Engine 2.0.x
File
tests/src/Functional/SimpleGseSearchTest.php
View source
<?php
namespace Drupal\Tests\simple_gse_search\Functional;
use Drupal\Core\Url;
use Drupal\Tests\BrowserTestBase;
class SimpleGseSearchTest extends BrowserTestBase {
protected static $modules = [
'block',
'simple_gse_search',
];
protected function setUp() {
parent::setUp();
$this
->drupalLogin($this
->drupalCreateUser([
'access gse search page',
]));
$this
->placeBlock('simple_gse_search_block');
}
public function testSearch() {
$this
->drupalGet('<front>');
$this
->submitForm([
's' => 'bananas',
], 'go');
$url = Url::fromRoute('simple_gse_search.search_page', [], [
'query' => [
's' => 'bananas',
],
])
->setAbsolute()
->toString();
$this
->assertEquals($url, $this
->getSession()
->getCurrentUrl());
$this
->assertSession()
->fieldValueEquals('s', 'bananas');
}
}