Bugzilla – Attachment 101073 Details for
Bug 23900
Label maker cannot concatenate database fields
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23900: Add tests
Bug-23900-Add-tests.patch (text/plain), 3.16 KB, created by
Kyle M Hall (khall)
on 2020-03-20 11:04:52 UTC
(
hide
)
Description:
Bug 23900: Add tests
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2020-03-20 11:04:52 UTC
Size:
3.16 KB
patch
obsolete
>From b23f4952c25089fdb35a3ecc1d6812928c48d2c8 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 26 Feb 2020 12:51:06 +0100 >Subject: [PATCH] Bug 23900: Add tests > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > t/db_dependent/Labels/t_Label.t | 37 ++++++++++++++++++++------------- > 1 file changed, 22 insertions(+), 15 deletions(-) > >diff --git a/t/db_dependent/Labels/t_Label.t b/t/db_dependent/Labels/t_Label.t >index 069512c011..d553a0127b 100644 >--- a/t/db_dependent/Labels/t_Label.t >+++ b/t/db_dependent/Labels/t_Label.t >@@ -2,6 +2,7 @@ > > # This file is part of Koha. > # >+# Copyright 2020 Koha Development team > # Copyright (C) 2017 Mark Tompsett > # > # Koha is free software; you can redistribute it and/or modify it >@@ -19,7 +20,7 @@ > > use Modern::Perl; > >-use Test::More tests => 3; >+use Test::More tests => 4; > use t::lib::TestBuilder; > use t::lib::Mocks; > >@@ -61,15 +62,9 @@ t::lib::Mocks::mock_userenv({ branchcode => $branch_1 }); > > my $bibnum = $builder->build_sample_biblio({ frameworkcode => $frameworkcode })->biblionumber; > >-# Create a helper item instance for testing >-my ( $item_bibnum, $item_bibitemnum, $itemnumber ) = AddItem( >- { >- homebranch => $branch_1, >- holdingbranch => $branch_1, >- itype => $itemtype >- }, >- $bibnum >-); >+my $item = $builder->build_sample_item( >+ { library => $branch_1, itype => $itemtype, biblionumber => $bibnum, enumchron => "enum", copynumber => "copynum" } ); >+my $itemnumber = $item->itemnumber; > > # Modify item; setting barcode. > my $testbarcode = '97531'; >@@ -98,7 +93,7 @@ my $dummy_template_values = { > template_stat => 1, > }; > >-my $label = C4::Labels::Label->new( >+my $label_info = { > batch_id => $batch_id, > item_number => $itemnumber, > llx => $llx, >@@ -115,18 +110,30 @@ my $label = C4::Labels::Label->new( > font_size => $layout->get_attr('font_size'), > callnum_split => $layout->get_attr('callnum_split'), > justify => $layout->get_attr('text_justify'), >- format_string => $layout->get_attr('format_string'), > text_wrap_cols => $layout->get_text_wrap_cols( > label_width => $dummy_template_values->{'label_width'}, > left_text_margin => $dummy_template_values->{'left_text_margin'} > ), >-); >+}; > >+my $format_string = '100a 245a'; >+my $label = C4::Labels::Label->new(%$label_info, format_string => $format_string); > my $label_text = $label->create_label(); > ok( defined $label_text, 'Label Text Value defined.' ); >- > my $label_csv_data = $label->csv_data(); >-ok( defined $label_csv_data, 'Label CSV Data defined' ); >+is_deeply( $label_csv_data, >+ [ sprintf( "%s %s", $item->biblio->author, $item->biblio->title ) ] ); >+ >+$format_string = '100a 245a,enumchron copynumber'; >+$label = C4::Labels::Label->new(%$label_info, format_string => $format_string); >+$label_csv_data = $label->csv_data(); >+is_deeply( >+ $label_csv_data, >+ [ >+ sprintf( "%s %s", $item->biblio->author, $item->biblio->title ), >+ sprintf( "%s %s", $item->enumchron, $item->copynumber ) >+ ] >+); > > $schema->storage->txn_rollback(); > >-- >2.21.1 (Apple Git-122.3)
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 23900
:
95273
|
95307
|
99641
|
101072
| 101073