Bugzilla – Attachment 59748 Details for
Bug 17982
Fix the use of uniq in sub themelanguage
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17982: Improve test coverage
Bug-17982-Improve-test-coverage.patch (text/plain), 2.92 KB, created by
Mark Tompsett
on 2017-02-01 18:39:39 UTC
(
hide
)
Description:
Bug 17982: Improve test coverage
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2017-02-01 18:39:39 UTC
Size:
2.92 KB
patch
obsolete
>From d4eb3392a4eeff250fa7db5c8041c8e67d7ae5f2 Mon Sep 17 00:00:00 2001 >From: Mark Tompsett <mtompset@hotmail.com> >Date: Wed, 1 Feb 2017 13:32:25 -0500 >Subject: [PATCH] Bug 17982: Improve test coverage > >This test triggers the three cases that were modified. >prove -v t/db_dependent/Templates.t >--- > t/db_dependent/Templates.t | 51 +++++++++++++++++++++++++++++++++++++++++----- > 1 file changed, 46 insertions(+), 5 deletions(-) > >diff --git a/t/db_dependent/Templates.t b/t/db_dependent/Templates.t >index 236bd1e..c9d55c0 100755 >--- a/t/db_dependent/Templates.t >+++ b/t/db_dependent/Templates.t >@@ -18,9 +18,12 @@ > use Modern::Perl; > > use CGI; >+use File::Basename qw/dirname/; > >-use Test::More tests => 5; >+use Test::More tests => 6; > use Test::Deep; >+use Test::MockModule; >+use t::lib::Mocks; > > BEGIN { > use_ok( 'C4::Templates' ); >@@ -40,10 +43,48 @@ my $columns = C4::Templates::GetColumnDefs( $query ); > > is( ref( $columns ) eq 'HASH', 1, 'GetColumnDefs returns a hashref' ); > # get the tables names, sorted >-my @keys = sort keys %$columns; >-is( scalar @keys, 6, "GetColumnDefs correctly returns the 5 tables defined in columns.def" ); >-my @tables = ( 'biblio', 'biblioitems', 'borrowers', 'items', 'statistics', 'subscription'); >-cmp_deeply( \@keys, \@tables, "GetColumnDefs returns the expected tables"); >+my @keys = sort keys %{$columns}; >+is( scalar @keys, 6, 'GetColumnDefs correctly returns the 5 tables defined in columns.def' ); >+my @tables = qw( biblio biblioitems borrowers items statistics subscription ); >+cmp_deeply( \@keys, \@tables, 'GetColumnDefs returns the expected tables'); > >+subtest 'Test C4::Templates::themelanguage' => sub { >+ plan tests => 4; >+ my $testing_language; >+ my $module_language = Test::MockModule->new('C4::Languages'); >+ >+ $module_language->mock( >+ 'getlanguage', >+ sub { >+ return $testing_language; >+ } >+ ); >+ >+ my $cgi = CGI->new(); >+ my $htdocs = C4::Context->config('intrahtdocs'); >+ my $section = 'intranet'; >+ >+ # trigger first case. >+ $testing_language = 'fr-FR'; >+ my ($theme, $lang, $availablethemes) = C4::Templates::themelanguage($htdocs, 'about.tt', $section, $cgi); >+ is($lang,'fr-FR','Expected language: non-en'); >+ >+ # trigger second case. >+ $testing_language = q{}; >+ ($theme, $lang, $availablethemes) = C4::Templates::themelanguage($htdocs, 'about.tt', $section, $cgi); >+ is($lang,'en','Expected language: default en'); >+ >+ # trigger third case. >+ my $template = $htdocs . '/prog/en/modules/about.tt'; >+ ($theme, $lang, $availablethemes) = C4::Templates::themelanguage($htdocs, $template, $section, $cgi); >+ is($lang,q{},'Expected language: unset'); >+ >+ # trigger bad case. >+ $template = $htdocs . '/prog/en/kaboom/about.tt'; >+ ($theme, $lang, $availablethemes) = C4::Templates::themelanguage($htdocs, $template, $section, $cgi); >+ is($lang,undef,'Expected language: not coded for'); >+ >+ return; >+}; > > 1; >-- >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 17982
:
59511
|
59537
|
59630
|
59747
|
59748
|
59749
|
59750
|
59765
|
59766
|
59790
|
59791