|
Lines 29-36
my $builder = t::lib::TestBuilder->new();
Link Here
|
| 29 |
my $dbh = C4::Context->dbh; |
29 |
my $dbh = C4::Context->dbh; |
| 30 |
|
30 |
|
| 31 |
# Create two random branches |
31 |
# Create two random branches |
| 32 |
my $library_1 = $builder->build({ source => 'Branch' })->{ branchcode }; |
32 |
my $branch_1 = $builder->build_object({ |
| 33 |
my $library_2 = $builder->build({ source => 'Branch' })->{ branchcode }; |
33 |
class => 'Koha::Libraries', |
|
|
34 |
value => { |
| 35 |
branchemail => 'branch1@e.mail', |
| 36 |
branchreplyto => 'branch1@reply.to' |
| 37 |
} |
| 38 |
}); |
| 39 |
my $library_1 = $branch_1->branchcode; |
| 40 |
my $branch_2 = $builder->build_object({ |
| 41 |
class => 'Koha::Libraries', |
| 42 |
value => { |
| 43 |
branchemail => 'branch2@e.mail', |
| 44 |
branchreplyto => 'branch2@reply.to' |
| 45 |
} |
| 46 |
}); |
| 47 |
my $library_2 = $branch_2->branchcode; |
| 34 |
|
48 |
|
| 35 |
my $biblio = $builder->build_sample_biblio({ itemtype => 'DUMMY' }); |
49 |
my $biblio = $builder->build_sample_biblio({ itemtype => 'DUMMY' }); |
| 36 |
my $biblionumber = $biblio->id; |
50 |
my $biblionumber = $biblio->id; |
|
Lines 132-138
subtest 'Test automatically canceled expired waiting holds to fill the next hold
Link Here
|
| 132 |
}; |
146 |
}; |
| 133 |
|
147 |
|
| 134 |
subtest 'Test automatically canceled expired waiting holds to fill the next hold, with a transfer' => sub { |
148 |
subtest 'Test automatically canceled expired waiting holds to fill the next hold, with a transfer' => sub { |
| 135 |
plan tests => 5; |
149 |
plan tests => 6; |
| 136 |
|
150 |
|
| 137 |
$dbh->do('DELETE FROM reserves'); |
151 |
$dbh->do('DELETE FROM reserves'); |
| 138 |
$dbh->do('DELETE FROM message_queue'); |
152 |
$dbh->do('DELETE FROM message_queue'); |
|
Lines 187-191
subtest 'Test automatically canceled expired waiting holds to fill the next hold
Link Here
|
| 187 |
|
201 |
|
| 188 |
my @messages = $schema->resultset('MessageQueue') |
202 |
my @messages = $schema->resultset('MessageQueue') |
| 189 |
->search( { letter_code => 'HOLD_CHANGED' } ); |
203 |
->search( { letter_code => 'HOLD_CHANGED' } ); |
| 190 |
is( @messages, 1, 'Nessage is generated in the message queue when generating transfer' ); |
204 |
is( @messages, 1, 'Message is generated in the message queue when generating transfer' ); |
|
|
205 |
|
| 206 |
my $email = $messages[0]; |
| 207 |
is( $email->from_address, $branch_2->branchemail, "Message is sent from library's email"); |
| 191 |
}; |
208 |
}; |
|
|
209 |
|
| 210 |
$schema->storage->txn_rollback; |