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

(-)a/t/db_dependent/Accounts.t (-1 / +3 lines)
Lines 47-54 can_ok( 'C4::Accounts', Link Here
47
        WriteOffFee )
47
        WriteOffFee )
48
);
48
);
49
49
50
my $schema  = Koha::Database->new->schema;
51
$schema->storage->txn_begin;
52
50
my $builder = t::lib::TestBuilder->new();
53
my $builder = t::lib::TestBuilder->new();
51
my $schema  = Koha::Database->new()->schema();
52
54
53
my $dbh = C4::Context->dbh;
55
my $dbh = C4::Context->dbh;
54
$dbh->{RaiseError}=1;
56
$dbh->{RaiseError}=1;
(-)a/t/db_dependent/Barcodes_ValueBuilder.t (+25 lines)
Lines 1-15 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it under the
6
# terms of the GNU General Public License as published by the Free Software
7
# Foundation; either version 3 of the License, or (at your option) any later
8
# version.
9
#
10
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License along
15
# with Koha; if not, see <http://www.gnu.org/licenses>.
16
3
use Modern::Perl;
17
use Modern::Perl;
18
4
use Test::More tests => 7;
19
use Test::More tests => 7;
5
use Test::MockModule;
20
use Test::MockModule;
6
use t::lib::TestBuilder;
21
use t::lib::TestBuilder;
7
22
23
use Koha::Database;
24
8
BEGIN {
25
BEGIN {
9
    use_ok('C4::Barcodes::ValueBuilder');
26
    use_ok('C4::Barcodes::ValueBuilder');
10
};
27
};
11
28
29
my $schema  = Koha::Database->new->schema;
30
$schema->storage->txn_begin;
31
12
my $builder = t::lib::TestBuilder->new;
32
my $builder = t::lib::TestBuilder->new;
33
13
my $dbh = C4::Context->dbh;
34
my $dbh = C4::Context->dbh;
14
$dbh->do(q|DELETE FROM items|);
35
$dbh->do(q|DELETE FROM items|);
15
my $item_1 = $builder->build({
36
my $item_1 = $builder->build({
Lines 52-54 ok(length($scr) > 0, 'hbyymmincr javascript'); Link Here
52
($nextnum, $scr) = C4::Barcodes::ValueBuilder::annual::get_barcode(\%args);
73
($nextnum, $scr) = C4::Barcodes::ValueBuilder::annual::get_barcode(\%args);
53
is($nextnum, '2012-0035', 'annual barcode');
74
is($nextnum, '2012-0035', 'annual barcode');
54
is($scr, undef, 'annual javascript');
75
is($scr, undef, 'annual javascript');
76
77
$schema->storage->txn_rollback;
78
79
1;
(-)a/t/db_dependent/Borrower_Discharge.t (-1 / +24 lines)
Lines 1-4 Link Here
1
#!/usr/bin/perl;
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it under the
6
# terms of the GNU General Public License as published by the Free Software
7
# Foundation; either version 3 of the License, or (at your option) any later
8
# version.
9
#
10
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License along
15
# with Koha; if not, see <http://www.gnu.org/licenses>.
2
16
3
use Modern::Perl;
17
use Modern::Perl;
4
use Test::More tests => 17;
18
use Test::More tests => 17;
Lines 13-20 use C4::Members qw( AddMember GetMember ); Link Here
13
27
14
use t::lib::TestBuilder;
28
use t::lib::TestBuilder;
15
use Koha::Borrower::Discharge;
29
use Koha::Borrower::Discharge;
30
use Koha::Database;
31
32
my $schema  = Koha::Database->new->schema;
33
$schema->storage->txn_begin;
16
34
17
my $builder = t::lib::TestBuilder->new;
35
my $builder = t::lib::TestBuilder->new;
36
18
my $dbh = C4::Context->dbh;
37
my $dbh = C4::Context->dbh;
19
$dbh->do(q|DELETE FROM discharges|);
38
$dbh->do(q|DELETE FROM discharges|);
20
39
Lines 102-104 else { Link Here
102
# The error is:
121
# The error is:
103
# DBIx::Class::ResultSet::create(): DBI Exception: DBD::mysql::st execute failed: Lock wait timeout exceeded; try restarting transaction [for Statement "INSERT INTO discharges ( borrower, needed, validated) VALUES ( ?, ?, ? )" with ParamValues: 0='121', 1='2014-01-08T16:38:29', 2=undef] at /home/koha/src/Koha/DataObject/Discharge.pm line 33
122
# DBIx::Class::ResultSet::create(): DBI Exception: DBD::mysql::st execute failed: Lock wait timeout exceeded; try restarting transaction [for Statement "INSERT INTO discharges ( borrower, needed, validated) VALUES ( ?, ?, ? )" with ParamValues: 0='121', 1='2014-01-08T16:38:29', 2=undef] at /home/koha/src/Koha/DataObject/Discharge.pm line 33
104
#is( Koha::Service::Borrower::Discharge::request({ borrowernumber => $borrower->{borrowernumber} }), 1, 'Discharge request sent' );
123
#is( Koha::Service::Borrower::Discharge::request({ borrowernumber => $borrower->{borrowernumber} }), 1, 'Discharge request sent' );
124
125
$schema->storage->txn_rollback;
126
127
1;
(-)a/t/db_dependent/Category.t (+11 lines)
Lines 18-31 Link Here
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
use t::lib::TestBuilder;
22
use t::lib::TestBuilder;
22
use Test::More tests => 3;
23
use Test::More tests => 3;
23
24
25
use Koha::Database;
26
24
BEGIN {
27
BEGIN {
25
    use_ok('C4::Category');
28
    use_ok('C4::Category');
26
}
29
}
27
30
31
my $schema  = Koha::Database->new->schema;
32
$schema->storage->txn_begin;
33
28
my $builder = t::lib::TestBuilder->new();
34
my $builder = t::lib::TestBuilder->new();
35
29
my $nonexistent_categorycode = 'NONEXISTEN';
36
my $nonexistent_categorycode = 'NONEXISTEN';
30
$builder->build({
37
$builder->build({
31
    source => 'Category',
38
    source => 'Category',
Lines 49-51 ok( @categories, 'all returns categories' ); Link Here
49
56
50
my $match = grep {$_->{categorycode} eq $nonexistent_categorycode } @categories;
57
my $match = grep {$_->{categorycode} eq $nonexistent_categorycode } @categories;
51
is( $match, 1, 'all returns the inserted category');
58
is( $match, 1, 'all returns the inserted category');
59
60
$schema->storage->txn_rollback;
61
62
1;
(-)a/t/db_dependent/Circulation/AnonymiseIssueHistory.t (+28 lines)
Lines 1-11 Link Here
1
2
#!/usr/bin/perl
3
4
# This file is part of Koha.
5
#
6
# Koha is free software; you can redistribute it and/or modify it
7
# under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 3 of the License, or
9
# (at your option) any later version.
10
#
11
# Koha is distributed in the hope that it will be useful, but
12
# WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License
17
# along with Koha; if not, see <http://www.gnu.org/licenses>.
18
1
use Modern::Perl;
19
use Modern::Perl;
20
2
use Test::More tests => 3;
21
use Test::More tests => 3;
3
22
4
use C4::Context;
23
use C4::Context;
5
use C4::Circulation;
24
use C4::Circulation;
25
use Koha::Database;
26
6
use t::lib::Mocks;
27
use t::lib::Mocks;
7
use t::lib::TestBuilder;
28
use t::lib::TestBuilder;
8
29
30
my $schema  = Koha::Database->new->schema;
31
$schema->storage->txn_begin;
32
9
my $builder = t::lib::TestBuilder->new;
33
my $builder = t::lib::TestBuilder->new;
10
34
11
# TODO create a subroutine in t::lib::Mocks
35
# TODO create a subroutine in t::lib::Mocks
Lines 136-138 subtest 'AnonymousPatron is not defined' => sub { Link Here
136
    |, undef, $item->{itemnumber});
160
    |, undef, $item->{itemnumber});
137
    is( $borrowernumber_used_to_anonymised, undef, 'With AnonymousPatron is not defined, the issue should have been anonymised anyway' );
161
    is( $borrowernumber_used_to_anonymised, undef, 'With AnonymousPatron is not defined, the issue should have been anonymised anyway' );
138
};
162
};
163
164
$schema->storage->txn_rollback;
165
166
1;
(-)a/t/db_dependent/Circulation/TooMany.t (-2 / +22 lines)
Lines 1-5 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it under the
6
# terms of the GNU General Public License as published by the Free Software
7
# Foundation; either version 3 of the License, or (at your option) any later
8
# version.
9
#
10
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License along
15
# with Koha; if not, see <http://www.gnu.org/licenses>.
16
3
use Modern::Perl;
17
use Modern::Perl;
4
use Test::More tests => 6;
18
use Test::More tests => 6;
5
use C4::Context;
19
use C4::Context;
Lines 12-24 use C4::Items; Link Here
12
use C4::Context;
26
use C4::Context;
13
27
14
use Koha::DateUtils qw( dt_from_string );
28
use Koha::DateUtils qw( dt_from_string );
29
use Koha::Database;
15
30
16
use t::lib::TestBuilder;
31
use t::lib::TestBuilder;
17
use t::lib::Mocks;
32
use t::lib::Mocks;
18
33
34
my $schema = Koha::Database->new->schema;
35
$schema->storage->txn_begin;
36
19
our $dbh = C4::Context->dbh;
37
our $dbh = C4::Context->dbh;
20
$dbh->{AutoCommit} = 0;
21
$dbh->{RaiseError} = 1;
22
38
23
$dbh->do(q|DELETE FROM issues|);
39
$dbh->do(q|DELETE FROM issues|);
24
$dbh->do(q|DELETE FROM items|);
40
$dbh->do(q|DELETE FROM items|);
Lines 389-395 subtest '1 BranchBorrowerCircRule exist: 1 CO allowed, 1 OSCO allowed' => sub { Link Here
389
    teardown();
405
    teardown();
390
};
406
};
391
407
408
$schema->storage->txn_rollback;
409
392
sub teardown {
410
sub teardown {
393
    $dbh->do(q|DELETE FROM issues|);
411
    $dbh->do(q|DELETE FROM issues|);
394
    $dbh->do(q|DELETE FROM issuingrules|);
412
    $dbh->do(q|DELETE FROM issuingrules|);
395
}
413
}
414
415
1;
(-)a/t/db_dependent/Circulation_dateexpiry.t (+12 lines)
Lines 22-31 use Time::HiRes qw/gettimeofday time/; Link Here
22
use Test::More tests => 2;
22
use Test::More tests => 2;
23
use C4::Members;
23
use C4::Members;
24
use Koha::DateUtils;
24
use Koha::DateUtils;
25
use Koha::Database;
26
25
use t::lib::TestBuilder;
27
use t::lib::TestBuilder;
26
use t::lib::Mocks qw( mock_preference );
28
use t::lib::Mocks qw( mock_preference );
27
29
30
my $schema  = Koha::Database->new->schema;
31
$schema->storage->txn_begin;
32
28
my $builder = t::lib::TestBuilder->new();
33
my $builder = t::lib::TestBuilder->new();
34
35
$ENV{ DEBUG } = 0;
36
29
subtest 'Tests for CanBookBeIssued related to dateexpiry' => sub {
37
subtest 'Tests for CanBookBeIssued related to dateexpiry' => sub {
30
    plan tests => 4;
38
    plan tests => 4;
31
    can_book_be_issued();
39
    can_book_be_issued();
Lines 109-111 sub calc_date_due { Link Here
109
    my $t2 = time;
117
    my $t2 = time;
110
    is( ref $d eq "DateTime" && $t2 - $t1 < 1, 1, "CalcDateDue with expiry in year 9876 in " . sprintf( "%6.4f", $t2 - $t1 ) . " seconds." );
118
    is( ref $d eq "DateTime" && $t2 - $t1 < 1, 1, "CalcDateDue with expiry in year 9876 in " . sprintf( "%6.4f", $t2 - $t1 ) . " seconds." );
111
}
119
}
120
121
$schema->storage->txn_rollback;
122
123
1;
(-)a/t/db_dependent/Exporter/Record.t (-14 / +30 lines)
Lines 1-32 Link Here
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
1
use Modern::Perl;
18
use Modern::Perl;
19
2
use Test::More tests => 3;
20
use Test::More tests => 3;
21
use t::lib::TestBuilder;
22
3
use MARC::Record;
23
use MARC::Record;
4
use MARC::File::USMARC;
24
use MARC::File::USMARC;
5
use MARC::File::XML;# ( BinaryEncoding => 'utf-8' );
25
use MARC::File::XML;
6
#use XML::Simple;
7
use MARC::Batch;
26
use MARC::Batch;
8
use t::lib::TestBuilder;
9
use File::Slurp;
27
use File::Slurp;
10
#use utf8;
11
use Encode;
28
use Encode;
12
29
13
use C4::Biblio;
30
use C4::Biblio;
14
use C4::Context;
31
use C4::Context;
15
32
use Koha::Database;
16
use Koha::Exporter::Record;
33
use Koha::Exporter::Record;
17
34
18
my $dbh = C4::Context->dbh;
35
my $schema  = Koha::Database->new->schema;
19
#$dbh->{AutoCommit} = 0;
36
$schema->storage->txn_begin;
20
#$dbh->{RaiseError} = 1;
21
37
22
#$dbh->do(q|DELETE FROM issues|);
38
my $dbh = C4::Context->dbh;
23
#$dbh->do(q|DELETE FROM reserves|);
24
#$dbh->do(q|DELETE FROM items|);
25
#$dbh->do(q|DELETE FROM biblio|);
26
#$dbh->do(q|DELETE FROM auth_header|);
27
39
28
my $biblio_1_title = 'Silence in the library';
40
my $biblio_1_title = 'Silence in the library';
29
#my $biblio_2_title = Encode::encode('UTF-8', 'The art of computer programming ກ ຂ ຄ ງ ຈ ຊ ຍ é');
30
my $biblio_2_title = 'The art of computer programming ກ ຂ ຄ ງ ຈ ຊ ຍ é';
41
my $biblio_2_title = 'The art of computer programming ກ ຂ ຄ ງ ຈ ຊ ຍ é';
31
my $biblio_1 = MARC::Record->new();
42
my $biblio_1 = MARC::Record->new();
32
$biblio_1->leader('00266nam a22001097a 4500');
43
$biblio_1->leader('00266nam a22001097a 4500');
Lines 164-166 subtest 'export iso2709' => sub { Link Here
164
    $title = Encode::encode('UTF-8', $title);
175
    $title = Encode::encode('UTF-8', $title);
165
    is( $title, $biblio_2_title, 'Export ISO2709: The title is correctly encoded' );
176
    is( $title, $biblio_2_title, 'Export ISO2709: The title is correctly encoded' );
166
};
177
};
178
179
$schema->storage->txn_rollback;
180
181
1;
182
(-)a/t/db_dependent/Holds.t (-8 / +6 lines)
Lines 14-23 use C4::Biblio; Link Here
14
use C4::Items;
14
use C4::Items;
15
use C4::Members;
15
use C4::Members;
16
use C4::Calendar;
16
use C4::Calendar;
17
17
use Koha::Database;
18
use Koha::Holds;
19
20
use Koha::DateUtils qw( dt_from_string output_pref );
18
use Koha::DateUtils qw( dt_from_string output_pref );
19
use Koha::Holds;
21
20
22
BEGIN {
21
BEGIN {
23
    use FindBin;
22
    use FindBin;
Lines 25-36 BEGIN { Link Here
25
    use_ok('C4::Reserves');
24
    use_ok('C4::Reserves');
26
}
25
}
27
26
28
my $builder = t::lib::TestBuilder->new();
27
my $schema  = Koha::Database->new->schema;
29
my $dbh = C4::Context->dbh;
28
$schema->storage->txn_begin;
30
29
31
# Start transaction
30
my $builder = t::lib::TestBuilder->new();
32
$dbh->{AutoCommit} = 0;
31
my $dbh     = C4::Context->dbh;
33
$dbh->{RaiseError} = 1;
34
32
35
# Create two random branches
33
# Create two random branches
36
my $branch_1 = $builder->build({ source => 'Branch' })->{ branchcode };
34
my $branch_1 = $builder->build({ source => 'Branch' })->{ branchcode };
(-)a/t/db_dependent/Holidays.t (-4 / +5 lines)
Lines 22-27 use t::lib::TestBuilder; Link Here
22
22
23
use C4::Context;
23
use C4::Context;
24
use C4::Branch;
24
use C4::Branch;
25
use Koha::Database;
25
use Koha::DateUtils;
26
use Koha::DateUtils;
26
27
27
use DateTime;
28
use DateTime;
Lines 32-41 BEGIN { Link Here
32
    use_ok('C4::Calendar');
33
    use_ok('C4::Calendar');
33
}
34
}
34
35
36
my $schema = Koha::Database->new->schema;
37
$schema->storage->txn_begin;
38
35
my $dbh = C4::Context->dbh();
39
my $dbh = C4::Context->dbh();
36
# Start transaction
37
$dbh->{AutoCommit} = 0;
38
$dbh->{RaiseError} = 1;
39
40
40
my $builder = t::lib::TestBuilder->new();
41
my $builder = t::lib::TestBuilder->new();
41
# Create two fresh branches for the tests
42
# Create two fresh branches for the tests
Lines 118-123 C4::Calendar->new( branchcode => $branch_2 )->insert_single_holiday( Link Here
118
is( Koha::Calendar->new( branchcode => $branch_2 )->is_holiday( $today ), 1, "Today is a holiday for $branch_2" );
119
is( Koha::Calendar->new( branchcode => $branch_2 )->is_holiday( $today ), 1, "Today is a holiday for $branch_2" );
119
is( Koha::Calendar->new( branchcode => $branch_1 )->is_holiday( $today ), 0, "Today is not a holiday for $branch_1");
120
is( Koha::Calendar->new( branchcode => $branch_1 )->is_holiday( $today ), 0, "Today is not a holiday for $branch_1");
120
121
121
$dbh->rollback;
122
$schema->storage->txn_rollback;
122
123
123
1;
124
1;
(-)a/t/db_dependent/Items.t (-3 / +1 lines)
Lines 34-40 BEGIN { Link Here
34
    use_ok('Koha::Items');
34
    use_ok('Koha::Items');
35
}
35
}
36
36
37
my $schema = Koha::Database->new->schema;
37
my $schema  = Koha::Database->new->schema;
38
38
39
my $branches = GetBranches;
39
my $branches = GetBranches;
40
my ($branch1, $branch2) = keys %$branches;
40
my ($branch1, $branch2) = keys %$branches;
Lines 216-223 subtest q{Test Koha::Database->schema()->resultset('Item')->itemtype()} => sub { Link Here
216
216
217
    $schema->storage->txn_begin;
217
    $schema->storage->txn_begin;
218
218
219
    my $schema = Koha::Database->new()->schema();
220
221
    my $biblio =
219
    my $biblio =
222
    $schema->resultset('Biblio')->create(
220
    $schema->resultset('Biblio')->create(
223
        {
221
        {
(-)a/t/db_dependent/Items/MoveItemFromBiblio.t (+8 lines)
Lines 20-28 use Test::More tests => 8; Link Here
20
20
21
use C4::Items;
21
use C4::Items;
22
use C4::Reserves;
22
use C4::Reserves;
23
use Koha::Database;
23
24
24
use t::lib::TestBuilder;
25
use t::lib::TestBuilder;
25
26
27
my $schema  = Koha::Database->new->schema;
28
$schema->storage->txn_begin;
26
my $builder = t::lib::TestBuilder->new;
29
my $builder = t::lib::TestBuilder->new;
27
30
28
# NOTE This is a trick, if we want to populate the biblioitems table, we should not create a Biblio but a Biblioitem
31
# NOTE This is a trick, if we want to populate the biblioitems table, we should not create a Biblio but a Biblioitem
Lines 82-84 my $get_item_level_hold_2 = C4::Reserves::GetReserve( $item_level_hold_to_move-> Link Here
82
is( $get_bib_level_hold->{biblionumber},    $from_biblio->{biblionumber}, 'MoveItemFromBiblio should not have moved the biblio-level hold' );
85
is( $get_bib_level_hold->{biblionumber},    $from_biblio->{biblionumber}, 'MoveItemFromBiblio should not have moved the biblio-level hold' );
83
is( $get_item_level_hold_1->{biblionumber}, $from_biblio->{biblionumber}, 'MoveItemFromBiblio should not have moved the item-level hold placed on item 1' );
86
is( $get_item_level_hold_1->{biblionumber}, $from_biblio->{biblionumber}, 'MoveItemFromBiblio should not have moved the item-level hold placed on item 1' );
84
is( $get_item_level_hold_2->{biblionumber}, $to_biblio->{biblionumber},   'MoveItemFromBiblio should have moved the item-level hold placed on item 2' );
87
is( $get_item_level_hold_2->{biblionumber}, $to_biblio->{biblionumber},   'MoveItemFromBiblio should have moved the item-level hold placed on item 2' );
88
89
$schema->storage->txn_rollback;
90
91
1;
92
(-)a/t/db_dependent/Koha/Cities.t (+11 lines)
Lines 18-28 Link Here
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
use Test::More tests => 4;
22
use Test::More tests => 4;
23
22
use Koha::City;
24
use Koha::City;
23
use Koha::Cities;
25
use Koha::Cities;
26
use Koha::Database;
27
24
use t::lib::TestBuilder;
28
use t::lib::TestBuilder;
25
29
30
my $schema = Koha::Database->new->schema;
31
$schema->storage->txn_begin;
32
26
my $builder = t::lib::TestBuilder->new;
33
my $builder = t::lib::TestBuilder->new;
27
my $nb_of_cities = Koha::Cities->search->count;
34
my $nb_of_cities = Koha::Cities->search->count;
28
my $new_city_1 = Koha::City->new({
35
my $new_city_1 = Koha::City->new({
Lines 46-48 is( $retrieved_city_1->city_name, $new_city_1->city_name, 'Find a city by id sho Link Here
46
53
47
$retrieved_city_1->delete;
54
$retrieved_city_1->delete;
48
is( Koha::Cities->search->count, $nb_of_cities + 1, 'Delete should have deleted the city' );
55
is( Koha::Cities->search->count, $nb_of_cities + 1, 'Delete should have deleted the city' );
56
57
$schema->storage->txn_rollback;
58
59
1;
(-)a/t/db_dependent/Members/GetUpcomingMembershipExpires.t (-3 / +11 lines)
Lines 18-35 Link Here
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
use C4::Members;
21
22
use Test::More tests => 5;
22
use Test::MockModule;
23
use Test::MockModule;
23
use t::lib::TestBuilder;
24
use t::lib::TestBuilder;
24
use t::lib::Mocks qw( mock_preference );
25
use t::lib::Mocks qw( mock_preference );
25
26
26
use Test::More tests => 5;
27
use C4::Members;
27
use Test::MockModule;
28
use Koha::Database;
28
29
29
BEGIN {
30
BEGIN {
30
    use_ok('C4::Members');
31
    use_ok('C4::Members');
31
}
32
}
32
33
34
my $schema = Koha::Database->new->schema;
35
$schema->storage->txn_begin;
36
33
my $date_time = new Test::MockModule('DateTime');
37
my $date_time = new Test::MockModule('DateTime');
34
$date_time->mock(
38
$date_time->mock(
35
    'now', sub {
39
    'now', sub {
Lines 115-117 t::lib::Mocks::mock_preference('MembershipExpiryDaysNotice', undef); Link Here
115
119
116
$upcoming_mem_expires = C4::Members::GetUpcomingMembershipExpires();
120
$upcoming_mem_expires = C4::Members::GetUpcomingMembershipExpires();
117
is(scalar(@$upcoming_mem_expires), 0, 'Get upcoming membership expires without MembershipExpiryDaysNotice should return 0.');
121
is(scalar(@$upcoming_mem_expires), 0, 'Get upcoming membership expires without MembershipExpiryDaysNotice should return 0.');
122
123
$schema->storage->txn_rollback;
124
125
1;
(-)a/t/db_dependent/Reserves/GetReserveFee.t (-3 / +10 lines)
Lines 20-31 Link Here
20
# along with Koha; if not, see <http://www.gnu.org/licenses>.
20
# along with Koha; if not, see <http://www.gnu.org/licenses>.
21
21
22
use Modern::Perl;
22
use Modern::Perl;
23
23
use Test::More tests => 5;
24
use Test::More tests => 5;
24
use Test::MockModule;
25
use Test::MockModule;
26
use t::lib::TestBuilder;
25
27
26
use C4::Circulation;
28
use C4::Circulation;
27
use C4::Reserves qw|AddReserve|;
29
use C4::Reserves qw|AddReserve|;
28
use t::lib::TestBuilder;
30
use Koha::Database;
31
32
my $schema = Koha::Database->new->schema;
33
$schema->storage->txn_begin;
29
34
30
my $mContext = new Test::MockModule('C4::Context');
35
my $mContext = new Test::MockModule('C4::Context');
31
$mContext->mock( 'userenv', sub {
36
$mContext->mock( 'userenv', sub {
Lines 104-110 $fee = C4::Reserves::GetReserveFee( $patron2->{borrowernumber}, $biblio->{biblio Link Here
104
is( $fee > 0, 1, 'Patron 2 should be charged again this time' );
109
is( $fee > 0, 1, 'Patron 2 should be charged again this time' );
105
# End of tests
110
# End of tests
106
111
107
108
sub acctlines { #calculate number of accountlines for a patron
112
sub acctlines { #calculate number of accountlines for a patron
109
    my @temp = $dbh->selectrow_array( "SELECT COUNT(*) FROM accountlines WHERE borrowernumber=?", undef, ( $_[0] ) );
113
    my @temp = $dbh->selectrow_array( "SELECT COUNT(*) FROM accountlines WHERE borrowernumber=?", undef, ( $_[0] ) );
110
    return $temp[0];
114
    return $temp[0];
Lines 125-127 sub addreserve { Link Here
125
        ''
129
        ''
126
    );
130
    );
127
}
131
}
128
- 
132
133
$schema->storage->txn_rollback;
134
135
1;

Return to bug 15081