X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fcore%2Fmodules%2Fsearch%2Fsrc%2FTests%2FSearchPreprocessLangcodeTest.php;fp=web%2Fcore%2Fmodules%2Fsearch%2Fsrc%2FTests%2FSearchPreprocessLangcodeTest.php;h=0000000000000000000000000000000000000000;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hp=ab264a1a85b89610f9dee92835606dfcdb863d5b;hpb=74df008bdbb3a11eeea356744f39b802369bda3c;p=yaffs-website diff --git a/web/core/modules/search/src/Tests/SearchPreprocessLangcodeTest.php b/web/core/modules/search/src/Tests/SearchPreprocessLangcodeTest.php deleted file mode 100644 index ab264a1a8..000000000 --- a/web/core/modules/search/src/Tests/SearchPreprocessLangcodeTest.php +++ /dev/null @@ -1,99 +0,0 @@ -drupalCreateUser([ - 'create page content', - 'edit own page content', - 'search content', - 'use advanced search', - ]); - $this->drupalLogin($web_user); - } - - /** - * Tests that hook_search_preprocess() returns the correct langcode. - */ - public function testPreprocessLangcode() { - // Create a node. - $this->node = $this->drupalCreateNode(['body' => [[]], 'langcode' => 'en']); - - // First update the index. This does the initial processing. - $this->container->get('plugin.manager.search')->createInstance('node_search')->updateIndex(); - - // Then, run the shutdown function. Testing is a unique case where indexing - // and searching has to happen in the same request, so running the shutdown - // function manually is needed to finish the indexing process. - search_update_totals(); - - // Search for the additional text that is added by the preprocess - // function. If you search for text that is in the node, preprocess is - // not invoked on the node during the search excerpt generation. - $edit = ['or' => 'Additional text']; - $this->drupalPostForm('search/node', $edit, t('Advanced search')); - - // Checks if the langcode message has been set by hook_search_preprocess(). - $this->assertText('Langcode Preprocess Test: en'); - } - - /** - * Tests stemming for hook_search_preprocess(). - */ - public function testPreprocessStemming() { - // Create a node. - $this->node = $this->drupalCreateNode([ - 'title' => 'we are testing', - 'body' => [[]], - 'langcode' => 'en', - ]); - - // First update the index. This does the initial processing. - $this->container->get('plugin.manager.search')->createInstance('node_search')->updateIndex(); - - // Then, run the shutdown function. Testing is a unique case where indexing - // and searching has to happen in the same request, so running the shutdown - // function manually is needed to finish the indexing process. - search_update_totals(); - - // Search for the title of the node with a POST query. - $edit = ['or' => 'testing']; - $this->drupalPostForm('search/node', $edit, t('Advanced search')); - - // Check if the node has been found. - $this->assertText('Search results'); - $this->assertText('we are testing'); - - // Search for the same node using a different query. - $edit = ['or' => 'test']; - $this->drupalPostForm('search/node', $edit, t('Advanced search')); - - // Check if the node has been found. - $this->assertText('Search results'); - $this->assertText('we are testing'); - } - -}