Commit 8bc9891b authored by Ruslan Zakirov's avatar Ruslan Zakirov
Browse files

switch tests over RT::Test

parent 6a435e12
use strict;
use warnings;
### after: use lib qw(@RT_LIB_PATH@);
use lib qw(/opt/rt3/local/lib /opt/rt3/lib);
package RT::Extension::SLA::Test;
our @ISA;
BEGIN {
local $@;
eval { require RT::Test; 1 } or do {
require Test::More;
Test::More::BAIL_OUT(
"requires 3.8 to run tests. Error:\n$@\n"
."You may need to set PERL5LIB=/path/to/rt/lib"
);
};
push @ISA, 'RT::Test';
}
sub import {
my $class = shift;
my %args = @_;
$args{'requires'} ||= [];
if ( $args{'testing'} ) {
unshift @{ $args{'requires'} }, 'RT::Extension::SLA';
} else {
$args{'testing'} = 'RT::Extension::SLA';
}
$class->SUPER::import( %args );
$class->export_to_level(1);
require RT::Extension::SLA;
}
1;
\ No newline at end of file
......@@ -3,9 +3,8 @@
use strict;
use warnings;
use Test::More tests => 1;
use RT::Extension::SLA::Test tests => 4, nodb => 1;
use_ok 'RT::Extension::SLA';
1;
......@@ -3,25 +3,12 @@
use strict;
use warnings;
use Test::MockTime qw( :all );
use RT::Extension::SLA::Test tests => 9;
use Test::More tests => 9;
require 't/utils.pl';
use_ok 'RT';
RT::LoadConfig();
$RT::LogToScreen = $ENV{'TEST_VERBOSE'} ? 'debug': 'warning';
# XXX, TODO
# we assume the RT's Timezone is UTC now, need a smart way to get over that.
$ENV{'TZ'} = $RT::Timezone = 'GMT';
RT::Init();
use_ok 'RT::Ticket';
use_ok 'RT::Extension::SLA';
use Test::MockTime qw( :all );
$ENV{'TZ'} = 'GMT';
RT->Config->Set( Timezone => 'GMT' );
diag 'check business hours';
{
......
......@@ -3,17 +3,7 @@
use strict;
use warnings;
use Test::More tests => 72;
require 't/utils.pl';
use_ok 'RT';
RT::LoadConfig();
$RT::LogToScreen = $ENV{'TEST_VERBOSE'} ? 'debug': 'warning';
RT::Init();
use_ok 'RT::Ticket';
use_ok 'RT::Extension::SLA';
use RT::Extension::SLA::Test tests => 72;
diag 'check change of Due date when SLA for a ticket is changed';
{
......
......@@ -3,20 +3,8 @@
use strict;
use warnings;
use Test::More tests => 9;
require 't/utils.pl';
use_ok 'RT';
RT::LoadConfig();
$RT::LogToScreen = $ENV{'TEST_VERBOSE'} ? 'debug': 'warning';
RT::Init();
use_ok 'RT::Ticket';
use_ok 'RT::Extension::SLA';
use Test::MockTime qw( :all );
use RT::Extension::SLA::Test tests => 9;
my $queue = RT::Queue->new($RT::SystemUser);
$queue->Load('General');
......
......@@ -3,25 +3,12 @@
use strict;
use warnings;
use Test::More tests => 12;
require 't/utils.pl';
use_ok 'RT';
RT::LoadConfig();
$RT::LogToScreen = $ENV{'TEST_VERBOSE'} ? 'debug': 'warning';
use Test::MockTime qw( :all );
use RT::Extension::SLA::Test tests => 12;
# XXX, TODO
# we assume the RT's Timezone is UTC now, need a smart way to get over that.
$ENV{'TZ'} = $RT::Timezone = 'GMT';
RT::Init();
use_ok 'RT::Ticket';
use_ok 'RT::Extension::SLA';
use Test::MockTime qw( :all );
$ENV{'TZ'} = 'GMT';
RT->Config->Set( Timezone => 'GMT' );
my $bhours = RT::Extension::SLA->BusinessHours;
......
#!/usr/bin/perl
use strict;
use warnings;
BEGIN {
### after: push @INC, qw(@RT_LIB_PATH@);
push @INC, qw(/opt/rt3/local/lib /opt/rt3/lib);
}
1;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment