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
|
=cut
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my ($class, $databaseLinkId, %databaseLink);
|
my $class = shift;
|
||||||
tie %databaseLink, 'Tie::CPHash';
|
my $session = shift;
|
||||||
$class = shift;
|
my $databaseLinkId = shift;
|
||||||
my $session = shift;
|
tie my %databaseLink, 'Tie::CPHash';
|
||||||
$databaseLinkId = shift;
|
|
||||||
unless ($databaseLinkId eq "") {
|
unless ($databaseLinkId eq "") {
|
||||||
if ($databaseLinkId eq "0") {
|
if ($databaseLinkId eq "0") {
|
||||||
%databaseLink = (
|
%databaseLink = (
|
||||||
|
|
|
||||||
|
|
@ -118,9 +118,9 @@ my @testSets = (
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
my $numTests = scalar @testSets;
|
my $numTests = scalar @testSets
|
||||||
|
+ 2
|
||||||
++$numTests; ##For the allow macro access test;
|
;
|
||||||
|
|
||||||
plan tests => $numTests;
|
plan tests => $numTests;
|
||||||
|
|
||||||
|
|
@ -144,6 +144,15 @@ foreach my $testSet (@testSets) {
|
||||||
# reset allowMacroAccess to original value
|
# reset allowMacroAccess to original value
|
||||||
$WebGUIdbLink->set({allowMacroAccess=>$originalMacroAccessValue});
|
$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 {
|
END {
|
||||||
$session->db->dbh->do('DROP TABLE testTable');
|
$session->db->dbh->do('DROP TABLE testTable');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue