|
Lines 2479-2485
subtest 'CanBookBeIssued + Koha::Patron->is_debarred|has_overdues' => sub {
Link Here
|
| 2479 |
subtest 'CanBookBeIssued + Statistic patrons "X"' => sub { |
2479 |
subtest 'CanBookBeIssued + Statistic patrons "X"' => sub { |
| 2480 |
plan tests => 14; |
2480 |
plan tests => 14; |
| 2481 |
|
2481 |
|
| 2482 |
my $library = $builder->build_object( { class => 'Koha::Libraries' } ); |
2482 |
my $library = $builder->build_object( { class => 'Koha::Libraries' } ); |
| 2483 |
my $patron_category_x = $builder->build_object( |
2483 |
my $patron_category_x = $builder->build_object( |
| 2484 |
{ |
2484 |
{ |
| 2485 |
class => 'Koha::Patron::Categories', |
2485 |
class => 'Koha::Patron::Categories', |
|
Lines 2505-2511
subtest 'CanBookBeIssued + Statistic patrons "X"' => sub {
Link Here
|
| 2505 |
); |
2505 |
); |
| 2506 |
|
2506 |
|
| 2507 |
my ( $error, $question, $alerts ) = CanBookBeIssued( $patron, $item_1->barcode ); |
2507 |
my ( $error, $question, $alerts ) = CanBookBeIssued( $patron, $item_1->barcode ); |
| 2508 |
is( $error->{STATS}, 1, '"Error" flag "STATS" must be set if CanBookBeIssued is called with a statistic patron (category_type=X)' ); |
2508 |
is( |
|
|
2509 |
$error->{STATS}, 1, |
| 2510 |
'"Error" flag "STATS" must be set if CanBookBeIssued is called with a statistic patron (category_type=X)' |
| 2511 |
); |
| 2509 |
|
2512 |
|
| 2510 |
my $stat = Koha::Statistics->search( { itemnumber => $item_1->itemnumber } )->next; |
2513 |
my $stat = Koha::Statistics->search( { itemnumber => $item_1->itemnumber } )->next; |
| 2511 |
is( $stat->branch, C4::Context->userenv->{'branch'}, 'Recorded a branch' ); |
2514 |
is( $stat->branch, C4::Context->userenv->{'branch'}, 'Recorded a branch' ); |
|
Lines 2532-2546
subtest 'CanBookBeIssued + Statistic patrons "X"' => sub {
Link Here
|
| 2532 |
my $item_3 = $builder->build_sample_item( { library => $library->branchcode } ); |
2535 |
my $item_3 = $builder->build_sample_item( { library => $library->branchcode } ); |
| 2533 |
CanBookBeIssued( $patron, $item_3->barcode ); |
2536 |
CanBookBeIssued( $patron, $item_3->barcode ); |
| 2534 |
$item_3->discard_changes; |
2537 |
$item_3->discard_changes; |
| 2535 |
is( Koha::Statistics->search( { itemnumber => $item_3->itemnumber } )->count, 1, 'Single entry recorded in the stats table' ); |
2538 |
is( |
|
|
2539 |
Koha::Statistics->search( { itemnumber => $item_3->itemnumber } )->count, 1, |
| 2540 |
'Single entry recorded in the stats table' |
| 2541 |
); |
| 2536 |
|
2542 |
|
| 2537 |
my $item_4 = $builder->build_sample_item( { library => $library->branchcode } ); |
2543 |
my $item_4 = $builder->build_sample_item( { library => $library->branchcode } ); |
| 2538 |
AddIssue( $patron_2, $item_4->barcode ); |
2544 |
AddIssue( $patron_2, $item_4->barcode ); |
| 2539 |
$item_4->discard_changes; |
2545 |
$item_4->discard_changes; |
| 2540 |
is( Koha::Statistics->search( { itemnumber => $item_4->itemnumber } )->count, 1, 'Issue should be recorded in statistics table for item 4.' ); |
2546 |
is( |
|
|
2547 |
Koha::Statistics->search( { itemnumber => $item_4->itemnumber } )->count, 1, |
| 2548 |
'Issue should be recorded in statistics table for item 4.' |
| 2549 |
); |
| 2541 |
CanBookBeIssued( $patron, $item_4->barcode ); |
2550 |
CanBookBeIssued( $patron, $item_4->barcode ); |
| 2542 |
$item_4->discard_changes; |
2551 |
$item_4->discard_changes; |
| 2543 |
is( Koha::Statistics->search( { itemnumber => $item_4->itemnumber } )->count, 3, 'Issue, return, and localuse should be recorded in statistics table for item 4.' ); |
2552 |
is( |
|
|
2553 |
Koha::Statistics->search( { itemnumber => $item_4->itemnumber } )->count, 3, |
| 2554 |
'Issue, return, and localuse should be recorded in statistics table for item 4.' |
| 2555 |
); |
| 2544 |
|
2556 |
|
| 2545 |
# TODO There are other tests to provide here |
2557 |
# TODO There are other tests to provide here |
| 2546 |
}; |
2558 |
}; |
| 2547 |
- |
|
|