diff --git a/t/lib/WebGUI/Test.pm b/t/lib/WebGUI/Test.pm index 3dccd24d4..2ac1fc2b7 100644 --- a/t/lib/WebGUI/Test.pm +++ b/t/lib/WebGUI/Test.pm @@ -39,6 +39,7 @@ use List::MoreUtils qw( any ); use Carp qw( carp croak ); use JSON qw( from_json to_json ); use Scope::Guard; +use Try::Tiny; use WebGUI::Paths -inc; our $WEBGUI_TEST_ROOT = File::Spec->catdir( @@ -149,7 +150,6 @@ sub newSession { return $session; } - #---------------------------------------------------------------------------- =head2 mockAssetId ( $assetId, $object ) @@ -827,7 +827,14 @@ Example call: }, 'SQL' => sub { my (undef, $sql) = @_; - return $CLASS->session->db->dbh->prepare($sql); + my $db = $CLASS->session->db; + my @params; + if ( ref $sql ) { + ( $sql, @params ) = @$sql; + } + return sub { + $db->do( $sql, {}, @params ); + } }, ); @@ -908,7 +915,9 @@ Example call: 'CODE' => sub { (shift)->(); }, - 'SQL' => 'execute', + 'SQL' => sub { + (shift)->(); + }, ); sub cleanupGuard { @@ -993,7 +1002,7 @@ This is a class method. my @guarded; sub addToCleanup { shift - if eval { $_[0]->isa($CLASS) }; + if try { $_[0]->isa($CLASS) }; push @guarded, cleanupGuard(@_); } @@ -1016,13 +1025,4 @@ sub cleanup { } } -#---------------------------------------------------------------------------- - -=head1 BUGS - -When trying to load the APR module, perl invariably throws an Out Of Memory -error. For this reason, getPage disables header processing. - -=cut - 1;