Line 0
Link Here
|
0 |
- |
1 |
# |
|
|
2 |
# WARNING!!!!! |
3 |
# THIS FILE SHOULD NOT BE A PART OF KOHA, AND IF YOU WON'T TEST BUG 23571 YOU SHOULD NOT USE IT |
4 |
# THIS FILE IS CREATED TO FILL DATABASE WITH USERS, BIBLIOS, ITEMS AND ISSUES |
5 |
# YOUR DATABASE MAY END CORRUPTED |
6 |
# PLEASE USE IT ON TEST / DEVELOPMENT DATABASE |
7 |
# |
8 |
|
9 |
use Modern::Perl; |
10 |
|
11 |
use Test::More tests => 1; |
12 |
|
13 |
use t::lib::TestBuilder; |
14 |
use t::lib::Mocks; |
15 |
|
16 |
use Koha::Database; |
17 |
|
18 |
use C4::Circulation; |
19 |
|
20 |
#use Data::Printer colored => 1; |
21 |
|
22 |
subtest "create 5000 patrons, 5000 biblios, 10000 items and 10000 issues" => sub { |
23 |
plan tests => 1; |
24 |
ok(1, 'Everything is wondeful!'); |
25 |
my $me = 'parent'; |
26 |
if(my $pid = fork) { |
27 |
} elsif (defined $pid) { |
28 |
$me = 'child'; |
29 |
} else { |
30 |
# fork failed, so exit immediately |
31 |
# fork failed, so exit immediately |
32 |
warn "fork failed while attempting to run offline_circ/process_koc.pl as a background job"; |
33 |
exit 0; |
34 |
} |
35 |
|
36 |
my $builder = t::lib::TestBuilder->new; |
37 |
|
38 |
my $library = $builder->build( { source => 'Branch' } ); |
39 |
|
40 |
t::lib::Mocks::mock_userenv({ branchcode => $library->{branchcode} }); |
41 |
|
42 |
my $count = 2500; |
43 |
while($count-- >= 0) { |
44 |
warn "\n$me: $count loops to go, ".($count > 1250?"grab a cup of tea":"refill tea")."\n"; |
45 |
my $patron = $builder->build({ source => 'Borrower' }); |
46 |
#p($patron); |
47 |
my $biblio = $builder->build_sample_biblio; |
48 |
my $item1 = $builder->build_sample_item({ |
49 |
biblionumber => $biblio->biblionumber, |
50 |
}); |
51 |
my $item2 = $builder->build_sample_item({ |
52 |
biblionumber => $biblio->biblionumber, |
53 |
}); |
54 |
C4::Circulation::AddIssue( $patron, $item1->barcode ); |
55 |
C4::Circulation::AddIssue( $patron, $item2->barcode ); |
56 |
} |
57 |
|
58 |
} |