Bugzilla – Attachment 149690 Details for
Bug 11844
Additional fields for order lines
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11844: Add tests for Koha::AdditionalField
Bug-11844-Add-tests-for-KohaAdditionalField.patch (text/plain), 3.26 KB, created by
Martin Renvoize (ashimema)
on 2023-04-14 15:07:23 UTC
(
hide
)
Description:
Bug 11844: Add tests for Koha::AdditionalField
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-04-14 15:07:23 UTC
Size:
3.26 KB
patch
obsolete
>From 224912f29009d339e6a784b0750c24aaf6713e12 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Wed, 29 Mar 2023 10:47:24 +0200 >Subject: [PATCH] Bug 11844: Add tests for Koha::AdditionalField > >Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/db_dependent/Koha/AdditionalField.pm | 82 ++++++++++++++++++++++++++ > 1 file changed, 82 insertions(+) > create mode 100755 t/db_dependent/Koha/AdditionalField.pm > >diff --git a/t/db_dependent/Koha/AdditionalField.pm b/t/db_dependent/Koha/AdditionalField.pm >new file mode 100755 >index 0000000000..db2d50d8fa >--- /dev/null >+++ b/t/db_dependent/Koha/AdditionalField.pm >@@ -0,0 +1,82 @@ >+#!/usr/bin/perl >+ >+use Modern::Perl; >+ >+use Test::More tests => 2; >+use String::Random qw(random_string); >+ >+use Koha::AuthorisedValueCategory; >+ >+BEGIN { >+ use_ok('Koha::AdditionalField'); >+} >+ >+my $schema = Koha::Database->schema; >+ >+subtest 'effective_authorised_value_category' => sub { >+ plan tests => 4; >+ >+ $schema->txn_begin; >+ >+ my $av_category_name = random_string('C' x 32); >+ my $av_category = Koha::AuthorisedValueCategory->new({ category_name => $av_category_name }); >+ $av_category->store()->discard_changes(); >+ >+ my $field = Koha::AdditionalField->new( >+ { >+ tablename => random_string('c' x 100), >+ name => random_string('c' x 100), >+ } >+ ); >+ $field->store()->discard_changes(); >+ >+ is($field->effective_authorised_value_category, '', 'no default category'); >+ >+ $field = Koha::AdditionalField->new( >+ { >+ tablename => random_string('c' x 100), >+ name => random_string('c' x 100), >+ authorised_value_category => $av_category_name, >+ } >+ ); >+ $field->store()->discard_changes(); >+ >+ is($field->effective_authorised_value_category, $av_category_name, 'returns authorised_value_category if set'); >+ >+ my $mss = Koha::MarcSubfieldStructure->new( >+ { >+ frameworkcode => '', >+ tagfield => '999', >+ tagsubfield => 'Z', >+ authorised_value => $av_category_name, >+ } >+ ); >+ $mss->store(); >+ $field = Koha::AdditionalField->new( >+ { >+ tablename => random_string('c' x 100), >+ name => random_string('c' x 100), >+ marcfield => '999$Z', >+ } >+ ); >+ $field->store()->discard_changes(); >+ >+ is($field->effective_authorised_value_category, $av_category_name, 'returns MARC subfield authorised value category if set'); >+ >+ my $av2_category_name = random_string('C' x 32); >+ my $av2_category = Koha::AuthorisedValueCategory->new({ category_name => $av2_category_name }); >+ $av2_category->store()->discard_changes(); >+ $field = Koha::AdditionalField->new( >+ { >+ tablename => random_string('c' x 100), >+ name => random_string('c' x 100), >+ authorised_value_category => $av2_category_name, >+ marcfield => '999$Z', >+ } >+ ); >+ $field->store()->discard_changes(); >+ >+ is($field->effective_authorised_value_category, $av2_category_name, 'returns authorised_value_category if both authorised_value_category and marcfield are set'); >+ >+ $schema->txn_rollback; >+}; >-- >2.40.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 11844
:
25632
|
25638
|
41859
|
41860
|
45674
|
45675
|
45676
|
45758
|
45915
|
45916
|
45917
|
53614
|
53615
|
53616
|
53618
|
53619
|
55529
|
75332
|
75362
|
141116
|
145517
|
145535
|
145536
|
145540
|
146497
|
146500
|
146501
|
146502
|
146503
|
146504
|
146505
|
146506
|
148889
|
148895
|
148897
|
149081
|
149082
|
149083
|
149084
|
149085
|
149086
|
149087
|
149088
|
149089
|
149090
|
149091
|
149682
|
149683
|
149684
|
149685
|
149686
|
149687
|
149688
|
149689
|
149690
|
149691
|
149692
|
150537
|
150538
|
150539
|
150540
|
150541
|
150542
|
150543
|
150544
|
150545
|
150546
|
150547
|
150548
|
151220
|
151221
|
151222
|
151223
|
151224
|
151225
|
151226
|
151227
|
151228
|
151229
|
151230
|
151366