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

(-)a/t/Koha.t (-3 / +29 lines)
Lines 25-31 use Module::Load::Conditional qw/check_install/; Link Here
25
25
26
BEGIN {
26
BEGIN {
27
    if ( check_install( module => 'Test::DBIx::Class' ) ) {
27
    if ( check_install( module => 'Test::DBIx::Class' ) ) {
28
        plan tests => 31;
28
        plan tests => 32;
29
    } else {
29
    } else {
30
        plan skip_all => "Need Test::DBIx::Class"
30
        plan skip_all => "Need Test::DBIx::Class"
31
    }
31
    }
Lines 138-141 subtest 'getFacets() tests' => sub { Link Here
138
    );
138
    );
139
};
139
};
140
140
141
1;
141
subtest 'GetKohaAuthorisedValues() tests' => sub {
142
    plan tests => 6;
143
    my $values;
144
    is( C4::Koha::GetKohaAuthorisedValues('','','',''), undef, 'Test GetKohaAuthorisedValues with empty parameters values');
145
146
    my $dbh = C4::Context->dbh;
147
    my $sth = $dbh->prepare("INSERT INTO authorised_values (category,authorised_value,lib,lib_opac) VALUES (?, ?, ?, ?)");
148
    my $sth1 = $dbh->prepare("INSERT INTO marc_subfield_structure VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
149
150
    $sth->execute('TESTMODE','TestDebit','TestDebitstaff','TestDebitopac');
151
    $sth->execute('TESTMODE','TestCC','TestCCstaff','TestCCopac');
152
    $sth->execute('TESTFIELD','TestCC','TestCCstaff','TestCCopac');
153
    $sth1->execute(999,'z','Test','Test',0,0,'TestFieldKoha',10,'TESTMODE','','',0,0,'','','','',9999);
154
155
    $values = C4::Koha::GetKohaAuthorisedValues('TestFieldKoha');
156
    ok($values->{TestCC} eq 'TestCCstaff','GetKohaAuthorisedValues return the correct value when put kohafield parameter and empty for other parameters');
157
158
    is (C4::Koha::GetKohaAuthorisedValues('TestFieldNotExist'), undef ,'GetKohaAuthorisedValues return undef when kohafield not exist');
159
160
    $values = C4::Koha::GetKohaAuthorisedValues('','','','TESTMODE');
161
    ok(keys %$values eq 2,'GetKohaAuthorisedValues return the correct number of result');
162
    ok($values->{TestCC} eq 'TestCCstaff','GetKohaAuthorisedValues return a correct value when put category parameter and empty for other parameters');
163
164
    $values = C4::Koha::GetKohaAuthorisedValues('','',1,'TESTMODE');
165
    ok($values->{TestDebit} eq 'TestDebitopac','GetKohaAuthorisedValues return a correct value when put category,opac parameter  and empty for other parameters');
166
};
167
168
-1;
142
- 

Return to bug 5620