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

(-)a/t/db_dependent/Illrequests.t (-2 / +50 lines)
Lines 41-47 use Test::Exception; Link Here
41
use Test::Deep qw/ cmp_deeply ignore /;
41
use Test::Deep qw/ cmp_deeply ignore /;
42
use Test::Warn;
42
use Test::Warn;
43
43
44
use Test::More tests => 13;
44
use Test::More tests => 14;
45
45
46
my $schema = Koha::Database->new->schema;
46
my $schema = Koha::Database->new->schema;
47
my $builder = t::lib::TestBuilder->new;
47
my $builder = t::lib::TestBuilder->new;
Lines 125-130 subtest 'Basic object tests' => sub { Link Here
125
    $schema->storage->txn_rollback;
125
    $schema->storage->txn_rollback;
126
};
126
};
127
127
128
subtest 'store borrowernumber change also updates holds' => sub {
129
    plan tests => 3;
130
131
    $schema->storage->txn_begin;
132
133
    Koha::Illrequests->search->delete;
134
135
    my $patron = $builder->build_object({ class => 'Koha::Patrons' });
136
    my $other_patron = $builder->build_object({ class => 'Koha::Patrons' });
137
    my $biblio = $builder->build_object({ class => 'Koha::Biblios' });
138
139
    my $request = $builder->build_object({
140
        class => 'Koha::Illrequests',
141
        value => {
142
            borrowernumber => $patron->borrowernumber,
143
            biblio_id => $biblio->biblionumber,
144
        }
145
    });
146
    $builder->build({
147
        source => 'Reserve',
148
        value => {
149
            borrowernumber => $patron->borrowernumber,
150
            biblionumber => $request->biblio_id
151
        }
152
    });
153
154
    my $hold = Koha::Holds->find({
155
        biblionumber => $request->biblio_id,
156
        borrowernumber => $request->borrowernumber,
157
    });
158
159
    is( $hold->borrowernumber, $request->borrowernumber,
160
       'before change, original borrowernumber found' );
161
162
    $request->borrowernumber( $other_patron->borrowernumber )->store;
163
164
    # reload changes
165
    $hold->discard_changes;
166
167
    is( $hold->borrowernumber, $other_patron->borrowernumber,
168
       'after change, changed borrowernumber found in holds' );
169
170
    is( $request->borrowernumber, $other_patron->borrowernumber,
171
       'after change, changed borrowernumber found in illrequests' );
172
173
    $schema->storage->txn_rollback;
174
175
};
176
128
subtest 'Working with related objects' => sub {
177
subtest 'Working with related objects' => sub {
129
178
130
    plan tests => 7;
179
    plan tests => 7;
131
- 

Return to bug 22321