Lines 17-23
Link Here
|
17 |
# with Koha; if not, see <http://www.gnu.org/licenses>. |
17 |
# with Koha; if not, see <http://www.gnu.org/licenses>. |
18 |
|
18 |
|
19 |
use Modern::Perl; |
19 |
use Modern::Perl; |
|
|
20 |
|
20 |
use Test::More tests => 117; |
21 |
use Test::More tests => 117; |
|
|
22 |
use t::lib::TestBuilder; |
23 |
|
24 |
use Koha::Database; |
21 |
use Time::Piece; |
25 |
use Time::Piece; |
22 |
|
26 |
|
23 |
BEGIN { |
27 |
BEGIN { |
Lines 41-56
can_ok(
Link Here
|
41 |
deletereview ) |
45 |
deletereview ) |
42 |
); |
46 |
); |
43 |
|
47 |
|
44 |
my $dbh = C4::Context->dbh; |
48 |
my $schema = Koha::Database->new->schema; |
45 |
$dbh->{AutoCommit} = 0; |
49 |
$schema->storage->txn_begin; |
46 |
$dbh->{RaiseError} = 1; |
50 |
our $dbh = C4::Context->dbh; |
|
|
51 |
|
47 |
$dbh->do('DELETE FROM reviews'); |
52 |
$dbh->do('DELETE FROM reviews'); |
48 |
$dbh->do('DELETE FROM issues'); |
53 |
$dbh->do('DELETE FROM issues'); |
49 |
$dbh->do('DELETE FROM borrowers'); |
54 |
$dbh->do('DELETE FROM borrowers'); |
50 |
|
55 |
|
|
|
56 |
my $builder = t::lib::TestBuilder->new; |
57 |
|
51 |
# ---------- Some borrowers for testing ------------------- |
58 |
# ---------- Some borrowers for testing ------------------- |
52 |
my $categorycode = Koha::Database->new()->schema()->resultset('Category')->first()->categorycode(); |
59 |
my $categorycode = $builder->build({ source => 'Category' })->{ categorycode }; |
53 |
my $branchcode = Koha::Database->new()->schema()->resultset('Branch')->first()->branchcode(); |
60 |
my $branchcode = $builder->build({ source => 'Branch' })->{ branchcode }; |
54 |
|
61 |
|
55 |
my $b1 = Koha::Borrower->new( |
62 |
my $b1 = Koha::Borrower->new( |
56 |
{ surname => 'Borrower 1', |
63 |
{ surname => 'Borrower 1', |
Lines 383-386
ok( !defined($review3), 'Review3 is no longer defined' );
Link Here
|
383 |
$numberOfReviews = numberofreviews($status0) + numberofreviews($status1); |
390 |
$numberOfReviews = numberofreviews($status0) + numberofreviews($status1); |
384 |
is( $numberOfReviews, 0, 'There is no review left in database' ); |
391 |
is( $numberOfReviews, 0, 'There is no review left in database' ); |
385 |
|
392 |
|
386 |
$dbh->rollback; |
393 |
$schema->storage->txn_rollback; |
|
|
394 |
|
395 |
1; |
387 |
- |
|
|