Bugzilla – Attachment 133460 Details for
Bug 30446
Add a test for GetTagsLabels
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30446: Add a test for GetTagsLabels
Bug-30446-Add-a-test-for-GetTagsLabels.patch (text/plain), 3.11 KB, created by
Tomás Cohen Arazi (tcohen)
on 2022-04-20 12:19:45 UTC
(
hide
)
Description:
Bug 30446: Add a test for GetTagsLabels
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2022-04-20 12:19:45 UTC
Size:
3.11 KB
patch
obsolete
>From f56190c87e40cd9062b30c7aa398fb2d5b86d114 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Mon, 4 Apr 2022 11:50:01 +0000 >Subject: [PATCH] Bug 30446: Add a test for GetTagsLabels > >Moved from obsoleted bug 2222 on its own. > >Test plan: >Run t/db_dependent/AuthoritiesMarc_GetTagsLabels.t > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > .../AuthoritiesMarc_GetTagsLabels.t | 60 +++++++++++++++++++ > 1 file changed, 60 insertions(+) > create mode 100755 t/db_dependent/AuthoritiesMarc_GetTagsLabels.t > >diff --git a/t/db_dependent/AuthoritiesMarc_GetTagsLabels.t b/t/db_dependent/AuthoritiesMarc_GetTagsLabels.t >new file mode 100755 >index 00000000000..f5d98e35422 >--- /dev/null >+++ b/t/db_dependent/AuthoritiesMarc_GetTagsLabels.t >@@ -0,0 +1,60 @@ >+#!/usr/bin/perl >+ >+# Tests for C4::AuthoritiesMarc::GetTagsLabels >+ >+# Copyright 2022 Rijksmuseum, Koha Development Team >+# >+# 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 t::lib::TestBuilder; >+ >+use C4::AuthoritiesMarc qw( GetTagsLabels ); >+use Koha::Authority::Types; >+use Koha::Database; >+ >+my $schema = Koha::Database->new->schema; >+our $builder = t::lib::TestBuilder->new; >+ >+$schema->storage->txn_begin; >+ >+subtest 'GetTagsLabels' => sub { >+ plan tests => 8; >+ >+ # Clear auth_tag_structure and subfields (via constraints) >+ Koha::Authority::Types->delete; >+ my $tagslib = GetTagsLabels(); >+ is( $tagslib, undef, 'Nothing in table' ); >+ >+ # Add one tag (and auth type), test librarian flag >+ my $tag = $builder->build_object({ class => 'Koha::Authority::Tags', value => { authtypecode => 'XX1', tagfield => '177' } }); >+ $tagslib = GetTagsLabels( 1, $tag->authtypecode ); >+ is( ref($tagslib), 'HASH', 'Should be a hash' ); >+ is( scalar keys %$tagslib, 1, 'Only one entry' ); >+ is( ref( $tagslib->{177} ), 'HASH' , 'Should be a hash' ); >+ is( $tagslib->{177}->{lib}, $tag->liblibrarian, 'passed librarian flag' ); >+ >+ # Add subfield, test opac flag >+ my $sub = $builder->build_object({ class => 'Koha::Authority::Subfields', value => { authtypecode => 'XX1', tagfield => '177', tagsubfield => 'a' } }); >+ $tagslib = GetTagsLabels( 0, $tag->authtypecode ); >+ is( $tagslib->{177}->{lib}, $tag->libopac, 'passed opac flag' ); >+ is( ref( $tagslib->{177}->{a} ), 'HASH' , 'Should be a hash' ); >+ is( $tagslib->{177}->{a}->{lib}, $sub->libopac, 'opac lib in subfield' ); >+}; >+ >+$schema->storage->txn_rollback; >-- >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 30446
:
132932
| 133460 |
133461