Bugzilla – Attachment 142453 Details for
Bug 31870
Cleaning up t/db_dependent/Context.t
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31870: Groundwork for Context.t
Bug-31870-Groundwork-for-Contextt.patch (text/plain), 3.05 KB, created by
Katrin Fischer
on 2022-10-22 10:10:43 UTC
(
hide
)
Description:
Bug 31870: Groundwork for Context.t
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2022-10-22 10:10:43 UTC
Size:
3.05 KB
patch
obsolete
>From 0d6d2e8899b344417da64520ce1928de087ba675 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Tue, 18 Oct 2022 14:32:01 +0000 >Subject: [PATCH] Bug 31870: Groundwork for Context.t > >Replacing the vars statement. >Adding a larger subtest. >Removing TransformVersionToNum. > >Test plan: >Run t/db_dependent/Context.t > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > t/db_dependent/Context.t | 38 ++++++++++++++++++-------------------- > 1 file changed, 18 insertions(+), 20 deletions(-) > >diff --git a/t/db_dependent/Context.t b/t/db_dependent/Context.t >index 9b954efb24..4984d5cadf 100755 >--- a/t/db_dependent/Context.t >+++ b/t/db_dependent/Context.t >@@ -1,16 +1,16 @@ > #!/usr/bin/perl > > use Modern::Perl; >- >-use Test::More; >+use Test::More tests => 4; > use Test::MockModule; >-use vars qw($koha $dbh $config $ret); >+ > use t::lib::Mocks; >+use t::lib::TestBuilder; > > use Koha::Database; > > BEGIN { >- >+ my $ret; > # Note: The overall number of tests may vary by configuration. > # First we need to check your environmental variables > for (qw(KOHA_CONF PERL5LIB)) { >@@ -19,9 +19,16 @@ BEGIN { > use_ok('C4::Context'); > } > >+our $schema; >+$schema = Koha::Database->new->schema; >+ >+subtest 'Original tests' => sub { >+plan tests => 33; >+$schema->storage->txn_begin; >+ >+my $dbh; > ok($dbh = C4::Context->dbh(), 'Getting dbh from C4::Context'); > >-$dbh->begin_work; > C4::Context->set_preference('OPACBaseURL','junk'); > C4::Context->clear_syspref_cache(); > my $OPACBaseURL = C4::Context->preference('OPACBaseURL'); >@@ -47,8 +54,9 @@ my $SillyPeference = C4::Context->preference('SillyPreference'); > is($SillyPeference,'random','SillyPreference saved as specified'); > C4::Context->clear_syspref_cache(); > C4::Context->enable_syspref_cache(); >-$dbh->rollback; >+#$dbh->rollback; > >+my $koha; > ok($koha = C4::Context->new, 'C4::Context->new'); > my @keys = keys %$koha; > my $width = 0; >@@ -62,11 +70,12 @@ foreach (sort @keys) { > . ((defined $koha->{$_}) ? "and is defined." : "but is not defined.") > ); > } >+my $config; > ok($config = $koha->{config}, 'Getting $koha->{config} '); > > # Testing syspref caching > >-my $schema = Koha::Database->new()->schema(); >+#my $schema = Koha::Database->new()->schema(); > $schema->storage->debug(1); > my $trace_read; > open my $trace, '>', \$trace_read or die "Can't open variable: $!"; >@@ -131,17 +140,6 @@ C4::Context->set_preference('AutoEmailNewUser', ''); > my $yesno_pref = Koha::Config::SysPrefs->find('AutoEmailNewUser'); > is( $yesno_pref->value(), 0, 'set_preference should have set the value to 0, instead of an empty string' ); > >-done_testing(); >- >-sub TransformVersionToNum { >- my $version = shift; > >- # remove the 3 last . to have a Perl number >- $version =~ s/(.*\..*)\.(.*)\.(.*)/$1$2$3/; >- >- # three X's at the end indicate that you are testing patch with dbrev >- # change it into 999 >- # prevents error on a < comparison between strings (should be: lt) >- $version =~ s/XXX$/999/; >- return $version; >-} >+ $schema->storage->txn_rollback; >+}; >-- >2.30.2
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 31870
:
142149
|
142150
|
142151
|
142152
| 142453 |
142454
|
142455
|
142456