Bugzilla – Attachment 92707 Details for
Bug 23580
Add C4::Context->yaml_preference
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23580: Unit tests
Bug-23580-Unit-tests.patch (text/plain), 2.18 KB, created by
Marcel de Rooy
on 2019-09-11 11:24:08 UTC
(
hide
)
Description:
Bug 23580: Unit tests
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2019-09-11 11:24:08 UTC
Size:
2.18 KB
patch
obsolete
>From ca7566ce752b1741f095f30710009a75eddd1896 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 10 Sep 2019 11:42:02 -0300 >Subject: [PATCH] Bug 23580: Unit tests >Content-Type: text/plain; charset=utf-8 > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/Context.t | 43 ++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 42 insertions(+), 1 deletion(-) > >diff --git a/t/Context.t b/t/Context.t >index 70d9ac637b..ea26ac755e 100755 >--- a/t/Context.t >+++ b/t/Context.t >@@ -1,14 +1,55 @@ > #!/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 DBI; >-use Test::More tests => 27; >+use Test::More tests => 28; > use Test::MockModule; >+use Test::Warn; >+use YAML; > > BEGIN { > use_ok('C4::Context'); > } > >+subtest 'yaml_preference() tests' => sub { >+ >+ plan tests => 3; >+ >+ my $data = [ 'uno', 'dos', { 'tres' => 'cuatro' } ]; >+ >+ my $context = Test::MockModule->new( 'C4::Context' ); >+ $context->mock( 'preference', YAML::Dump($data) ); >+ >+ my $pref = C4::Context->new->yaml_preference( 'nothing' ); >+ >+ is_deeply( $pref, $data, 'yaml_preference returns the right structure' ); >+ >+ $context->mock( 'preference', q{- uno - dos: asd} ); >+ warning_like >+ { $pref = C4::Context->new->yaml_preference('nothing') } >+ qr/^Unable to parse nothing syspref/, >+ 'Invalid YAML on syspref throws a warning'; >+ is( $pref, undef, 'Invalid YAML on syspref makes it return undef' ); >+ >+ $context->unmock( 'preference' ); >+}; >+ > my $context = new Test::MockModule('C4::Context'); > my $userenv = {}; > >-- >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 23580
:
92690
|
92691
|
92696
|
92697
| 92707 |
92708