7 use Scalar::Util; # load before we break require()
9 use_ok 'DBIx::Class::Optional::Dependencies';
11 my $sqlt_dep = DBIx::Class::Optional::Dependencies->req_list_for ('deploy');
14 [ 'SQL::Translator' ],
15 'Correct deploy() dependency list',
18 # make module loading impossible, regardless of actual libpath contents
19 @INC = (sub { die('Optional Dep Test') } );
22 ! DBIx::Class::Optional::Dependencies->req_ok_for ('deploy'),
23 'deploy() deps missing',
27 DBIx::Class::Optional::Dependencies->req_missing_for ('deploy'),
28 qr/^SQL::Translator \>\= \d/,
29 'expected missing string contents',
33 DBIx::Class::Optional::Dependencies->req_errorlist_for ('deploy')->{'SQL::Translator'},
34 qr/Optional Dep Test/,
35 'custom exception found in errorlist',
39 #make it so module appears loaded
40 $INC{'SQL/Translator.pm'} = 1;
41 $SQL::Translator::VERSION = 999;
44 ! DBIx::Class::Optional::Dependencies->req_ok_for ('deploy'),
45 'deploy() deps missing cached properly',
49 %DBIx::Class::Optional::Dependencies::req_availability_cache = ();
53 DBIx::Class::Optional::Dependencies->req_ok_for ('deploy'),
54 'deploy() deps present',
58 DBIx::Class::Optional::Dependencies->req_missing_for ('deploy'),
60 'expected null missing string',
64 DBIx::Class::Optional::Dependencies->req_errorlist_for ('deploy'),
66 'expected empty errorlist',