Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3421017
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-3421017
Commits
ce81be0c
Commit
ce81be0c
authored
16 years ago
by
Angie Byron
Browse files
Options
Downloads
Patches
Plain Diff
#292565
by John Morahan and lyricnz: Fix 404 on search form from a 404 page (with tests).
parent
d7fa0f82
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
includes/form.inc
+6
-0
6 additions, 0 deletions
includes/form.inc
modules/search/search.test
+31
-1
31 additions, 1 deletion
modules/search/search.test
with
37 additions
and
1 deletion
includes/form.inc
+
6
−
0
View file @
ce81be0c
...
...
@@ -629,6 +629,12 @@ function drupal_redirect_form($form, $redirect = NULL) {
}
if
(
!
isset
(
$goto
)
||
(
$goto
!==
FALSE
))
{
if
(
isset
(
$goto
))
{
// Remove any fake destination set by drupal_not_found() or
// drupal_access_denied() so that we can properly redirect from those
// pages.
if
(
isset
(
$_REQUEST
[
'destination'
])
&&
$_REQUEST
[
'destination'
]
==
$_GET
[
'q'
])
{
unset
(
$_REQUEST
[
'destination'
]);
}
if
(
is_array
(
$goto
))
{
call_user_func_array
(
'drupal_goto'
,
$goto
);
}
...
...
This diff is collapsed.
Click to expand it.
modules/search/search.test
+
31
−
1
View file @
ce81be0c
...
...
@@ -383,8 +383,13 @@ class SearchBlockTestCase extends DrupalWebTestCase {
parent
::
setUp
(
'search'
);
// Create and login user
$admin_user
=
$this
->
drupalCreateUser
(
array
(
'administer blocks'
));
$admin_user
=
$this
->
drupalCreateUser
(
array
(
'administer blocks'
,
'search content'
));
$this
->
drupalLogin
(
$admin_user
);
// Disable the theme form to avoid confusion.
$settings
=
theme_get_settings
();
$settings
[
'toggle_search'
]
=
FALSE
;
variable_set
(
'theme_settings'
,
$settings
);
}
function
testSearchFormBlock
()
{
...
...
@@ -398,4 +403,29 @@ class SearchBlockTestCase extends DrupalWebTestCase {
$this
->
drupalPost
(
'admin/build/block'
,
$edit
,
t
(
'Save blocks'
));
$this
->
assertText
(
t
(
'The block settings have been updated.'
),
t
(
'Block successfully move to footer region.'
));
}
/**
* Test that the search block form works correctly.
*/
function
testBlock
()
{
// Enable the block, and place it in the 'content' region so that it isn't
// hidden on 404 pages.
$edit
=
array
(
'search_form[region]'
=>
'content'
);
$this
->
drupalPost
(
'admin/build/block'
,
$edit
,
t
(
'Save blocks'
));
// Test a normal search via the block form, from the front page.
$terms
=
array
(
'search_block_form'
=>
'test'
);
$this
->
drupalPost
(
'node'
,
$terms
,
t
(
'Search'
));
$this
->
assertText
(
'Your search yielded no results'
);
// Test a search from the block on a 404 page.
$this
->
drupalPost
(
'foo'
,
$terms
,
t
(
'Search'
));
$this
->
assertText
(
'Your search yielded no results'
);
// Test a search from the block when it doesn't appear on the search page.
$edit
=
array
(
'pages'
=>
'search'
);
$this
->
drupalPost
(
'admin/build/block/configure/search/form'
,
$edit
,
t
(
'Save block'
));
$this
->
drupalPost
(
'node'
,
$terms
,
t
(
'Search'
));
$this
->
assertText
(
'Your search yielded no results'
);
}
}
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