Skip to content

Commit

Permalink
Issue #549: convert TimeStamp2SystemTime.t to Test2::V0
Browse files Browse the repository at this point in the history
  • Loading branch information
bschmalhofer committed Oct 15, 2020
1 parent 8b1401b commit ab61855
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions scripts/test/DateTime/TimeStamp2SystemTime.t
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,10 @@ use utf8;
# core modules

# CPAN modules
use Test2::V0;

# OTOBO modules

# Set up the test driver $Self when we are running as a standalone script.
use Kernel::System::UnitTest::RegisterDriver;

use vars (qw($Self));
use Kernel::System::ObjectManager;

# TimeStamp2SystemTime tests
# See the command: date -d"2005-10-20T10:00:00Z" +%s
Expand Down Expand Up @@ -84,27 +81,23 @@ my @TimeStamp2SystemTimeTests = (
},
);

$Self->Plan( Tests => scalar @TimeStamp2SystemTimeTests + 1 );
plan( scalar @TimeStamp2SystemTimeTests + 1 );

# with specific time zone
$Kernel::OM = Kernel::System::ObjectManager->new();

my $DateTimeObject = $Kernel::OM->Create(
'Kernel::System::DateTime',
ObjectParams => {
TimeZone => 'Europe/Belgrade',
}
);

$Self->Is(
ref $DateTimeObject,
'Kernel::System::DateTime',
'Creation of DateTime object must succeed.'
);
isa_ok( $DateTimeObject, [ 'Kernel::System::DateTime' ], 'creation of DateTime object.' );

for my $Test (@TimeStamp2SystemTimeTests) {
my $SystemTime = $DateTimeObject->TimeStamp2SystemTime( String => $Test->{String} );
my $Description = 'TimeStamp2SystemTime(): ' . ( $Test->{Description} // 'system time matches' );

$Self->Is( $SystemTime, $Test->{ExpectedResult}, $Description );
is( $SystemTime, $Test->{ExpectedResult}, $Description );
}


0 comments on commit ab61855

Please sign in to comment.