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

(-)a/t/db_dependent/Accounts.t (-4 / +3 lines)
Lines 52-62 my $schema = Koha::Database->new->schema; Link Here
52
$schema->storage->txn_begin;
52
$schema->storage->txn_begin;
53
my $dbh = C4::Context->dbh;
53
my $dbh = C4::Context->dbh;
54
54
55
# this test needs a MPL branch; also create another one
55
my $builder = t::lib::TestBuilder->new();
56
my $builder = t::lib::TestBuilder->new();
56
57
$builder->build({ source => 'Branch', value => { branchcode => 'MPL' }});
57
my $library = $builder->build({
58
my $library = $builder->build({ source => 'Branch' });
58
    source => 'Branch',
59
});
60
59
61
$dbh->do(q|DELETE FROM accountlines|);
60
$dbh->do(q|DELETE FROM accountlines|);
62
$dbh->do(q|DELETE FROM issues|);
61
$dbh->do(q|DELETE FROM issues|);
(-)a/t/db_dependent/Barcodes.t (-4 / +4 lines)
Lines 43-50 subtest 'Test generation of annual barcodes from DB values' => sub { Link Here
43
43
44
    plan tests => 4;
44
    plan tests => 4;
45
45
46
    $builder->clear( { source => 'Issue' } );
46
    $builder->schema->resultset( 'Issue' )->delete_all;
47
    $builder->clear( { source => 'Item' } );
47
    $builder->schema->resultset( 'Item' )->delete_all;
48
48
49
    my $barcodeobj;
49
    my $barcodeobj;
50
50
Lines 84-91 subtest 'Test generation of annual barcodes from DB values' => sub { Link Here
84
};
84
};
85
85
86
86
87
$builder->clear( { source => 'Issue' } );
87
$builder->schema->resultset( 'Issue' )->delete_all;
88
$builder->clear( { source => 'Item' } );
88
$builder->schema->resultset( 'Item' )->delete_all;
89
89
90
my %thash = (
90
my %thash = (
91
    incremental => [],
91
    incremental => [],
(-)a/t/db_dependent/Circulation/AnonymiseIssueHistory.t (-3 / +8 lines)
Lines 35-48 $schema->storage->txn_begin; Link Here
35
my $builder = t::lib::TestBuilder->new;
35
my $builder = t::lib::TestBuilder->new;
36
36
37
# TODO create a subroutine in t::lib::Mocks
37
# TODO create a subroutine in t::lib::Mocks
38
my $userenv_patron = $builder->build( { source => 'Borrower', }, );
38
my $branch = $builder->build({ source => 'Branch' });
39
my $userenv_patron = $builder->build({
40
    source => 'Borrower',
41
    value  => { branchcode => $branch->{branchcode} },
42
});
39
C4::Context->_new_userenv('DUMMY SESSION');
43
C4::Context->_new_userenv('DUMMY SESSION');
40
C4::Context->set_userenv(
44
C4::Context->set_userenv(
41
    $userenv_patron->{borrowernumber},
45
    $userenv_patron->{borrowernumber},
42
    $userenv_patron->{userid},
46
    $userenv_patron->{userid},
43
    'usercnum', 'First name', 'Surname',
47
    'usercnum', 'First name', 'Surname',
44
    $userenv_patron->{_fk}{branchcode}{branchcode},
48
    $branch->{branchcode},
45
    $userenv_patron->{_fk}{branchcode}{branchname}, 0
49
    $branch->{branchname},
50
    0,
46
);
51
);
47
52
48
my $anonymous = $builder->build( { source => 'Borrower', }, );
53
my $anonymous = $builder->build( { source => 'Borrower', }, );
(-)a/t/db_dependent/Circulation/CalcFine.t (+7 lines)
Lines 65-70 my $item = $builder->build( Link Here
65
65
66
subtest 'Test basic functionality' => sub {
66
subtest 'Test basic functionality' => sub {
67
    plan tests => 1;
67
    plan tests => 1;
68
69
    my $rule = $builder->schema->resultset('Issuingrule')->find({
70
        branchcode                    => '*',
71
        categorycode                  => '*',
72
        itemtype                      => '*',
73
    });
74
    $rule->delete if $rule;
68
    my $issuingrule = $builder->build(
75
    my $issuingrule = $builder->build(
69
        {
76
        {
70
            source => 'Issuingrule',
77
            source => 'Issuingrule',
(-)a/t/db_dependent/Holds.t (+6 lines)
Lines 34-39 my $dbh = C4::Context->dbh; Link Here
34
my $branch_1 = $builder->build({ source => 'Branch' })->{ branchcode };
34
my $branch_1 = $builder->build({ source => 'Branch' })->{ branchcode };
35
my $branch_2 = $builder->build({ source => 'Branch' })->{ branchcode };
35
my $branch_2 = $builder->build({ source => 'Branch' })->{ branchcode };
36
36
37
# This test assumes we have a category S. This statement helps.
38
$builder->build({
39
    source => 'Category',
40
    value  => { categorycode => 'S', category_type => 'S' },
41
});
42
37
my $borrowers_count = 5;
43
my $borrowers_count = 5;
38
44
39
$dbh->do('DELETE FROM itemtypes');
45
$dbh->do('DELETE FROM itemtypes');
(-)a/t/db_dependent/Items/MoveItemFromBiblio.t (-2 / +9 lines)
Lines 23-36 use C4::Reserves; Link Here
23
use Koha::Database;
23
use Koha::Database;
24
24
25
use t::lib::TestBuilder;
25
use t::lib::TestBuilder;
26
use Data::Dumper qw|Dumper|;
26
27
27
my $schema  = Koha::Database->new->schema;
28
my $schema  = Koha::Database->new->schema;
28
$schema->storage->txn_begin;
29
$schema->storage->txn_begin;
29
my $builder = t::lib::TestBuilder->new;
30
my $builder = t::lib::TestBuilder->new;
30
31
31
# NOTE This is a trick, if we want to populate the biblioitems table, we should not create a Biblio but a Biblioitem
32
# NOTE This is a trick, if we want to populate the biblioitems table, we should not create a Biblio but a Biblioitem
32
my $from_biblio = $builder->build( { source => 'Biblioitem', } )->{_fk}{biblionumber};
33
my $param = { source => 'Biblioitem' };
33
my $to_biblio   = $builder->build( { source => 'Biblioitem', } )->{_fk}{biblionumber};
34
my $from_biblio = {
35
    biblionumber => $builder->build($param)->{biblionumber},
36
};
37
my $to_biblio = {
38
    biblionumber => $builder->build($param)->{biblionumber},
39
};
40
34
my $item1       = $builder->build(
41
my $item1       = $builder->build(
35
    {   source => 'Item',
42
    {   source => 'Item',
36
        value  => { biblionumber => $from_biblio->{biblionumber}, },
43
        value  => { biblionumber => $from_biblio->{biblionumber}, },
(-)a/t/db_dependent/Members.t (-3 / +1 lines)
Lines 262-268 $builder->build({ Link Here
262
        },
262
        },
263
});
263
});
264
264
265
#$builder->clear( { source => 'Borrower' } );
266
my $borrower1 = $builder->build({
265
my $borrower1 = $builder->build({
267
        source => 'Borrower',
266
        source => 'Borrower',
268
        value  => {
267
        value  => {
Lines 343-349 $patstodel = GetBorrowersToExpunge( {category_code => 'CIVILIAN',patron_list_id Link Here
343
is( scalar(@$patstodel),1,'Borrower with issue not deleted by category_code and list');
342
is( scalar(@$patstodel),1,'Borrower with issue not deleted by category_code and list');
344
$patstodel = GetBorrowersToExpunge( {expired_before => '2015-01-02',patron_list_id => $list1->patron_list_id() } );
343
$patstodel = GetBorrowersToExpunge( {expired_before => '2015-01-02',patron_list_id => $list1->patron_list_id() } );
345
is( scalar(@$patstodel),1,'Borrower with issue not deleted by expiration_date and list');
344
is( scalar(@$patstodel),1,'Borrower with issue not deleted by expiration_date and list');
346
$builder->clear( { source => 'Issue' } );
345
$builder->schema->resultset( 'Issue' )->delete_all;
347
$patstodel = GetBorrowersToExpunge( {patron_list_id => $list1->patron_list_id()} );
346
$patstodel = GetBorrowersToExpunge( {patron_list_id => $list1->patron_list_id()} );
348
ok( scalar(@$patstodel)== 2,'Borrowers without issue deleted from list');
347
ok( scalar(@$patstodel)== 2,'Borrowers without issue deleted from list');
349
$patstodel = GetBorrowersToExpunge( {category_code => 'CIVILIAN',patron_list_id => $list1->patron_list_id() } );
348
$patstodel = GetBorrowersToExpunge( {category_code => 'CIVILIAN',patron_list_id => $list1->patron_list_id() } );
350
- 

Return to bug 16155