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

(-)a/t/db_dependent/Koha.t (-8 / +15 lines)
Lines 7-13 use strict; Link Here
7
use warnings;
7
use warnings;
8
use C4::Context;
8
use C4::Context;
9
9
10
use Test::More tests => 3;
10
use Test::More tests => 4;
11
11
12
BEGIN {
12
BEGIN {
13
    use_ok('C4::Koha');
13
    use_ok('C4::Koha');
Lines 26-39 my $dbh = C4::Context->dbh; Link Here
26
# Insert an entry into authorised_value table
26
# Insert an entry into authorised_value table
27
my $query = "INSERT INTO authorised_values (category, authorised_value, lib, lib_opac, imageurl) VALUES (?,?,?,?,?);";
27
my $query = "INSERT INTO authorised_values (category, authorised_value, lib, lib_opac, imageurl) VALUES (?,?,?,?,?);";
28
my $sth = $dbh->prepare($query);
28
my $sth = $dbh->prepare($query);
29
$sth->execute($data->{category}, $data->{authorised_value}, $data->{lib}, $data->{lib_opac}, $data->{imageurl});
29
my $insert_success = $sth->execute($data->{category}, $data->{authorised_value}, $data->{lib}, $data->{lib_opac}, $data->{imageurl});
30
ok($insert_success, "Insert data in database");
31
30
32
31
# Tests
33
# Tests
32
is ( GetAuthorisedValueByCode($data->{category}, $data->{authorised_value}), $data->{lib}, "GetAuthorisedValueByCode" );
34
SKIP: {
33
is ( GetKohaImageurlFromAuthorisedValues($data->{category}, $data->{lib}), $data->{imageurl}, "GetKohaImageurlFromAuthorisedValues" );
35
    skip "INSERT failed", 2 unless $insert_success;
36
    
37
    is ( GetAuthorisedValueByCode($data->{category}, $data->{authorised_value}), $data->{lib}, "GetAuthorisedValueByCode" );
38
    is ( GetKohaImageurlFromAuthorisedValues($data->{category}, $data->{lib}), $data->{imageurl}, "GetKohaImageurlFromAuthorisedValues" );
39
}
34
40
35
# Clean up
41
# Clean up
36
$query = "DELETE FROM authorised_values WHERE category=? AND authorised_value=? AND lib=? AND lib_opac=? AND imageurl=?;";
42
if($insert_success){
37
$sth = $dbh->prepare($query);
43
    $query = "DELETE FROM authorised_values WHERE category=? AND authorised_value=? AND lib=? AND lib_opac=? AND imageurl=?;";
38
$sth->execute($data->{category}, $data->{authorised_value}, $data->{lib}, $data->{lib_opac}, $data->{imageurl});
44
    $sth = $dbh->prepare($query);
45
    $sth->execute($data->{category}, $data->{authorised_value}, $data->{lib}, $data->{lib_opac}, $data->{imageurl});
46
}
39
47
40
- 

Return to bug 5880