[Rt-commit] r8309 - rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT
ruz at bestpractical.com
ruz at bestpractical.com
Mon Jul 30 10:51:20 EDT 2007
Author: ruz
Date: Mon Jul 30 10:51:18 2007
New Revision: 8309
Modified:
rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Test.pm
Log:
* split bootstrapping from the import into a new sub
Modified: rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Test.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Test.pm (original)
+++ rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Test.pm Mon Jul 30 10:51:18 2007
@@ -13,7 +13,7 @@
BEGIN {
# TODO: allocate a port dynamically
- if (my $test_server = $ENV{RT_TEST_SERVER}) {
+ if ( my $test_server = $ENV{'RT_TEST_SERVER'} ) {
my ($host, $test_port) = split(':', $test_server, 2);
$port = $test_port || 80;
$existing_server = "http://$host:$port";
@@ -32,6 +32,7 @@
};
close $config;
$ENV{RT_SITE_CONFIG} = $config->filename;
+
use RT;
RT::LoadConfig;
if (RT->Config->Get('DevelMode')) { require Module::Refresh; }
@@ -44,8 +45,6 @@
return 1;
};
RT::Config->Set( 'MailCommand' => $mailfunc);
-
-
};
use RT::Interface::Web::Standalone;
@@ -58,13 +57,20 @@
sub import {
my $class = shift;
+ my %args = @_;
require RT::Handle;
- if ($existing_server) {
- RT->Init;
- return;
+ unless ( $existing_server ) {
+ $class->bootstrap_db( %args );
}
+ RT->Init;
+}
+
+sub bootstrap_db {
+ my $self = shift;
+ my %args = @_;
+
# bootstrap with dba cred
my $dbh = _get_dbh(RT::Handle->SystemDSN,
$ENV{RT_DBA_USER}, $ENV{RT_DBA_PASSWORD});
@@ -97,11 +103,10 @@
$RT::Handle->PrintError;
$RT::Handle->dbh->{PrintError} = 1;
- unless ( ($_[0] || '') eq 'nodata' ) {
+ unless ( $args{'nodata'} ) {
$RT::Handle->InsertData( $RT::EtcPath . "/initialdata" );
}
DBIx::SearchBuilder::Record::Cachable->FlushCache;
- RT->Init;
}
sub started_ok {
More information about the Rt-commit
mailing list