public function SliderIntegrationTest::testSliderWidget in Facets 8
Tests slider widget.
File
- modules/
facets_range_widget/ tests/ src/ Functional/ SliderIntegrationTest.php, line 48
Class
- SliderIntegrationTest
- Tests the overall functionality of the Facets admin UI.
Namespace
Drupal\Tests\facets_range_widget\FunctionalCode
public function testSliderWidget() {
$this
->createIntegerField();
$id = 'owl';
$this
->createFacet('Owl widget.', $id, 'field_integer');
$this
->drupalGet('admin/config/search/facets/' . $id . '/edit');
$this
->assertSession()
->checkboxNotChecked('edit-facet-settings-slider-status');
$this
->drupalPostForm(NULL, [
'widget' => 'slider',
], 'Configure widget');
$this
->drupalPostForm(NULL, [
'widget' => 'slider',
], 'Save');
$this
->assertSession()
->checkboxChecked('edit-facet-settings-slider-status');
$this
->drupalGet('search-api-test-fulltext');
$this
->assertFacetBlocksAppear();
$this
->assertSession()
->pageTextContains('Displaying 12 search results');
// Change the facet block.
$url = Url::fromUserInput('/search-api-test-fulltext', [
'query' => [
'f[0]' => 'owl:2',
],
]);
$this
->drupalGet($url
->setAbsolute()
->toString());
// Check that the results have changed to the correct amount of results.
$this
->assertSession()
->pageTextContains('Displaying 1 search results');
$this
->assertSession()
->pageTextContains('foo bar baz 2');
// Change the facet block.
$url = Url::fromUserInput('/search-api-test-fulltext', [
'query' => [
'f[0]' => 'owl:4',
],
]);
$this
->drupalGet($url
->setAbsolute()
->toString());
// Check that the results have changed to the correct amount of results.
$this
->assertSession()
->pageTextContains('Displaying 1 search results');
$this
->assertSession()
->pageTextContains('foo bar baz 4');
}