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

(-)a/t/db_dependent/AuthorisedValues.t (-2 / +38 lines)
Lines 1-7 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
2
3
use Modern::Perl;
3
use Modern::Perl;
4
use Test::More tests => 15;
4
use Test::More tests => 16;
5
5
6
use C4::Context;
6
use C4::Context;
7
use Koha::AuthorisedValue;
7
use Koha::AuthorisedValue;
Lines 225-227 subtest 'search_by_*_field + find_by_koha_field + get_description' => sub { Link Here
225
        );
225
        );
226
    };
226
    };
227
};
227
};
228
- 
228
  sub GetAuthValues {
229
       require Test::More; 
230
       my $dbh = C4::Context->dbh;
231
       my ($self, $authcat) = @_;
232
       my $query = qq{ SELECT * FROM authorised_values WHERE category=? order by lib };
233
       my $sth   = $dbh->prepare($query);
234
       $sth->execute($authcat);
235
       my $AuthValue = 0;
236
       if ($sth->rows > 0) {
237
           $AuthValue = 1;
238
       }
239
       return $AuthValue;
240
   };
241
   my $AuthValues = GetAuthValues('av_for_testing');
242
   is ( $AuthValues,0, 'Does not exist in the database: Test successful');
243
244
    sub GetDistinctCat {
245
        require Test::More;
246
        my $dbh = C4::Context->dbh;
247
        my ($self, $dbh) = @_;
248
        my $sth = $dbh->prepare("select distinct category from authorised_values where category like 'A%' ");
249
        $sth->execute;
250
        return $sth;
251
        my $DistAuth = 0;
252
        if ($sth->rows > 0){
253
            $DistAuth = 1;
254
        }
255
        return $DistAuth;
256
    };
257
    my $DistAuth = GetDistinctCat();
258
    is ( $DistAuth, 0, 'Does not exist in the database successful');
259
260
261
262
263
264

Return to bug 18212