From 81bdc7640c9e9a303d195ed22c8dcefb305ab874 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Sun, 13 Jul 2008 02:03:21 +0000 Subject: [PATCH] Fix a typo in the PageUrl POD. Add tests for the new query argument to the PageUrl macro. --- lib/WebGUI/Macro/PageUrl.pm | 2 +- t/Macro/PageUrl.t | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/WebGUI/Macro/PageUrl.pm b/lib/WebGUI/Macro/PageUrl.pm index 61d5f2d3a..2c9fc97ee 100644 --- a/lib/WebGUI/Macro/PageUrl.pm +++ b/lib/WebGUI/Macro/PageUrl.pm @@ -21,7 +21,7 @@ Package WebGUI::Macro::Page Macro for displaying the url for the current asset. -=head2 process ( $session, $url ) +=head2 process ( $session, $url, $query ) process is really a wrapper around $session->url->page(); diff --git a/t/Macro/PageUrl.t b/t/Macro/PageUrl.t index db5610d9e..2958f362f 100644 --- a/t/Macro/PageUrl.t +++ b/t/Macro/PageUrl.t @@ -20,7 +20,7 @@ use Test::More; # increment this value for each test you create my $session = WebGUI::Test->session; -my $numTests = 5; +my $numTests = 7; $numTests += 1; #For the use_ok plan tests => $numTests; @@ -49,6 +49,12 @@ is($output, $session->url->gateway.$homeAsset->get('url'), 'fetching url for sit $output = WebGUI::Macro::PageUrl::process($session, '/sub/page'); is($output, $session->url->gateway.$homeAsset->get('url').'/sub/page', 'fetching url for site default asset with sub url'); +$output = WebGUI::Macro::PageUrl::process($session, '/sub/page', 'query=this'); +is($output, $session->url->gateway.$homeAsset->get('url').'/sub/page?query=this', 'Using the query argument to the macro'); + +$output = WebGUI::Macro::PageUrl::process($session, '', 'query=this'); +is($output, $session->url->gateway.$homeAsset->get('url').'?query=this', 'Using the query argument to the macro with no URL fragment'); + $session->setting->set('preventProxyCache', 1); $output = WebGUI::Macro::PageUrl::process($session); @@ -57,11 +63,9 @@ like($output, qr{\?noCache=\d+:\d+$}, 'checking the cache settings in the page U $output = WebGUI::Macro::PageUrl::process($session, '/sub/page'); like($output, qr{/sub/page\?noCache=\d+:\d+$}, 'checking the cache settings in the URL are at the end of the page URL'); -} +$output = WebGUI::Macro::PageUrl::process($session, '/sub/page', 'query=this'); +like($output, qr{/sub/page\?noCache=\d+:\d+;query=this$}, 'checking that the query arg works with preventProxyCache'); -TODO: { - local $TODO = "Tests to make later"; - ok(0, 'Fetch url from locally made asset with known url'); } END {