public function IntegrationTest::testUrlAlias in Facets 8
Tests that an url alias works correctly.
File
- tests/
src/ Functional/ IntegrationTest.php, line 195
Class
- IntegrationTest
- Tests the overall functionality of the Facets admin UI.
Namespace
Drupal\Tests\facets\FunctionalCode
public function testUrlAlias() {
$facet_id = 'ab_facet';
$facet_edit_page = '/admin/config/search/facets/' . $facet_id . '/edit';
$this
->createFacet('ab Facet', $facet_id);
$this
->drupalGet('search-api-test-fulltext');
$this
->assertFacetLabel('item');
$this
->assertFacetLabel('article');
$this
->clickLink('item');
$url = Url::fromUserInput('/search-api-test-fulltext', [
'query' => [
'f[0]' => 'ab_facet:item',
],
]);
$this
->assertSession()
->addressEquals($url);
$this
->drupalGet($facet_edit_page);
$this
->drupalPostForm(NULL, [
'facet_settings[url_alias]' => 'llama',
], 'Save');
$this
->drupalGet('search-api-test-fulltext');
$this
->assertFacetLabel('item');
$this
->assertFacetLabel('article');
$this
->clickLink('item');
$url = Url::fromUserInput('/search-api-test-fulltext', [
'query' => [
'f[0]' => 'llama:item',
],
]);
$this
->assertSession()
->addressEquals($url);
}