Commit | Line | Data |
83542a7d |
1 | #!perl -T |
2 | |
3 | # the above line forces Test::Harness into taint-mode |
4 | |
5 | use strict; |
6 | use warnings; |
7 | |
91b0ad0b |
8 | use Test::More; |
83542a7d |
9 | |
10 | BEGIN { |
11 | eval "require Module::Find;"; |
91b0ad0b |
12 | if ($@) { |
13 | plan skip_all => 'Could not load Module::Find'; |
14 | exit; |
15 | } |
16 | else { |
17 | plan tests => 7; |
18 | } |
83542a7d |
19 | } |
20 | |
91b0ad0b |
21 | package DBICTest::Taint::Classes; |
83542a7d |
22 | |
91b0ad0b |
23 | use Test::More; |
24 | use Test::Exception; |
83542a7d |
25 | |
26 | use lib qw(t/lib); |
91b0ad0b |
27 | use base qw/DBIx::Class::Schema/; |
28 | |
29 | lives_ok (sub { |
30 | __PACKAGE__->load_classes(qw/Manual/); |
31 | ok( __PACKAGE__->source('Manual'), 'The Classes::Manual source has been registered' ); |
32 | __PACKAGE__->_unregister_source (qw/Manual/); |
33 | }, 'Loading classes with explicit load_classes worked in taint mode' ); |
34 | |
35 | lives_ok (sub { |
36 | __PACKAGE__->load_classes(); |
37 | ok( __PACKAGE__->source('Auto'), 'The Classes::Auto source has been registered' ); |
38 | ok( __PACKAGE__->source('Auto'), 'The Classes::Manual source has been re-registered' ); |
39 | }, 'Loading classes with Module::Find/load_classes worked in taint mode' ); |
40 | |
83542a7d |
41 | |
91b0ad0b |
42 | package DBICTest::Taint::Namespaces; |
83542a7d |
43 | |
91b0ad0b |
44 | use Test::More; |
45 | use Test::Exception; |
46 | |
47 | use lib qw(t/lib); |
83542a7d |
48 | use base qw/DBIx::Class::Schema/; |
49 | |
91b0ad0b |
50 | lives_ok (sub { |
51 | __PACKAGE__->load_namespaces(); |
52 | ok( __PACKAGE__->source('Test'), 'The Namespaces::Test source has been registered' ); |
53 | }, 'Loading classes with Module::Find/load_namespaces worked in taint mode' ); |
54 | |
83542a7d |
55 | |
56 | 1; |