bug 1953 [1/2]: fixing SQL injection problem in C4::Context->preference
[koha.git] / t / lib / KohaTest / Context / preference.pm
1 package KohaTest::Context::preference;
2 use base qw( KohaTest::Context );
3
4 use strict;
5 use warnings;
6
7 use Test::More;
8
9 use C4::Context;
10 sub testing_class { 'C4::Context' };
11
12
13 =head2 STARTUP METHODS
14
15 These get run once, before the main test methods in this module
16
17 =cut
18
19 =head2 TEST METHODS
20
21 standard test methods
22
23 =head3 preference_does_not_exist
24
25 =cut
26
27 sub preference_does_not_exist : Test( 1 ) {
28     my $self = shift;
29
30     my $missing = C4::Context->preference( 'doesnotexist' );
31
32     is( $missing, undef, 'a query for a missing syspref returns undef' )
33       or diag( Data::Dumper->Dump( [ $missing ], [ 'missing' ] ) );
34     
35 }
36
37
38 =head3 version_preference
39
40 =cut
41
42 sub version_preference : Test( 1 ) {
43     my $self = shift;
44
45     my $version = C4::Context->preference( 'version' );
46
47     ok( $version, 'C4::Context->preference returns a good version number' )
48       or diag( Data::Dumper->Dump( [ $version ], [ 'version' ] ) );
49     
50 }
51
52
53
54 1;