Title:
Development Policy
Stefan Hornburg (Racke)
Development Policy
Tests
Warnings
Always use Test::Warnings to capture unexpected warnings in your tests.
use Test::Warnings;
Counting tests
use Test::More; plan tests => 68;
Adjusting the test count every time you are adding tests is an unnecessary hassle, so just use done_testing at the end of your test script:
done_testing;
DateTime
Dates in filenames
Dates in filenames like reports/2020-03-08.csv
should be in local time to avoid confusion.
my $tz = DateTime::TimeZone->new( name => 'local' ); my $now = DateTime->now; $now->set_time_zone($tz);
DBIx::Class
Don't die
Use throw_exception instead:
$self->throw_exception("This is not a pending cia transaction") unless $self->is_pending_and_cia;