Bugzilla – Attachment 151098 Details for
Bug 17385
Add custom export formats for bibliographic records
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17385: Add tests for CustomXSLTExportList
Bug-17385-Add-tests-for-CustomXSLTExportList.patch (text/plain), 4.84 KB, created by
Hammat wele
on 2023-05-11 20:40:08 UTC
(
hide
)
Description:
Bug 17385: Add tests for CustomXSLTExportList
Filename:
MIME Type:
Creator:
Hammat wele
Created:
2023-05-11 20:40:08 UTC
Size:
4.84 KB
patch
obsolete
>From cf46454caeba82d144d6241b457468cf61261140 Mon Sep 17 00:00:00 2001 >From: Alexis Ripetti <alexis.ripetti@inLibro.com> >Date: Tue, 3 Nov 2020 16:48:54 -0500 >Subject: [PATCH] Bug 17385: Add tests for CustomXSLTExportList > >Tests are now in one patch. >One test does not pass and I am not able to fix it. > >The test who fails : > ><pre> >$ prove -l t/db_dependent/XSLT.t >t/db_dependent/XSLT.t .. 1/3 > # Failed test 'This list comes from the cache and that is fine' > # at t/db_dependent/XSLT.t line 122. > # got: '1' > # expected: '2' > # Looks like you failed 1 test of 1. > > # Failed test 'CustomXSLTExportList: Caching' > # at t/db_dependent/XSLT.t line 124. > # Looks like you failed 1 test of 3. >t/db_dependent/XSLT.t .. Dubious, test returned 1 (wstat 256, 0x100) >Failed 1/3 subtests > >Test Summary Report >------------------- >t/db_dependent/XSLT.t (Wstat: 256 Tests: 3 Failed: 1) > Failed test: 2 > Non-zero exit status: 1 >Files=1, Tests=3, 3 wallclock secs ( 0.03 usr 0.00 sys + 1.74 cusr 0.14 csys = 1.91 CPU) >Result: FAIL ></pre> > >This one works fine : > ><pre> >$ prove -l t/XSLT.t >t/XSLT.t .. ok >All tests successful. >Files=1, Tests=12, 4 wallclock secs ( 0.02 usr 0.00 sys + 2.55 cusr 0.17 csys = 2.74 CPU) >Result: PASS ></pre> >--- > t/XSLT.t | 39 +++++++++++++++++++++++++++++++++++---- > t/db_dependent/XSLT.t | 19 +++++++++++++++++++ > 2 files changed, 54 insertions(+), 4 deletions(-) > >diff --git a/t/XSLT.t b/t/XSLT.t >index e20a7b80e1..d80397e6ed 100755 >--- a/t/XSLT.t >+++ b/t/XSLT.t >@@ -21,13 +21,13 @@ use Test::More; > use File::Temp; > use File::Path qw/make_path/; > >-use t::lib::Mocks; >+use t::lib::Mocks qw( mock_preference ); > > use Module::Load::Conditional qw/check_install/; > > BEGIN { > if ( check_install( module => 'Test::DBIx::Class' ) ) { >- plan tests => 9; >+ plan tests => 12; > } else { > plan skip_all => "Need Test::DBIx::Class" > } >@@ -73,6 +73,37 @@ is(find_and_slurp($dir, 'test', 'fr-FR'), 'Theme test, language en', 'Fell ba > 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 $matching_string = q{<syspref name="singleBranchMode">[0|1]</syspref>}; > my $sysprefs_xml = C4::XSLT::get_xslt_sysprefs(); >-ok( $sysprefs_xml =~ m/$matching_string/, 'singleBranchMode has a value of 0'); >\ No newline at end of file >+ok( $sysprefs_xml =~ m/$matching_string/, 'singleBranchMode has no value'); >+ >+t::lib::Mocks::mock_config('opachtdocs', "$dir"); >+make_path("$dir/bootstrap/en/xslt/biblioexport"); >+ >+# Make XSL with title >+open my $fh, '>', "$dir/bootstrap/en/xslt/biblioexport/export_01.xsl"; >+print $fh qq|<?xml version="1.0" encoding="UTF-8"?> >+<xsl:stylesheet version="1.0" >+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >+ xmlns:marc="http://www.loc.gov/MARC21/slim" >+ title="Export 01"> >+</xsl:stylesheet>|; >+close $fh; >+ >+# Make XSL without title >+open $fh, '>', "$dir/bootstrap/en/xslt/biblioexport/export_02.xsl"; >+print $fh qq|<?xml version="1.0" encoding="UTF-8"?> >+<xsl:stylesheet version="1.0" >+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >+ xmlns:marc="http://www.loc.gov/MARC21/slim"> >+</xsl:stylesheet>|; >+close $fh; >+ >+open $fh, '>', "$dir/bootstrap/en/xslt/biblioexport/export_03.xsl"; >+print $fh qq|<?xml version="1.0" encoding="UTF-8"?>|; >+close $fh; >+ >+my @custom_xslts = @{C4::XSLT::CustomXSLTExportList(1)}; >+ok((scalar @custom_xslts) == 2, "CustomXSLTExportList finds custom XSLTs"); >+ok($custom_xslts[0]->{filename} eq "Export 01", "Title is specified in root node"); >+ok($custom_xslts[1]->{filename} eq "export_02", "Title is filename if not specified"); >diff --git a/t/db_dependent/XSLT.t b/t/db_dependent/XSLT.t >index 865e87a575..4758eb53af 100755 >--- a/t/db_dependent/XSLT.t >+++ b/t/db_dependent/XSLT.t >@@ -1,3 +1,20 @@ >+#!/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 MARC::Record; >@@ -16,6 +33,8 @@ BEGIN { > } > > our $schema = Koha::Database->new->schema; >+my $builder = t::lib::TestBuilder->new; >+our $cache = Koha::Caches->get_instance; > > # Here we go > $schema->storage->txn_begin; >-- >2.34.1
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 17385
:
55961
|
58308
|
64033
|
64034
|
67357
|
67579
|
74660
|
74661
|
79055
|
79056
|
80675
|
81385
|
81386
|
84388
|
84389
|
84390
|
86875
|
86876
|
86877
|
86878
|
86879
|
86880
|
97076
|
97101
|
97102
|
97103
|
97104
|
97105
|
100289
|
100290
|
100291
|
100292
|
100293
|
100663
|
100670
|
100671
|
100672
|
100673
|
100674
|
100675
|
112671
|
112672
|
112673
|
112674
|
112675
|
112676
|
112677
|
112678
|
112679
|
112680
|
112681
|
112682
|
112956
|
112957
|
112958
|
112959
|
130283
|
130284
|
130285
|
130286
|
130287
|
130691
|
130692
|
130693
|
130694
|
130695
|
131492
|
132488
|
132489
|
132490
|
132491
|
132492
|
132493
|
132581
|
133498
|
133499
|
133500
|
133501
|
133502
|
133503
|
133504
|
138031
|
138032
|
138033
|
138034
|
138035
|
138036
|
138037
|
138082
|
138083
|
138084
|
138085
|
138086
|
138087
|
138088
|
138132
|
139277
|
139278
|
139279
|
139280
|
139281
|
139282
|
139283
|
139284
|
141157
|
141158
|
141159
|
141160
|
141161
|
141162
|
141163
|
141164
|
144335
|
144336
|
144380
|
144384
|
151095
|
151096
|
151097
|
151098
|
151099
|
151102
|
151103
|
151104
|
151105
|
151106
|
151377
|
151378
|
151379
|
151380
|
151381
|
154379
|
154380
|
154381
|
154382
|
154383
|
156815
|
156816
|
156817
|
156818
|
156819
|
159142
|
159143
|
159144
|
159145
|
159146
|
159147
|
159148
|
163623
|
170014
|
170015
|
170016
|
170017
|
170018
|
170019
|
170026
|
170027
|
170028
|
170029
|
170030
|
170031
|
170983
|
170984
|
170985
|
170986
|
170987
|
170988