diff --git a/t/SQL.t b/t/SQL.t index 955454e93..7c3982a87 100644 --- a/t/SQL.t +++ b/t/SQL.t @@ -174,6 +174,7 @@ SKIP: { skip("No InnoDB tables in this MySQL. Skipping all transaction related tests.",7) if (lc $mysqlVariables{have_innodb} ne 'yes'); $session->db->dbh->do('DROP TABLE IF EXISTS testTable'); $session->db->dbh->do('CREATE TABLE testTable (myIndex int(8) NOT NULL default 0, message CHAR(64), PRIMARY KEY(myIndex)) TYPE=InnoDB'); + addToCleanup( sub { $session->db->dbh->do('DROP TABLE testTable') }); my $dbh2 = WebGUI::SQL->connect($session,$session->config->get("dsn"), $session->config->get("dbuser"), $session->config->get("dbpass")); my ($sth, $sth2, $rc); @@ -298,6 +299,3 @@ cmp_deeply( 'Check table structure', ); -END { - $session->db->dbh->do('DROP TABLE IF EXISTS testTable'); -} diff --git a/t/lib/WebGUI/Test.pm b/t/lib/WebGUI/Test.pm index f1c3dfa8a..53d0c2eae 100644 --- a/t/lib/WebGUI/Test.pm +++ b/t/lib/WebGUI/Test.pm @@ -895,6 +895,9 @@ Example call: my $link = shift; $link->session->db->write("delete from ldapLink where ldapLinkId=?", [$link->{ldapLinkId}]); }, + 'CODE' => sub { + (shift)->(); + }, ); sub cleanupGuard { @@ -906,9 +909,9 @@ Example call: my $construct; if ( ref $class ) { my $object = $class; + $class = ref $class; my $cloneSub = $CLASS->_findByIsa($class, \%clone); $construct = $cloneSub ? sub { $object->$cloneSub } : sub { $object }; - $class = ref $class; } else { my $id = shift; @@ -958,7 +961,7 @@ sub _findByIsa { my $toFind = shift; my $hash = shift; for my $key ( sort { length $b <=> length $a} keys %$hash ) { - if ($toFind->isa($key)) { + if ($toFind eq $key || $toFind->isa($key)) { return $hash->{$key}; } }