Lines 19-25
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 31; |
22 |
use Test::More tests => 32; |
23 |
use Test::Warn; |
23 |
use Test::Warn; |
24 |
use Time::Fake; |
24 |
use Time::Fake; |
25 |
use DateTime; |
25 |
use DateTime; |
Lines 1377-1382
subtest 'Log cardnumber change' => sub {
Link Here
|
1377 |
is( scalar @logs, 2, 'With BorrowerLogs, Change in cardnumber should be logged, as well as general alert of patron mod.' ); |
1377 |
is( scalar @logs, 2, 'With BorrowerLogs, Change in cardnumber should be logged, as well as general alert of patron mod.' ); |
1378 |
}; |
1378 |
}; |
1379 |
|
1379 |
|
|
|
1380 |
subtest 'Patron->guarantees' => sub { |
1381 |
plan tests => 5; |
1382 |
|
1383 |
my $builder = t::lib::TestBuilder->new; |
1384 |
|
1385 |
my $categorycode = $builder->build({ source => 'Category' })->{categorycode}; |
1386 |
my $branchcode = $builder->build({ source => 'Branch' })->{branchcode}; |
1387 |
|
1388 |
my $guarantor = $builder->build_object( { class => 'Koha::Patrons' } ); |
1389 |
|
1390 |
my $guarantee1 = $builder->build_object( { class => 'Koha::Patrons' , value => { |
1391 |
surname => 'Zebra', |
1392 |
guarantorid => $guarantor->borrowernumber |
1393 |
} |
1394 |
})->borrowernumber; |
1395 |
|
1396 |
my $guarantee2 = $builder->build_object( { class => 'Koha::Patrons' , value => { |
1397 |
surname => 'Yak', |
1398 |
guarantorid => $guarantor->borrowernumber |
1399 |
} |
1400 |
})->borrowernumber; |
1401 |
|
1402 |
my $guarantee3 = $builder->build_object( { class => 'Koha::Patrons' , value => { |
1403 |
surname => 'Xerus', |
1404 |
firstname => 'Walrus', |
1405 |
guarantorid => $guarantor->borrowernumber |
1406 |
} |
1407 |
})->borrowernumber; |
1408 |
|
1409 |
my $guarantee4 = $builder->build_object( { class => 'Koha::Patrons' , value => { |
1410 |
surname => 'Xerus', |
1411 |
firstname => 'Vulture', |
1412 |
guarantorid => $guarantor->borrowernumber |
1413 |
} |
1414 |
})->borrowernumber; |
1415 |
|
1416 |
my $guarantee5 = $builder->build_object( { class => 'Koha::Patrons' , value => { |
1417 |
surname => 'Xerus', |
1418 |
firstname => 'Unicorn', |
1419 |
guarantorid => $guarantor->borrowernumber |
1420 |
} |
1421 |
})->borrowernumber; |
1422 |
|
1423 |
my $guarantees = $guarantor->guarantees(); |
1424 |
|
1425 |
is( $guarantees->next()->borrowernumber, $guarantee5, "Return first guarantor alphabetically" ); |
1426 |
is( $guarantees->next()->borrowernumber, $guarantee4, "Return second guarantor alphabetically" ); |
1427 |
is( $guarantees->next()->borrowernumber, $guarantee3, "Return third guarantor alphabetically" ); |
1428 |
is( $guarantees->next()->borrowernumber, $guarantee2, "Return fourth guarantor alphabetically" ); |
1429 |
is( $guarantees->next()->borrowernumber, $guarantee1, "Return fifth guarantor alphabetically" ); |
1430 |
|
1431 |
}; |
1432 |
|
1380 |
$schema->storage->txn_rollback; |
1433 |
$schema->storage->txn_rollback; |
1381 |
|
1434 |
|
1382 |
subtest 'Test Koha::Patrons::merge' => sub { |
1435 |
subtest 'Test Koha::Patrons::merge' => sub { |
1383 |
- |
|
|