Bugzilla – Attachment 63714 Details for
Bug 18512
GetAuthorisedValues.GetByCode Template plugin should return code (not empty string) if value not found
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18512: Add tests 16.11.X version
Bug-18512-Add-tests-1611X-version.patch (text/plain), 3.33 KB, created by
Nick Clemens (kidclamp)
on 2017-05-25 13:02:30 UTC
(
hide
)
Description:
Bug 18512: Add tests 16.11.X version
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2017-05-25 13:02:30 UTC
Size:
3.33 KB
patch
obsolete
>From d14ad0a3f398ce67e000f4f0df60a3464585cae4 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 2 May 2017 17:27:48 -0300 >Subject: [PATCH] Bug 18512: Add tests 16.11.X version > >Remove use of build_object > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > t/db_dependent/Template/Plugin/AuthorisedValues.t | 71 +++++++++++++++++++++++ > 1 file changed, 71 insertions(+) > create mode 100644 t/db_dependent/Template/Plugin/AuthorisedValues.t > >diff --git a/t/db_dependent/Template/Plugin/AuthorisedValues.t b/t/db_dependent/Template/Plugin/AuthorisedValues.t >new file mode 100644 >index 0000000..3cf3eed >--- /dev/null >+++ b/t/db_dependent/Template/Plugin/AuthorisedValues.t >@@ -0,0 +1,71 @@ >+#!/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 => 1; >+ >+use C4::Context; >+use Koha::Database; >+use Koha::Template::Plugin::AuthorisedValues; >+ >+use t::lib::TestBuilder; >+use t::lib::Mocks; >+ >+my $schema = Koha::Database->schema; >+$schema->storage->txn_begin; >+my $builder = t::lib::TestBuilder->new; >+ >+subtest 'GetByCode' => sub { >+ plan tests => 4; >+ my $avc = >+ $builder->build( { source => 'AuthorisedValueCategory' } ); >+ my $av_1 = $builder->build( >+ { >+ source => 'AuthorisedValue', >+ value => { category => $avc->{category_name} } >+ } >+ ); >+ my $av_2 = $builder->build( >+ { >+ class => 'AuthorisedValue', >+ value => { category => $avc->{category_name} } >+ } >+ ); >+ my $av_3 = $builder->build( >+ { >+ class => 'AuthorisedValue', >+ value => { category => $avc->{category_name}, lib_opc => undef } >+ } >+ ); >+ my $description = >+ Koha::Template::Plugin::AuthorisedValues->GetByCode( $avc->{category_name}, >+ $av_1->{authorised_value} ); >+ is( $description, $av_1->{lib}, 'GetByCode should return the correct dsecription' ); >+ my $opac_description = >+ Koha::Template::Plugin::AuthorisedValues->GetByCode( $avc->{category_name}, >+ $av_1->{authorised_value}, 'opac' ); >+ is( $opac_description, $av_1->{lib_opac}, 'GetByCode should return the correct opac_description' ); >+ $opac_description = >+ Koha::Template::Plugin::AuthorisedValues->GetByCode( $avc->{category_name}, >+ $av_3->{authorised_value}, 'opac' ); >+ is( $opac_description, $av_3->{lib}, 'GetByCode should return the staff description if the lib_opac is not filled' ); >+ >+ $description = >+ Koha::Template::Plugin::AuthorisedValues->GetByCode( $avc->{category_name}, >+ 'does_not_exist' ); >+ is( $description, 'does_not_exist', 'GetByCode should return the code passed if the AV does not exist' ); >+}; >-- >2.1.4
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 18512
:
62859
|
62893
|
62988
|
62989
| 63714