From b77f98ed6a9b0375de6fc42d2922b056fc97f164 Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Wed, 28 Jul 2010 14:56:24 -0500 Subject: [PATCH] test ?func= dispatch with unhandled fragment --- t/Asset/dispatch.t | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/t/Asset/dispatch.t b/t/Asset/dispatch.t index 8846ca1bd..b001a715d 100644 --- a/t/Asset/dispatch.t +++ b/t/Asset/dispatch.t @@ -57,13 +57,16 @@ WebGUI::Test->addToCleanup( $tag ); #---------------------------------------------------------------------------- # Tests -plan tests => 5; # Increment this number for each test you create +plan tests => 7; # Increment this number for each test you create #---------------------------------------------------------------------------- # Test dispatch # Add a TestDispatch asset and test -my $td = WebGUI::Asset->getImportNode( $session )->addChild( { className => 'WebGUI::Asset::TestDispatch' } ); +my $td = WebGUI::Asset->getImportNode( $session )->addChild( { + url => 'testDispatch', + className => 'WebGUI::Asset::TestDispatch', +} ); is( $td->dispatch, "www_view", "dispatch with no fragment shows www_view" ); is( $td->dispatch( '/foo' ), 'bar', 'dispatch detects fragment and returns' ); ok( !$td->dispatch( '/unhandled' ), 'dispatch with unknown fragment returns false' ); @@ -75,4 +78,7 @@ $session->request->setup_body( { is( $td->dispatch, "www_edit", "dispatch handles ?func= query param" ); is( $td->dispatch( '/foo' ), "bar", "overridden dispatch trumps ?func= query param" ); +# Test func= can only be run on the exact asset we requested +isnt( $td->dispatch( '/bar' ), "www_edit", "?func= dispatch cancelled because of unhandled fragment" ); + #vim:ft=perl