Bugzilla – Attachment 151242 Details for
Bug 33733
Move t/XSLT.t to db_dependent
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33733: Move to db_dependent
Bug-33733-Move-to-dbdependent.patch (text/plain), 6.59 KB, created by
David Nind
on 2023-05-16 02:59:16 UTC
(
hide
)
Description:
Bug 33733: Move to db_dependent
Filename:
MIME Type:
Creator:
David Nind
Created:
2023-05-16 02:59:16 UTC
Size:
6.59 KB
patch
obsolete
>From 809ab1076167f128ec10edb4a3c730e8305e6865 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Mon, 15 May 2023 07:13:06 +0000 >Subject: [PATCH] Bug 33733: Move to db_dependent > >The subtest is added to the existing db_dependent test. > >Test plan: >Run t/db_dependent/XSLT.t > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Signed-off-by: David Nind <david@davidnind.com> >--- > t/XSLT.t | 68 ------------------------------------------- > t/db_dependent/XSLT.t | 54 ++++++++++++++++++++++++++++++---- > 2 files changed, 49 insertions(+), 73 deletions(-) > delete mode 100755 t/XSLT.t > >diff --git a/t/XSLT.t b/t/XSLT.t >deleted file mode 100755 >index e3816fcf25..0000000000 >--- a/t/XSLT.t >+++ /dev/null >@@ -1,68 +0,0 @@ >-#!/usr/bin/perl >- >-# This file is part of Koha. >-# >-# Koha is free software; you can redistribute it and/or modify it >-# under the terms of the GNU General Public License as published by >-# the Free Software Foundation; either version 3 of the License, or >-# (at your option) any later version. >-# >-# Koha is distributed in the hope that it will be useful, but >-# WITHOUT ANY WARRANTY; without even the implied warranty of >-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >-# GNU General Public License for more details. >-# >-# You should have received a copy of the GNU General Public License >-# along with Koha; if not, see <http://www.gnu.org/licenses>. >- >-use Modern::Perl; >-use Test::More tests => 1; >- >-use File::Temp; >-use File::Path qw/make_path/; >- >-use t::lib::Mocks; >- >-use C4::XSLT; >- >-my $dir = File::Temp->newdir(); >-my @themes = ('prog', 'test'); >-my @langs = ('en', 'es-ES'); >- >-subtest 'Tests moved from t' => sub { >- plan tests => 8; >- >- # create temporary files to be tested later >- foreach my $theme (@themes) { >- foreach my $lang (@langs) { >- make_path("$dir/$theme/$lang/xslt"); >- open my $fh, '>', "$dir/$theme/$lang/xslt/my_file.xslt"; >- print $fh "Theme $theme, language $lang"; >- close $fh; >- } >- } >- >- sub find_and_slurp { >- my ($dir, $theme, $lang) = @_; >- >- my $filename = C4::XSLT::_get_best_default_xslt_filename($dir, $theme, $lang, 'my_file.xslt'); >- open my $fh, '<', $filename; >- my $str = <$fh>; >- close $fh; >- return $str; >- } >- >- # These tests verify that we're finding the right XSLT file when present, >- # and falling back to the right XSLT file when an exact match is not present. >- is(find_and_slurp($dir, 'test', 'en' ), 'Theme test, language en', 'Found test/en'); >- is(find_and_slurp($dir, 'test', 'es-ES'), 'Theme test, language es-ES', 'Found test/es-ES'); >- is(find_and_slurp($dir, 'prog', 'en', ), 'Theme prog, language en', 'Found test/en'); >- is(find_and_slurp($dir, 'prog', 'es-ES'), 'Theme prog, language es-ES', 'Found test/es-ES'); >- is(find_and_slurp($dir, 'test', 'fr-FR'), 'Theme test, language en', 'Fell back to test/en for test/fr-FR'); >- is(find_and_slurp($dir, 'nope', 'es-ES'), 'Theme prog, language es-ES', 'Fell back to prog/es-ES for nope/es-ES'); >- is(find_and_slurp($dir, 'nope', 'fr-FR'), 'Theme prog, language en', 'Fell back to prog/en for nope/fr-FR'); >- >- my $matching_string = q{<syspref name="singleBranchMode">0</syspref>}; >- my $sysprefs_xml = C4::XSLT::get_xslt_sysprefs(); >- ok( $sysprefs_xml =~ m/$matching_string/, 'singleBranchMode has a value of 0'); >-}; >diff --git a/t/db_dependent/XSLT.t b/t/db_dependent/XSLT.t >index 00c5ed52d7..5f79b35b13 100755 >--- a/t/db_dependent/XSLT.t >+++ b/t/db_dependent/XSLT.t >@@ -17,8 +17,10 @@ > > use Modern::Perl; > >+use File::Temp; >+use File::Path qw/make_path/; > use MARC::Record; >-use Test::More tests => 3; >+use Test::More tests => 4; > use Test::Warn; > use t::lib::TestBuilder; > use t::lib::Mocks; >@@ -34,10 +36,54 @@ BEGIN { > my $schema = Koha::Database->new->schema; > my $builder = t::lib::TestBuilder->new; > >-$schema->storage->txn_begin; >+subtest 'Tests moved from t' => sub { >+ plan tests => 8; >+ $schema->storage->txn_begin; >+ >+ my $dir = File::Temp->newdir(); >+ my @themes = ('prog', 'test'); >+ my @langs = ('en', 'es-ES'); >+ >+ # create temporary files to be tested later >+ foreach my $theme (@themes) { >+ foreach my $lang (@langs) { >+ make_path("$dir/$theme/$lang/xslt"); >+ open my $fh, '>', "$dir/$theme/$lang/xslt/my_file.xslt"; >+ print $fh "Theme $theme, language $lang"; >+ close $fh; >+ } >+ } >+ >+ sub find_and_slurp { >+ my ($dir, $theme, $lang) = @_; >+ >+ my $filename = C4::XSLT::_get_best_default_xslt_filename($dir, $theme, $lang, 'my_file.xslt'); >+ open my $fh, '<', $filename; >+ my $str = <$fh>; >+ close $fh; >+ return $str; >+ } >+ >+ # These tests verify that we're finding the right XSLT file when present, >+ # and falling back to the right XSLT file when an exact match is not present. >+ is(find_and_slurp($dir, 'test', 'en' ), 'Theme test, language en', 'Found test/en'); >+ is(find_and_slurp($dir, 'test', 'es-ES'), 'Theme test, language es-ES', 'Found test/es-ES'); >+ is(find_and_slurp($dir, 'prog', 'en', ), 'Theme prog, language en', 'Found test/en'); >+ is(find_and_slurp($dir, 'prog', 'es-ES'), 'Theme prog, language es-ES', 'Found test/es-ES'); >+ is(find_and_slurp($dir, 'test', 'fr-FR'), 'Theme test, language en', 'Fell back to test/en for test/fr-FR'); >+ is(find_and_slurp($dir, 'nope', 'es-ES'), 'Theme prog, language es-ES', 'Fell back to prog/es-ES for nope/es-ES'); >+ is(find_and_slurp($dir, 'nope', 'fr-FR'), 'Theme prog, language en', 'Fell back to prog/en for nope/fr-FR'); >+ >+ my $matching_string = q{<syspref name="singleBranchMode">0</syspref>}; >+ my $sysprefs_xml = C4::XSLT::get_xslt_sysprefs(); >+ ok( $sysprefs_xml =~ m/$matching_string/, 'singleBranchMode has a value of 0'); >+ >+ $schema->storage->txn_rollback; >+}; > > subtest 'buildKohaItemsNamespace status tests' => sub { > plan tests => 18; >+ $schema->storage->txn_begin; > > t::lib::Mocks::mock_preference('Reference_NFL_Statuses', '1|2'); > t::lib::Mocks::mock_preference( 'OPACResultsLibrary', 'holdingbranch' ); >@@ -152,12 +198,10 @@ subtest 'buildKohaItemsNamespace status tests' => sub { > like($xml,qr{<substatus>Recall waiting</substatus>},"Waiting status takes precedence over In transit (recalls)"); > t::lib::Mocks::mock_preference('UseRecalls', 0); > >+ $schema->storage->txn_rollback; > }; > >-$schema->storage->txn_rollback; >- > subtest 'buildKohaItemsNamespace() including/omitting items tests' => sub { >- > plan tests => 23; > > $schema->storage->txn_begin; >-- >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 33733
:
151185
|
151186
|
151187
|
151240
|
151241
|
151242
|
151265
|
151266
|
151267