Bugzilla – Attachment 95073 Details for
Bug 23414
Improve performance of C4/XSLT/buildKohaItemsNamespace
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23414: Unit tests
Bug-23414-Unit-tests.patch (text/plain), 4.17 KB, created by
Liz Rea
on 2019-11-05 18:34:02 UTC
(
hide
)
Description:
Bug 23414: Unit tests
Filename:
MIME Type:
Creator:
Liz Rea
Created:
2019-11-05 18:34:02 UTC
Size:
4.17 KB
patch
obsolete
>From 56910153b128d4371bf70659d8bd25c641102666 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Mon, 4 Nov 2019 14:22:44 +0000 >Subject: [PATCH] Bug 23414: Unit tests > >To test: >1 - Apply this patch alone >2 - prove -v t/db_dependent/XSLT.t >3 - All pass >4 - Apply other patches >5 - prove -v t/db_dependent/XSLT.t >6 - All pass > >Signed-off-by: Liz Rea <wizzyrea@gmail.com> >--- > t/db_dependent/XSLT.t | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 94 insertions(+) > create mode 100644 t/db_dependent/XSLT.t > >diff --git a/t/db_dependent/XSLT.t b/t/db_dependent/XSLT.t >new file mode 100644 >index 0000000000..42cce17aa0 >--- /dev/null >+++ b/t/db_dependent/XSLT.t >@@ -0,0 +1,94 @@ >+#!/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 => 2; >+use Test::Warn; >+use t::lib::TestBuilder; >+ >+ >+BEGIN { >+ use_ok('C4::XSLT'); >+} >+ >+my $schema = Koha::Database->new->schema; >+my $builder = t::lib::TestBuilder->new; >+ >+$schema->storage->txn_begin; >+ >+subtest 'buildKohaItemsNamespace status tests' => sub { >+ plan tests => 10; >+ my $item = $builder->build_sample_item({ >+ }); >+ >+ my $xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]); >+ like($xml,qr/<status>available<\/status>/,"Item is available when no other status applied"); >+ >+ $item->notforloan(-1)->store; >+ $xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]); >+ like($xml,qr/<status>On order<\/status>/,"On order if negative notforloan value"); >+ >+ $item->notforloan(1)->store; >+ $xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]); >+ like($xml,qr/<status>reference<\/status>/,"reference if positive notforloan value"); >+ >+ $item->onloan('2001-01-01')->store; >+ $xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]); >+ like($xml,qr/<status>Checked out<\/status>/,"Checked out status takes precedence over Not for loan"); >+ >+ $item->withdrawn(1)->store; >+ $xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]); >+ like($xml,qr/<status>Withdrawn<\/status>/,"Withdrawn status takes precedence over Checked out"); >+ >+ $item->itemlost(1)->store; >+ $xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]); >+ like($xml,qr/<status>Lost<\/status>/,"Lost status takes precedence over Withdrawn"); >+ >+ $item->damaged(1)->store; >+ $xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]); >+ like($xml,qr/<status>Damaged<\/status>/,"Damaged status takes precedence over Lost"); >+ >+ $builder->build({ source => "Branchtransfer", value => { >+ itemnumber => $item->itemnumber, >+ datearrived => undef, >+ } >+ }); >+ $xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]); >+ like($xml,qr/<status>In transit<\/status>/,"In-transit status takes precedence over Damaged"); >+ >+ my $hold = $builder->build_object({ class => 'Koha::Holds', value => { >+ biblionumber => $item->biblionumber, >+ itemnumber => $item->itemnumber, >+ found => 'W', >+ priority => 0, >+ } >+ }); >+ $xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]); >+ like($xml,qr/<status>Waiting<\/status>/,"Waiting status takes precedence over In transit"); >+ >+ $builder->build({ source => "TmpHoldsqueue", value => { >+ itemnumber => $item->itemnumber >+ } >+ }); >+ $xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]); >+ like($xml,qr/<status>Pending hold<\/status>/,"Pending status takes precedence over all"); >+ >+ >+}; >+ >+$schema->storage->txn_rollback; >-- >2.11.0
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 23414
:
91913
|
91914
|
91915
|
94537
|
94580
|
94581
|
95010
|
95011
|
95012
|
95014
|
95015
|
95069
|
95070
|
95071
|
95072
|
95073
|
95083
|
95084
|
95085
|
95086
|
95087
|
95088
|
95089