App-CPRReporter
view release on metacpan or search on metacpan
t/01-basic.t view on Meta::CPAN
BEGIN { use_ok 'Test::Exception'; }
BEGIN { use_ok 'Test::Warn'; }
require Test::Exception;
require Test::Warn;
# Check we get an error message on missing input parameters
my $reporter;
can_ok ('App::CPRReporter', qw(employees certificates run));
throws_ok { $reporter = App::CPRReporter->new() } qr/Attribute .+ is required/, "Checking missing parameters";
throws_ok { $reporter = App::CPRReporter->new(employees => 't/stim/missing_file.xlsx', certificates => 't/stim/missing_file.xml', course => 't/stim/missing_file.xlsx') } qr/File does not exist.+/, "Checking missing xml file";
# Check we get the expected carps when we create the app on the stimulus test data
#warnings_like { $reporter = App::CPRReporter->new(employees => 't/stim/employees.xlsx', certificates => 't/stim/certificates.xml', course => 't/stim/course.xlsx') }
# { carped => qr/Oops: employee 'MAJOR LAZER' not found/},
# "On test data we should carp some warnings";
$reporter = App::CPRReporter->new(employees => 't/stim/employees.xlsx', certificates => 't/stim/certificates.xml', course => 't/stim/course.xlsx');
is $reporter->{_not_in_hr}->{theory}->[0], 'MAJOR LAZER', "Found course of person not in employee database";
ok $reporter, 'object created';
( run in 0.247 second using v1.01-cache-2.11-cpan-496ff517765 )