Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
e0c2d965
Commit
e0c2d965
authored
8 years ago
by
Alex Pott
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2714585
by neclimdul: Avoid definition constants in SearchMatchTest
parent
a1d3a681
No related branches found
No related tags found
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/modules/search/tests/src/Kernel/SearchMatchTest.php
+12
-12
12 additions, 12 deletions
core/modules/search/tests/src/Kernel/SearchMatchTest.php
with
12 additions
and
12 deletions
core/modules/search/tests/src/Kernel/SearchMatchTest.php
+
12
−
12
View file @
e0c2d965
...
...
@@ -5,12 +5,6 @@
use
Drupal\Core\Language\LanguageInterface
;
use
Drupal\KernelTests\KernelTestBase
;
// The search index can contain different types of content. Typically the type
// is 'node'. Here we test with _test_ and _test2_ as the type.
const
SEARCH_TYPE
=
'_test_'
;
const
SEARCH_TYPE_2
=
'_test2_'
;
const
SEARCH_TYPE_JPN
=
'_test3_'
;
/**
* Indexes content and queries it.
*
...
...
@@ -18,6 +12,12 @@
*/
class
SearchMatchTest
extends
KernelTestBase
{
// The search index can contain different types of content. Typically the type
// is 'node'. Here we test with _test_ and _test2_ as the type.
const
SEARCH_TYPE
=
'_test_'
;
const
SEARCH_TYPE_2
=
'_test2_'
;
const
SEARCH_TYPE_JPN
=
'_test3_'
;
/**
* Modules to enable.
*
...
...
@@ -49,10 +49,10 @@ function _setup() {
$this
->
config
(
'search.settings'
)
->
set
(
'index.minimum_word_size'
,
3
)
->
save
();
for
(
$i
=
1
;
$i
<=
7
;
++
$i
)
{
search_index
(
SEARCH_TYPE
,
$i
,
LanguageInterface
::
LANGCODE_NOT_SPECIFIED
,
$this
->
getText
(
$i
));
search_index
(
static
::
SEARCH_TYPE
,
$i
,
LanguageInterface
::
LANGCODE_NOT_SPECIFIED
,
$this
->
getText
(
$i
));
}
for
(
$i
=
1
;
$i
<=
5
;
++
$i
)
{
search_index
(
SEARCH_TYPE_2
,
$i
+
7
,
LanguageInterface
::
LANGCODE_NOT_SPECIFIED
,
$this
->
getText2
(
$i
));
search_index
(
static
::
SEARCH_TYPE_2
,
$i
+
7
,
LanguageInterface
::
LANGCODE_NOT_SPECIFIED
,
$this
->
getText2
(
$i
));
}
// No getText builder function for Japanese text; just a simple array.
foreach
(
array
(
...
...
@@ -60,7 +60,7 @@ function _setup() {
14
=>
'ドルーパルが大好きよ!'
,
15
=>
'コーヒーとケーキ'
,
)
as
$i
=>
$jpn
)
{
search_index
(
SEARCH_TYPE_JPN
,
$i
,
LanguageInterface
::
LANGCODE_NOT_SPECIFIED
,
$jpn
);
search_index
(
static
::
SEARCH_TYPE_JPN
,
$i
,
LanguageInterface
::
LANGCODE_NOT_SPECIFIED
,
$jpn
);
}
search_update_totals
();
}
...
...
@@ -161,7 +161,7 @@ function _testQueries() {
foreach
(
$queries
as
$query
=>
$results
)
{
$result
=
db_select
(
'search_index'
,
'i'
)
->
extend
(
'Drupal\search\SearchQuery'
)
->
searchExpression
(
$query
,
SEARCH_TYPE
)
->
searchExpression
(
$query
,
static
::
SEARCH_TYPE
)
->
execute
();
$set
=
$result
?
$result
->
fetchAll
()
:
array
();
...
...
@@ -181,7 +181,7 @@ function _testQueries() {
foreach
(
$queries
as
$query
=>
$results
)
{
$result
=
db_select
(
'search_index'
,
'i'
)
->
extend
(
'Drupal\search\SearchQuery'
)
->
searchExpression
(
$query
,
SEARCH_TYPE_2
)
->
searchExpression
(
$query
,
static
::
SEARCH_TYPE_2
)
->
execute
();
$set
=
$result
?
$result
->
fetchAll
()
:
array
();
...
...
@@ -204,7 +204,7 @@ function _testQueries() {
foreach
(
$queries
as
$query
=>
$results
)
{
$result
=
db_select
(
'search_index'
,
'i'
)
->
extend
(
'Drupal\search\SearchQuery'
)
->
searchExpression
(
$query
,
SEARCH_TYPE_JPN
)
->
searchExpression
(
$query
,
static
::
SEARCH_TYPE_JPN
)
->
execute
();
$set
=
$result
?
$result
->
fetchAll
()
:
array
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment