Lines 18-24
Link Here
|
18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
use Test::More tests => 82; |
21 |
use Test::More tests => 75; |
22 |
use Test::MockModule; |
22 |
use Test::MockModule; |
23 |
use Test::Warn; |
23 |
use Test::Warn; |
24 |
|
24 |
|
Lines 182-196
is( $letters->[0]->{name}, 'my name', 'GetLetters gets the name correctly' );
Link Here
|
182 |
|
182 |
|
183 |
|
183 |
|
184 |
# getletter |
184 |
# getletter |
185 |
my $letter = C4::Letters::getletter('my module', 'my code', $library->{branchcode}, 'email'); |
185 |
subtest 'getletter' => sub { |
186 |
is( $letter->{branchcode}, $library->{branchcode}, 'GetLetters gets the branch code correctly' ); |
186 |
plan tests => 16; |
187 |
is( $letter->{module}, 'my module', 'GetLetters gets the module correctly' ); |
187 |
my $letter = C4::Letters::getletter('my module', 'my code', $library->{branchcode}, 'email'); |
188 |
is( $letter->{code}, 'my code', 'GetLetters gets the code correctly' ); |
188 |
is( $letter->{branchcode}, $library->{branchcode}, 'GetLetters gets the branch code correctly' ); |
189 |
is( $letter->{name}, 'my name', 'GetLetters gets the name correctly' ); |
189 |
is( $letter->{module}, 'my module', 'GetLetters gets the module correctly' ); |
190 |
is( $letter->{is_html}, 1, 'GetLetters gets the boolean is_html correctly' ); |
190 |
is( $letter->{code}, 'my code', 'GetLetters gets the code correctly' ); |
191 |
is( $letter->{title}, $title, 'GetLetters gets the title correctly' ); |
191 |
is( $letter->{name}, 'my name', 'GetLetters gets the name correctly' ); |
192 |
is( $letter->{content}, $content, 'GetLetters gets the content correctly' ); |
192 |
is( $letter->{is_html}, 1, 'GetLetters gets the boolean is_html correctly' ); |
193 |
is( $letter->{message_transport_type}, 'email', 'GetLetters gets the message type correctly' ); |
193 |
is( $letter->{title}, $title, 'GetLetters gets the title correctly' ); |
|
|
194 |
is( $letter->{content}, $content, 'GetLetters gets the content correctly' ); |
195 |
is( $letter->{message_transport_type}, 'email', 'GetLetters gets the message type correctly' ); |
196 |
|
197 |
my $context = Test::MockModule->new('C4::Context'); |
198 |
$context->mock( 'userenv', sub { |
199 |
return { branch => "anotherlib" } |
200 |
}); |
201 |
|
202 |
t::lib::Mocks::mock_preference('IndependentBranches', 1); |
203 |
$letter = C4::Letters::getletter('my module', 'my code', $library->{branchcode}, 'email'); |
204 |
is( $letter->{branchcode}, $library->{branchcode}, 'GetLetters gets the branch code correctly' ); |
205 |
is( $letter->{module}, 'my module', 'GetLetters gets the module correctly' ); |
206 |
is( $letter->{code}, 'my code', 'GetLetters gets the code correctly' ); |
207 |
is( $letter->{name}, 'my name', 'GetLetters gets the name correctly' ); |
208 |
is( $letter->{is_html}, 1, 'GetLetters gets the boolean is_html correctly' ); |
209 |
is( $letter->{title}, $title, 'GetLetters gets the title correctly' ); |
210 |
is( $letter->{content}, $content, 'GetLetters gets the content correctly' ); |
211 |
is( $letter->{message_transport_type}, 'email', 'GetLetters gets the message type correctly' ); |
212 |
|
213 |
$context->unmock('userenv'); |
214 |
}; |
215 |
|
216 |
|
194 |
|
217 |
|
195 |
# Regression test for Bug 14206 |
218 |
# Regression test for Bug 14206 |
196 |
$dbh->do( q|INSERT INTO letter(branchcode,module,code,name,is_html,title,content,message_transport_type) VALUES ('FFL','my module','my code','my name',1,?,?,'print')|, undef, $title, $content ); |
219 |
$dbh->do( q|INSERT INTO letter(branchcode,module,code,name,is_html,title,content,message_transport_type) VALUES ('FFL','my module','my code','my name',1,?,?,'print')|, undef, $title, $content ); |
Lines 199-204
is( $letter14206_a->{message_transport_type}, 'print', 'Bug 14206 - message_tran
Link Here
|
199 |
my $letter14206_b = C4::Letters::getletter('my module', 'my code', 'FFL', 'print'); |
222 |
my $letter14206_b = C4::Letters::getletter('my module', 'my code', 'FFL', 'print'); |
200 |
is( $letter14206_b->{message_transport_type}, 'print', 'Bug 14206 - message_transport_type passed, correct mtt detected' ); |
223 |
is( $letter14206_b->{message_transport_type}, 'print', 'Bug 14206 - message_transport_type passed, correct mtt detected' ); |
201 |
|
224 |
|
|
|
225 |
|
226 |
|
202 |
# test for overdue_notices.pl |
227 |
# test for overdue_notices.pl |
203 |
my $overdue_rules = { |
228 |
my $overdue_rules = { |
204 |
letter1 => 'my code', |
229 |
letter1 => 'my code', |
205 |
- |
|
|