From b78e23e6586ab19f56f32676eb53a9459a342e6a Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 20 Oct 2021 11:08:02 +0200 Subject: [PATCH] Bug 19185: DB must exist but empty --- t/db_dependent/selenium/00-installation.t | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/t/db_dependent/selenium/00-installation.t b/t/db_dependent/selenium/00-installation.t index 42fd360c14..9ee3a27bea 100644 --- a/t/db_dependent/selenium/00-installation.t +++ b/t/db_dependent/selenium/00-installation.t @@ -44,6 +44,24 @@ SKIP: { eval { require Selenium::Remote::Driver; }; skip "Selenium::Remote::Driver is needed for selenium tests.", 2 if $@; + skip "This test must be run with an empty DB. We are using KOHA_TESTING that is set by our CI\nIf you really want to run it, set this env var.", 2 unless $ENV{KOHA_TESTING}; + + my $dbh = eval { C4::Context->dbh; }; + skip "Tests won't run if the database does not exist", 2 if $@; + + { + my $dup_err; + local *STDERR; + open STDERR, ">>", \$dup_err; + $dbh->do(q| + SELECT * FROM systempreferences WHERE 1 = 0 | + ); + close STDERR; + if ( $dup_err ) { + skip "Tests won't run if the database is not empty", 2 if $@; + } + } + my $s = t::lib::Selenium->new; my $driver = $s->driver; -- 2.25.1