Commit 9ac248bf authored by alexpott's avatar alexpott

Issue #2060553 by jhodgdon, manningpete: Search result snippet displayes HTML entities

parent 40ba76c7
......@@ -8,7 +8,7 @@
namespace Drupal\search\Tests;
/**
* Tests search functionality with punctuation.
* Tests search functionality with punctuation and HTML entities.
*
* @group search
*/
......@@ -31,10 +31,11 @@ protected function setUp() {
}
/**
* Tests that search returns results with punctuation in the search phrase.
* Tests that search works with punctuation and HTML entities.
*/
function testPhraseSearchPunctuation() {
$node = $this->drupalCreateNode(array('body' => array(array('value' => "The bunny's ears were fluffy."))));
$node2 = $this->drupalCreateNode(array('body' => array(array('value' => 'Dignissim Aliquam & Quieligo meus natu quae quia te. Damnum© erat— neo pneum. Facilisi feugiat ibidem ratis.'))));
// Update the search index.
$this->container->get('plugin.manager.search')->createInstance('node_search')->updateIndex();
......@@ -51,5 +52,16 @@ function testPhraseSearchPunctuation() {
// Check if the author is linked correctly to the user profile page.
$username = $node->getOwner()->getUsername();
$this->assertLink($username);
// Search for "&" and verify entities are not broken up in the output.
$edit = array('keys' => '&');
$this->drupalPostForm('search/node', $edit, t('Search'));
$this->assertNoRaw('<strong>&</strong>amp;');
$this->assertText('You must include at least one positive keyword');
$edit = array('keys' => '&amp;');
$this->drupalPostForm('search/node', $edit, t('Search'));
$this->assertNoRaw('<strong>&</strong>amp;');
$this->assertText('You must include at least one positive keyword');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment