some WebGUI::Test cleanups
This commit is contained in:
parent
492259c93a
commit
421b9652cf
1 changed files with 13 additions and 13 deletions
|
|
@ -39,6 +39,7 @@ use List::MoreUtils qw( any );
|
||||||
use Carp qw( carp croak );
|
use Carp qw( carp croak );
|
||||||
use JSON qw( from_json to_json );
|
use JSON qw( from_json to_json );
|
||||||
use Scope::Guard;
|
use Scope::Guard;
|
||||||
|
use Try::Tiny;
|
||||||
use WebGUI::Paths -inc;
|
use WebGUI::Paths -inc;
|
||||||
|
|
||||||
our $WEBGUI_TEST_ROOT = File::Spec->catdir(
|
our $WEBGUI_TEST_ROOT = File::Spec->catdir(
|
||||||
|
|
@ -149,7 +150,6 @@ sub newSession {
|
||||||
return $session;
|
return $session;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 mockAssetId ( $assetId, $object )
|
=head2 mockAssetId ( $assetId, $object )
|
||||||
|
|
@ -827,7 +827,14 @@ Example call:
|
||||||
},
|
},
|
||||||
'SQL' => sub {
|
'SQL' => sub {
|
||||||
my (undef, $sql) = @_;
|
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 {
|
'CODE' => sub {
|
||||||
(shift)->();
|
(shift)->();
|
||||||
},
|
},
|
||||||
'SQL' => 'execute',
|
'SQL' => sub {
|
||||||
|
(shift)->();
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
sub cleanupGuard {
|
sub cleanupGuard {
|
||||||
|
|
@ -993,7 +1002,7 @@ This is a class method.
|
||||||
my @guarded;
|
my @guarded;
|
||||||
sub addToCleanup {
|
sub addToCleanup {
|
||||||
shift
|
shift
|
||||||
if eval { $_[0]->isa($CLASS) };
|
if try { $_[0]->isa($CLASS) };
|
||||||
push @guarded, cleanupGuard(@_);
|
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;
|
1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue