Bugzilla – Attachment 99441 Details for
Bug 19821
Run tests on a separate database
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19821: Require database_test != database
Bug-19821-Require-databasetest--database.patch (text/plain), 1.97 KB, created by
Bouzid Fergani
on 2020-02-21 20:21:58 UTC
(
hide
)
Description:
Bug 19821: Require database_test != database
Filename:
MIME Type:
Creator:
Bouzid Fergani
Created:
2020-02-21 20:21:58 UTC
Size:
1.97 KB
patch
obsolete
>From f0fad0e629fd6adadf02b3d18bf93f75ea4f8be9 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 2 Nov 2018 11:00:01 -0300 >Subject: [PATCH] Bug 19821: Require database_test != database > >To prevent developpers to drop their database. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com> >--- > t/lib/Bootstrap.pm | 14 +++++++++----- > 1 file changed, 9 insertions(+), 5 deletions(-) > >diff --git a/t/lib/Bootstrap.pm b/t/lib/Bootstrap.pm >index fbba437..dd74914 100644 >--- a/t/lib/Bootstrap.pm >+++ b/t/lib/Bootstrap.pm >@@ -6,7 +6,7 @@ use DBI; > use File::Temp qw( tempfile ); > use XML::LibXML; > >-our $database; >+our ( $database, $database_test ); > sub import { > my ($self, %args) = @_; > >@@ -15,7 +15,10 @@ sub import { > > my $host = C4::Context->config('hostname'); > my $port = C4::Context->config('port'); >- $database = C4::Context->config("database_test") || C4::Context->config('database'); >+ $database_test = C4::Context->config("database_test") or die "Config entry 'database_test' does not exist"; >+ $database = C4::Context->config('database'); >+ die "Entries 'database_test' and 'database' have the same value in your config" >+ if $database_test eq $database; > my $user = C4::Context->config('user'); > my $pass = C4::Context->config('pass'); > >@@ -24,14 +27,15 @@ sub import { > PrintError => 0, > }); > >- $dbh->do("DROP DATABASE IF EXISTS $database"); >- $dbh->do("CREATE DATABASE $database"); >+ $dbh->do("DROP DATABASE IF EXISTS $database_test"); >+ $dbh->do("CREATE DATABASE $database_test"); > > } > > END { > my $dbh = C4::Context->dbh; >- $dbh->do("DROP DATABASE IF EXISTS $database") if $database; >+ $dbh->do("DROP DATABASE IF EXISTS $database_test") >+ if $database_test && $database_test ne $database; > Koha::Caches->get_instance()->flush_all; > Koha::Caches->get_instance('config')->flush_all; > }; >-- >2.7.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 19821
:
69825
|
69842
|
69843
|
69844
|
71817
|
75045
|
75091
|
75092
|
81893
|
81894
|
81895
|
81896
|
81897
|
81898
|
81899
|
81900
|
99435
|
99436
|
99437
|
99438
|
99439
|
99440
|
99441
|
103409
|
103410
|
103411
|
103412
|
103413
|
103414
|
103415
|
105876
|
105877
|
105878
|
105879
|
105880
|
105881
|
105882
|
120417
|
120418
|
120419
|
120420
|
120421
|
120422
|
120423