100% coverage on t/Macro/SQL.t. Refactor DatabaseLink.
This commit is contained in:
parent
dbf86bb850
commit
1c20f132eb
2 changed files with 17 additions and 9 deletions
|
|
@ -337,11 +337,10 @@ is reserved for the WebGUI database.
|
|||
=cut
|
||||
|
||||
sub new {
|
||||
my ($class, $databaseLinkId, %databaseLink);
|
||||
tie %databaseLink, 'Tie::CPHash';
|
||||
$class = shift;
|
||||
my $session = shift;
|
||||
$databaseLinkId = shift;
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $databaseLinkId = shift;
|
||||
tie my %databaseLink, 'Tie::CPHash';
|
||||
unless ($databaseLinkId eq "") {
|
||||
if ($databaseLinkId eq "0") {
|
||||
%databaseLink = (
|
||||
|
|
|
|||
|
|
@ -118,10 +118,10 @@ my @testSets = (
|
|||
},
|
||||
);
|
||||
|
||||
my $numTests = scalar @testSets;
|
||||
|
||||
++$numTests; ##For the allow macro access test;
|
||||
|
||||
my $numTests = scalar @testSets
|
||||
+ 2
|
||||
;
|
||||
|
||||
plan tests => $numTests;
|
||||
|
||||
$WebGUIdbLink->set({allowMacroAccess=>0});
|
||||
|
|
@ -144,6 +144,15 @@ foreach my $testSet (@testSets) {
|
|||
# reset allowMacroAccess to original value
|
||||
$WebGUIdbLink->set({allowMacroAccess=>$originalMacroAccessValue});
|
||||
|
||||
my $newLinkId = $WebGUIdbLink->copy;
|
||||
addToCleanup(WebGUI::DatabaseLink->new($session, $newLinkId));
|
||||
my $output = WebGUI::Macro::SQL::process(
|
||||
$session,
|
||||
q{show columns from testTable like 'zero'},
|
||||
q{^0;},
|
||||
$newLinkId,
|
||||
);
|
||||
is($output, 'zero', 'alternate linkId works');
|
||||
|
||||
END {
|
||||
$session->db->dbh->do('DROP TABLE testTable');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue