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

(-)a/t/db_dependent/SIP/Message.t (-2 / +55 lines)
Lines 21-27 Link Here
21
# along with Koha; if not, see <http://www.gnu.org/licenses>.
21
# along with Koha; if not, see <http://www.gnu.org/licenses>.
22
22
23
use Modern::Perl;
23
use Modern::Perl;
24
use Test::More tests => 7;
24
use Test::More tests => 8;
25
use Test::MockObject;
25
use Test::MockObject;
26
use Test::MockModule;
26
use Test::MockModule;
27
use Test::Warn;
27
use Test::Warn;
Lines 196-201 subtest "Test build_additional_item_fields_string" => sub { Link Here
196
    $schema->storage->txn_rollback;
196
    $schema->storage->txn_rollback;
197
};
197
};
198
198
199
subtest 'Patron info summary > 5 should not crash server' => sub {
200
201
    my $schema = Koha::Database->new->schema;
202
    $schema->storage->txn_begin;
203
204
    plan tests => 22;
205
    my $builder = t::lib::TestBuilder->new();
206
    my $branchcode = $builder->build({ source => 'Branch' })->{branchcode};
207
    my ( $response, $findpatron );
208
    my $mocks = create_mocks( \$response, \$findpatron, \$branchcode );
209
    my $seen_patron = $builder->build({
210
        source => 'Borrower',
211
        value  => {
212
            lastseen => '2001-01-01',
213
            password => hash_password( PATRON_PW ),
214
            branchcode => $branchcode,
215
        },
216
    });
217
    my $cardnum = $seen_patron->{cardnumber};
218
    my $sip_patron = C4::SIP::ILS::Patron->new( $cardnum );
219
    $findpatron = $sip_patron;
220
221
    my @summaries = (
222
        '          ',
223
        'Y         ',
224
        ' Y        ',
225
        '  Y       ',
226
        '   Y      ',
227
        '    Y     ',
228
        '     Y    ',
229
        '      Y   ',
230
        '       Y  ',
231
        '        Y ',
232
        '         Y',
233
    );
234
    for my $summary ( @summaries ) {
235
        my $siprequest = PATRON_INFO . 'engYYYYMMDDZZZZHHMMSS' . $summary .
236
            FID_INST_ID . $branchcode . '|' .
237
            FID_PATRON_ID . $cardnum . '|' .
238
            FID_PATRON_PWD . PATRON_PW . '|';
239
        my $msg = C4::SIP::Sip::MsgType->new( $siprequest, 0 );
240
241
        my $server = { ils => $mocks->{ils} };
242
        undef $response;
243
        $msg->handle_patron_info( $server );
244
245
        isnt( $response, undef, 'At least we got a response.' );
246
        my $respcode = substr( $response, 0, 2 );
247
        is( $respcode, PATRON_INFO_RESP, 'Response code fine' );
248
    }
249
250
    $schema->storage->txn_rollback;
251
};
252
199
# Here is room for some more subtests
253
# Here is room for some more subtests
200
254
201
# END of main code
255
# END of main code
202
- 

Return to bug 25903