Bugzilla – Attachment 155885 Details for
Bug 34825
Move Letters.t to t/db_dependent
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34825: Merge Letters.t into t/db/Letters.t
Bug-34825-Merge-Letterst-into-tdbLetterst.patch (text/plain), 5.33 KB, created by
Marcel de Rooy
on 2023-09-19 07:13:49 UTC
(
hide
)
Description:
Bug 34825: Merge Letters.t into t/db/Letters.t
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2023-09-19 07:13:49 UTC
Size:
5.33 KB
patch
obsolete
>From 74880f099e97dd2db875b59a7cc9c22c013929c9 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Tue, 19 Sep 2023 07:09:54 +0000 >Subject: [PATCH] Bug 34825: Merge Letters.t into t/db/Letters.t >Content-Type: text/plain; charset=utf-8 > >Test plan: >Run t/db_dependent/Letters.t > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/Letters.t | 72 ---------------------------------------- > t/db_dependent/Letters.t | 27 ++++++++++++++- > 2 files changed, 26 insertions(+), 73 deletions(-) > delete mode 100755 t/Letters.t > >diff --git a/t/Letters.t b/t/Letters.t >deleted file mode 100755 >index 4846de56a8..0000000000 >--- a/t/Letters.t >+++ /dev/null >@@ -1,72 +0,0 @@ >-#!/usr/bin/perl >- >-# Copyright Koha development team 2007 >-# >-# 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::MockModule; >-use Test::More tests => 3; >- >-use t::lib::Mocks; >-use t::lib::TestBuilder; >- >-use Koha::Database; >- >-use_ok('C4::Letters', qw( GetLetters )); >- >-my $schema = Koha::Database->new->schema; >-$schema->storage->txn_begin; >-our $builder = t::lib::TestBuilder->new; >- >-subtest 'GetLetters' => sub { >- plan tests => 2; >- t::lib::Mocks::mock_preference( 'dateformat', 'metric' ); >- >- my $data_1 = { >- module => 'blah', code => 'ISBN', branchcode => 'NBSI', name => 'book', is_html => 1, title => 'green', >- content => 'blahblah', lang => 'french' >- }; >- my $data_2 = { >- module => 'blah', code => 'ISSN', branchcode => 'NSSI', name => 'page', is_html => 0, title => 'blue', >- content => 'bleble', lang => 'american' >- }; >- $builder->build_object( { class => 'Koha::Notice::Templates', value => $data_1 } ); >- $builder->build_object( { class => 'Koha::Notice::Templates', value => $data_2 } ); >- >- my $letters = GetLetters( { module => 'blah' } ); >- is( scalar(@$letters), 2, 'GetLetters returns the 2 inserted letters' ); >- >- my ($ISBN_letter) = grep { $_->{code} eq 'ISBN' } @$letters; >- is( $ISBN_letter->{name}, 'book', 'letter name for "ISBN" letter is book' ); >-}; >- >-subtest '_parseletter' => sub { >- plan tests => 2; >- >- # Regression test for bug 10843 >- # $dt->add takes a scalar, not undef >- my $letter; >- t::lib::Mocks::mock_preference( 'ReservesMaxPickUpDelay', undef ); >- $letter = C4::Letters::_parseletter( undef, 'reserves', { waitingdate => "2013-01-01" } ); >- is( ref($letter), 'HASH' ); >- t::lib::Mocks::mock_preference( 'ReservesMaxPickUpDelay', 1 ); >- $letter = C4::Letters::_parseletter( undef, 'reserves', { waitingdate => "2013-01-01" } ); >- is( ref($letter), 'HASH' ); >-}; >- >-$schema->storage->txn_begin; >diff --git a/t/db_dependent/Letters.t b/t/db_dependent/Letters.t >index 94b5f60633..3f1a551616 100755 >--- a/t/db_dependent/Letters.t >+++ b/t/db_dependent/Letters.t >@@ -18,7 +18,7 @@ > # along with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; >-use Test::More tests => 90; >+use Test::More tests => 93; > use Test::MockModule; > use Test::Warn; > use Test::Exception; >@@ -233,6 +233,17 @@ is( $letters->[0]->{module}, 'my module', 'GetLetters gets the module correctly' > is( $letters->[0]->{code}, 'my code', 'GetLetters gets the code correctly' ); > is( $letters->[0]->{name}, 'my name', 'GetLetters gets the name correctly' ); > >+my $data_1 = { module => 'blah', code => 'ISBN', name => 'book' }; >+my $data_2 = { module => 'blah', code => 'ISSN' }; >+$builder->build_object( { class => 'Koha::Notice::Templates', value => $data_1 } ); >+$builder->build_object( { class => 'Koha::Notice::Templates', value => $data_2 } ); >+ >+$letters = GetLetters( { module => 'blah' } ); >+is( scalar(@$letters), 2, 'GetLetters returns the 2 inserted letters' ); >+ >+my ($ISBN_letter) = grep { $_->{code} eq 'ISBN' } @$letters; >+is( $ISBN_letter->{name}, 'book', 'letter name for "ISBN" letter is book' ); >+ > # GetPreparedLetter > t::lib::Mocks::mock_preference('OPACBaseURL', 'http://thisisatest.com'); > t::lib::Mocks::mock_preference( 'SendAllEmailsTo', '' ); >@@ -630,6 +641,20 @@ is($err->{error}, 'something went wrong', "Send exception, error message returne > } > t::lib::Mocks::mock_preference( 'SendAllEmailsTo', '' ); > >+subtest '_parseletter' => sub { >+ plan tests => 2; >+ >+ # Regression test for bug 10843 >+ # $dt->add takes a scalar, not undef >+ my $letter; >+ t::lib::Mocks::mock_preference( 'ReservesMaxPickUpDelay', undef ); >+ $letter = C4::Letters::_parseletter( undef, 'reserves', { waitingdate => "2013-01-01" } ); >+ is( ref($letter), 'HASH' ); >+ t::lib::Mocks::mock_preference( 'ReservesMaxPickUpDelay', 1 ); >+ $letter = C4::Letters::_parseletter( undef, 'reserves', { waitingdate => "2013-01-01" } ); >+ is( ref($letter), 'HASH' ); >+}; >+ > subtest 'SendAlerts - claimissue' => sub { > plan tests => 13; > >-- >2.30.2
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 34825
:
155884
|
155885
|
156205
|
156206