Lines 19-25
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 3; |
22 |
use Test::More tests => 4; |
23 |
|
23 |
|
24 |
use t::lib::Mocks; |
24 |
use t::lib::Mocks; |
25 |
use t::lib::TestBuilder; |
25 |
use t::lib::TestBuilder; |
Lines 110-115
subtest 'Test Koha::Patron::Message::Preferences' => sub {
Link Here
|
110 |
$schema->storage->txn_rollback; |
110 |
$schema->storage->txn_rollback; |
111 |
}; |
111 |
}; |
112 |
|
112 |
|
|
|
113 |
subtest 'Test Koha::Patron::Message::Preferences->get_options' => sub { |
114 |
plan tests => 2; |
115 |
|
116 |
subtest 'Test method availability and return value' => sub { |
117 |
plan tests => 3; |
118 |
|
119 |
ok(Koha::Patron::Message::Preferences->can('get_options'), |
120 |
'Method get_options is available.'); |
121 |
ok(my $options = Koha::Patron::Message::Preferences->get_options, |
122 |
'Called get_options successfully.'); |
123 |
is(ref($options), 'ARRAY', 'get_options returns a ARRAYref'); |
124 |
}; |
125 |
|
126 |
subtest 'Make sure options are correct' => sub { |
127 |
$schema->storage->txn_begin; |
128 |
my $options = Koha::Patron::Message::Preferences->get_options; |
129 |
|
130 |
foreach my $option (@$options) { |
131 |
my $n = $option->{'message_name'}; |
132 |
my $attr = Koha::Patron::Message::Attributes->find($option->{'message_attribute_id'}); |
133 |
is($option->{'message_attribute_id'}, $attr->message_attribute_id, |
134 |
'$n: message_attribute_id is set'); |
135 |
is($option->{'message_name'}, $attr->message_name, '$n: message_name is set'); |
136 |
is($option->{'takes_days'}, $attr->takes_days, '$n: takes_days is set'); |
137 |
my $transports = Koha::Patron::Message::Transports->search({ |
138 |
message_attribute_id => $option->{'message_attribute_id'}, |
139 |
is_digest => $option->{'has_digest'} || 0, |
140 |
}); |
141 |
while (my $trnzport = $transports->next) { |
142 |
is($option->{'has_digest'} || 0, $trnzport->is_digest, '$n: has_digest is set for '.$trnzport->message_transport_type); |
143 |
is($option->{'transport_'.$trnzport->message_transport_type}, ' ', '$n: transport_'.$trnzport->message_transport_type.' is set'); |
144 |
} |
145 |
} |
146 |
|
147 |
$schema->storage->txn_rollback; |
148 |
}; |
149 |
}; |
150 |
|
113 |
subtest 'Test adding a new preference with invalid parameters' => sub { |
151 |
subtest 'Test adding a new preference with invalid parameters' => sub { |
114 |
plan tests => 4; |
152 |
plan tests => 4; |
115 |
|
153 |
|
116 |
- |
|
|