Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3174996
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Issue forks
drupal-3174996
Commits
5e576223
Commit
5e576223
authored
16 years ago
by
Angie Byron
Browse files
Options
Downloads
Patches
Plain Diff
#308233
by robertDouglass: Tests for the advanced search form.
parent
1c0e1c39
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/search/search.test
+69
-0
69 additions, 0 deletions
modules/search/search.test
with
69 additions
and
0 deletions
modules/search/search.test
+
69
−
0
View file @
5e576223
...
...
@@ -196,6 +196,75 @@ class SearchBikeShed extends DrupalWebTestCase {
}
}
class
SearchAdvancedSearchForm
extends
DrupalWebTestCase
{
protected
$node
;
/**
* Implementation of getInfo().
*/
function
getInfo
()
{
return
array
(
'name'
=>
t
(
'Advanced search form'
),
'description'
=>
t
(
'Indexes content and tests the advanced search form.'
),
'group'
=>
t
(
'Search'
),
);
}
/**
* Implementation of setUp().
*/
function
setUp
()
{
parent
::
setUp
(
'search'
);
// Create and login user.
$test_user
=
$this
->
drupalCreateUser
(
array
(
'access content'
,
'search content'
,
'use advanced search'
,
'administer nodes'
));
$this
->
drupalLogin
(
$test_user
);
// Create initial node.
$node
=
$this
->
drupalCreateNode
();
$this
->
node
=
$this
->
drupalCreateNode
();
// First update the index. This does the initial processing.
node_update_index
();
// 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
();
}
/**
* Test using the search form with GET and POST queries.
* Test using the advanced search form to limit search to pages.
*/
function
testNodeType
()
{
$this
->
assertTrue
(
$this
->
node
->
type
==
'page'
,
t
(
'Node type is page.'
));
// Assert that the dummy title doesn't equal the real title.
$dummy_title
=
'Lorem ipsum'
;
$this
->
assertNotEqual
(
$dummy_title
,
$this
->
node
->
title
,
t
(
"Dummy title doens't equal node title"
));
// Search for the dummy title with a GET query.
$this
->
drupalGet
(
'search/node/'
.
drupal_urlencode
(
$dummy_title
));
$this
->
assertNoText
(
$this
->
node
->
title
,
t
(
'Page node is not found with dummy title.'
));
// Search for the title of the node with a GET query.
$this
->
drupalGet
(
'search/node/'
.
drupal_urlencode
(
$this
->
node
->
title
));
$this
->
assertText
(
$this
->
node
->
title
,
t
(
'Page node is found with GET query.'
));
// Search for the title of the node with a POST query.
$edit
=
array
(
'or'
=>
$this
->
node
->
title
);
$this
->
drupalPost
(
'search/node'
,
$edit
,
t
(
'Advanced search'
));
$this
->
assertText
(
$this
->
node
->
title
,
t
(
'Page node is found with POST query.'
));
// Advanced search type option.
$this
->
drupalPost
(
'search/node'
,
array_merge
(
$edit
,
array
(
'type[page]'
=>
'page'
)),
t
(
'Advanced search'
));
$this
->
assertText
(
$this
->
node
->
title
,
t
(
'Page node is found with POST query and type:page.'
));
$this
->
drupalPost
(
'search/node'
,
array_merge
(
$edit
,
array
(
'type[article]'
=>
'article'
)),
t
(
'Advanced search'
));
$this
->
assertText
(
'bike shed'
,
t
(
'Article node is not found with POST query and type:article.'
));
}
}
class
SearchRankingTestCase
extends
DrupalWebTestCase
{
/**
* Implementation of getInfo().
...
...
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