Part validate
[kivitendo-erp.git] / t / 000setup_database.t
index b4ebd13..53b5ffe 100755 (executable)
@@ -10,6 +10,7 @@ use Test::More;
 use SL::Auth;
 use SL::DBConnect;
 use SL::Form;
+use SL::InstanceConfiguration;
 use SL::LXDebug;
 use SL::Layout::None;
 use SL::LxOfficeConf;
@@ -53,6 +54,7 @@ sub setup {
   $::form          = Form->new;
   $::auth          = SL::Auth->new(unit_tests_database => 1);
   $::locale        = Locale->new('de');
+  $::instance_conf = SL::InstanceConfiguration->new;
   $db_cfg          = $::lx_office_conf{'testing/database'};
 }
 
@@ -64,7 +66,6 @@ sub drop_and_create_database {
     SL::DBConnect->get_options,
   );
 
-  $::auth->reset;
   my $dbh_template = SL::DBConnect->connect(@dbi_options) || BAIL_OUT("No database connection to the template database: " . $DBI::errstr);
   my $auth_dbh     = $::auth->dbconnect(1);
 
@@ -73,8 +74,6 @@ sub drop_and_create_database {
     $auth_dbh->disconnect;
 
     dbh_do($dbh_template, "DROP DATABASE \"" . $db_cfg->{db} . "\"", message => "Database could not be dropped");
-
-    $::auth->reset;
   }
 
   dbg("Creating database");
@@ -177,7 +176,7 @@ sub create_client_user_and_employee {
   dbh_do($dbh, $sth, bind => [ $_, $config{$_} ]) for sort keys %config;
   $sth->finish;
 
-  my $sth = $dbh->prepare(qq|INSERT INTO auth.group_rights (group_id, "right", granted) VALUES (1, ?, TRUE)|) || BAIL_OUT($dbh->errstr);
+  $sth = $dbh->prepare(qq|INSERT INTO auth.group_rights (group_id, "right", granted) VALUES (1, ?, TRUE)|) || BAIL_OUT($dbh->errstr);
   dbh_do($dbh, $sth, bind => [ $_ ]) for sort $::auth->all_rights;
   $sth->finish;