Bugzilla – Attachment 92690 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.09 KB, created by
Tomás Cohen Arazi (tcohen)
on 2019-09-10 14:49:16 UTC
(
hide
)
Description:
Bug 23580: Unit tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2019-09-10 14:49:16 UTC
Size:
2.09 KB
patch
obsolete
>From d82adfd5cf2a029aa8d52d47490ac03a661e9373 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 > >--- > 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.23.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