diff options
author | webchick <webchick@24967.no-reply.drupal.org> | 2012-03-24 00:36:00 -0600 |
---|---|---|
committer | webchick <webchick@24967.no-reply.drupal.org> | 2012-03-24 00:36:00 -0600 |
commit | a6e6b2e96b3bb174a656b71149808add7d488b39 (patch) | |
tree | b9843314c44ee69aeaa11d9b45fb7db173085d5c /modules/search/search.test | |
parent | 19784139297a565c45ca1d3e59e8429c502d7c23 (diff) | |
download | brdo-a6e6b2e96b3bb174a656b71149808add7d488b39.tar.gz brdo-a6e6b2e96b3bb174a656b71149808add7d488b39.tar.bz2 |
Issue #1335388 by wojtha: Fixed Warning: strpos(): Empty delimiter in search_simplify_excerpt_match().
Diffstat (limited to 'modules/search/search.test')
-rw-r--r-- | modules/search/search.test | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/modules/search/search.test b/modules/search/search.test index ca1dd24a3..26c663e71 100644 --- a/modules/search/search.test +++ b/modules/search/search.test @@ -1639,6 +1639,21 @@ class SearchExcerptTestCase extends DrupalUnitTestCase { $result = preg_replace('| +|', ' ', search_excerpt('"abc def"', $text)); $this->assertTrue(strpos($result, '<strong>abc,def</strong>') !== FALSE, 'Phrase with keyword simplified into two separate words is highlighted with simplified match'); + + // Test phrases with characters which are being truncated. + $result = preg_replace('| +|', ' ', search_excerpt('"ipsum _"', $text)); + $this->assertTrue(strpos($result, '<strong>ipsum </strong>') !== FALSE, 'Only valid part of the phrase is highlighted and invalid part containing "_" is ignored.'); + + $result = preg_replace('| +|', ' ', search_excerpt('"ipsum 0000"', $text)); + $this->assertTrue(strpos($result, '<strong>ipsum </strong>') !== FALSE, 'Only valid part of the phrase is highlighted and invalid part "0000" is ignored.'); + + // Test combination of the valid keyword and keyword containing only + // characters which are being truncated during simplification. + $result = preg_replace('| +|', ' ', search_excerpt('ipsum _', $text)); + $this->assertTrue(strpos($result, '<strong>ipsum</strong>') !== FALSE, 'Only valid keyword is highlighted and invalid keyword "_" is ignored.'); + + $result = preg_replace('| +|', ' ', search_excerpt('ipsum 0000', $text)); + $this->assertTrue(strpos($result, '<strong>ipsum</strong>') !== FALSE, 'Only valid keyword is highlighted and invalid keyword "0000" is ignored.'); } } |