sergiotarxz
898b1af4a6
release-dao integration test, fixing broken docs, fixing broken test at t/00008-application-dao.t
58 lines
1.4 KiB
Perl
58 lines
1.4 KiB
Perl
#!/usr/bin/env perl
|
|
|
|
use v5.30.0;
|
|
|
|
use strict;
|
|
use warnings;
|
|
|
|
use Data::Dumper;
|
|
|
|
use Test::Most tests => 2;
|
|
|
|
use DateTime;
|
|
|
|
use Peace;
|
|
use Peace::DB;
|
|
use Peace::DAO::Developer;
|
|
use Peace::DAO::Application;
|
|
use Peace::DAO::Release;
|
|
|
|
use Peace::Test::Mock::Model::Developer;
|
|
use Peace::Test::Mock::Model::Application;
|
|
use Peace::Test::Mock::Model::Release;
|
|
|
|
{
|
|
## GIVEN
|
|
my $current_date = DateTime->now;
|
|
my $peace = Peace->new;
|
|
my $home = $ENV{HOME};
|
|
my $config =
|
|
$peace->plugin(
|
|
JSONConfig => { file => "$home/.config/peace/peace.conf" } );
|
|
my $dbh = Peace::DB->dbh( config => $config );
|
|
|
|
my $developer = Peace::Test::Mock::Model::Developer->new;
|
|
my $developer_dao = Peace::DAO::Developer->new( dbh => $dbh );
|
|
|
|
$developer_dao->create( developer => $developer );
|
|
|
|
my $application = Peace::Test::Mock::Model::Application->new;
|
|
$application->developer($developer);
|
|
|
|
my $application_dao = Peace::DAO::Application->new( dbh => $dbh );
|
|
|
|
$application_dao->create( application => $application );
|
|
|
|
my $release = Peace::Test::Mock::Model::Release->new;
|
|
$release->application($application);
|
|
|
|
my $release_dao = Peace::DAO::Release->new( dbh => $dbh );
|
|
|
|
## WHEN
|
|
$release_dao->create( release => $release );
|
|
|
|
## THEN
|
|
ok $release->uuid, 'Generated uuid.';
|
|
ok $release->date_creation > $current_date, 'The date is recent.';
|
|
}
|