Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Links in wiki search to add a missing page should encode the titles t…
…o make them URL safe. Fixes bug #11883.
- Loading branch information
1 parent
dec9105
commit 0e8d5cf
Showing
3 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# vim:syntax=perl | ||
#------------------------------------------------------------------- | ||
# WebGUI is Copyright 2001-2009 Plain Black Corporation. | ||
#------------------------------------------------------------------- | ||
# Please read the legal notices (docs/legal.txt) and the license | ||
# (docs/license.txt) that came with this distribution before using | ||
# this software. | ||
#------------------------------------------------------------------ | ||
# http://www.plainblack.com info@plainblack.com | ||
#------------------------------------------------------------------ | ||
|
||
# Test the featured page of the Wiki | ||
# | ||
# | ||
|
||
use FindBin; | ||
use strict; | ||
use lib "$FindBin::Bin/../../../lib"; | ||
use Test::More; | ||
use Test::Deep; | ||
use WebGUI::Test; # Must use this before any other WebGUI modules | ||
use WebGUI::Session; | ||
|
||
#---------------------------------------------------------------------------- | ||
# Init | ||
my $session = WebGUI::Test->session; | ||
my $import = WebGUI::Asset->getImportNode( $session ); | ||
|
||
my $templateId = 'WIKIMASTER_TEMPLATE___'; | ||
|
||
my $templateMock = Test::MockObject->new({}); | ||
$templateMock->set_isa('WebGUI::Asset::Template'); | ||
$templateMock->set_always('getId', $templateId); | ||
my $templateVars; | ||
$templateMock->mock('process', sub { $templateVars = $_[1]; } ); | ||
|
||
my $wiki | ||
= $import->addChild( { | ||
className => 'WebGUI::Asset::Wobject::WikiMaster', | ||
searchTemplateId => $templateId, | ||
} ); | ||
|
||
WebGUI::Test->addToCleanup($wiki); | ||
|
||
#---------------------------------------------------------------------------- | ||
# Tests | ||
|
||
plan tests => 1; # Increment this number for each test you create | ||
|
||
$session->request->setup_body({ | ||
query => 'Red&Andy', | ||
}); | ||
|
||
{ | ||
WebGUI::Test->mockAssetId($templateId, $templateMock); | ||
$wiki->www_search(); | ||
WebGUI::Test->unmockAssetId($templateId); | ||
} | ||
|
||
is $templateVars->{addPageUrl}, | ||
$wiki->getUrl('func=add;class=WebGUI::Asset::WikiPage;title=Red%26Andy'), | ||
'search encodes unsafe characters in addPageUrl'; | ||
|
||
#---------------------------------------------------------------------------- | ||
# | ||
|
||
#vim:ft=perl |