diff --git a/lib/WebGUI/Shop/Credit.pm b/lib/WebGUI/Shop/Credit.pm index 045161d63..50ef0f85b 100644 --- a/lib/WebGUI/Shop/Credit.pm +++ b/lib/WebGUI/Shop/Credit.pm @@ -9,7 +9,6 @@ has [ qw/session userId/ ] => ( required => 1, ); - use WebGUI::Shop::Admin; use WebGUI::Exception::Shop; use WebGUI::International; @@ -43,8 +42,11 @@ around BUILDARGS => sub { ##Original arguments start here. my $protoSession = $_[0]; if (blessed $protoSession && $protoSession->isa('WebGUI::Session')) { - return $className->$orig(session => $protoSession, userId => $_[1], ); + warn "got a session\n"; + my $userId = $_[1] ? $_[1] : $protoSession->user->userId; + return $className->$orig(session => $protoSession, userId => $userId, ); } + warn "no session\n"; return $className->$orig(@_); }; diff --git a/t/Asset/Template.t b/t/Asset/Template.t index 3e7a827cf..5b14a634a 100644 --- a/t/Asset/Template.t +++ b/t/Asset/Template.t @@ -15,6 +15,7 @@ use WebGUI::Session; use WebGUI::Asset::Template; use Exception::Class; +use Test::More; use Test::Deep; use Data::Dumper; use Test::Exception; diff --git a/t/Asset/Wobject/WikiMaster/search.t b/t/Asset/Wobject/WikiMaster/search.t index 0b97c9709..8dc1dbea6 100644 --- a/t/Asset/Wobject/WikiMaster/search.t +++ b/t/Asset/Wobject/WikiMaster/search.t @@ -19,6 +19,7 @@ use lib "$FindBin::Bin/../../../lib"; use Test::More; use Test::Deep; use WebGUI::Test; # Must use this before any other WebGUI modules +use WebGUI::Test::MockAsset; use WebGUI::Session; #---------------------------------------------------------------------------- @@ -28,9 +29,9 @@ 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 $templateMock = WebGUI::Test::MockAsset->new('WebGUI::Asset::Template'); +$templateMock->mock_id($templateId); +$templateMock->set_true('prepare'); my $templateVars; $templateMock->mock('process', sub { $templateVars = $_[1]; } ); @@ -52,9 +53,7 @@ $session->request->setup_body({ }); { - WebGUI::Test->mockAssetId($templateId, $templateMock); $wiki->www_search(); - WebGUI::Test->unmockAssetId($templateId); } is $templateVars->{addPageUrl}, diff --git a/t/Content/Asset.t b/t/Content/Asset.t index 70ee5141a..994b5fe6e 100644 --- a/t/Content/Asset.t +++ b/t/Content/Asset.t @@ -206,7 +206,6 @@ $output = WebGUI::Content::Asset::dispatch( $session ); is $output, 'www_view one', 'an empty URL returns the default asset'; $session->setting->set('defaultPage', $originalDefaultPage); -<<<<<<< HEAD #---------------------------------------------------------------------------- # 304 Content Not Modified response diff --git a/t/Shop/Credit.t b/t/Shop/Credit.t index e5721673e..d63a6b75c 100644 --- a/t/Shop/Credit.t +++ b/t/Shop/Credit.t @@ -37,11 +37,6 @@ my $session = WebGUI::Test->session; plan tests => 27; -#---------------------------------------------------------------------------- -# figure out if the test can actually run - -my $e; - ####################################################################### # # new @@ -54,6 +49,8 @@ WebGUI::Test->addToCleanup($credit_user); # Test incorrect for parameters +my $e; + eval { $credit = WebGUI::Shop::Credit->new(); }; $e = Exception::Class->caught(); isa_ok ($e, 'WebGUI::Error::InvalidParam', 'new takes exception to not giving it a session object'); diff --git a/t/run_forms.t b/t/run_forms.t index a3ea10227..74fa5a9af 100644 --- a/t/run_forms.t +++ b/t/run_forms.t @@ -8,8 +8,19 @@ # http://www.plainblack.com info@plainblack.com #------------------------------------------------------------------- -use File::Spec::Functions qw( catdir rel2abs ); -use File::Basename; -use File::Basename qw( dirname ); -use Test::Class::Load rel2abs( catdir ( dirname( __FILE__ ), 'tests' ) ); +BEGIN { + + use File::Spec::Functions qw( catdir rel2abs ); + use File::Basename; + use Test::More; + use Test::Class; + use Module::Find; + use lib rel2abs( catdir ( dirname( __FILE__ ), 'tests' ) ); + +# plan skip_all => "Extremely slow asset tests only run if WEBGUI_ASSET_TESTS set" +# unless $ENV{WEBGUI_ASSET_TESTS}; + useall('Test::WebGUI::Form'); +} + Test::Class->runtests; +