View | Details | Raw Unified | Return to bug 32455
Collapse All | Expand All

(-)a/t/db_dependent/Holds/ExpireReservesAutoFill.t (-4 / +23 lines)
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;
(-)a/t/db_dependent/Reserves.t (-5 / +20 lines)
Lines 789-795 $cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode"); Link Here
789
789
790
subtest '_koha_notify_reserve() tests' => sub {
790
subtest '_koha_notify_reserve() tests' => sub {
791
791
792
    plan tests => 2;
792
    plan tests => 3;
793
794
    my $branch = $builder->build_object({
795
        class => 'Koha::Libraries',
796
        value => {
797
            branchemail => 'branch@e.mail',
798
            branchreplyto => 'branch@reply.to',
799
            pickup_location => 1
800
        }
801
    });
802
    my $item = $builder->build_sample_item({
803
        homebranch => $branch->branchcode,
804
        holdingbranch => $branch->branchcode
805
    });
793
806
794
    my $wants_hold_and_email = {
807
    my $wants_hold_and_email = {
795
        wants_digest => '0',
808
        wants_digest => '0',
Lines 852-863 subtest '_koha_notify_reserve() tests' => sub { Link Here
852
        })->next()->to_address();
865
        })->next()->to_address();
853
    is($sms_message_address, undef ,"We should not populate the sms message with the sms number, sending will do so");
866
    is($sms_message_address, undef ,"We should not populate the sms message with the sms number, sending will do so");
854
867
855
    my $email_message_address = $schema->resultset('MessageQueue')->search({
868
    my $email = $schema->resultset('MessageQueue')->search({
856
            letter_code     => 'HOLD',
869
            letter_code     => 'HOLD',
857
            message_transport_type => 'email',
870
            message_transport_type => 'email',
858
            borrowernumber => $hold_borrower,
871
            borrowernumber => $hold_borrower,
859
        })->next()->to_address();
872
        })->next();
860
    is($email_message_address, undef ,"We should not populate the hold message with the email address, sending will do so");
873
    my $email_to_address = $email->to_address();
874
    is($email_to_address, undef ,"We should not populate the hold message with the email address, sending will do so");
875
    my $email_from_address = $email->from_address();
876
    is($email_from_address,'branch@e.mail',"Library's from address is used for sending");
861
877
862
};
878
};
863
879
864
- 

Return to bug 32455