Tyler MacDonald wrote:
Tyler MacDonald <[EMAIL PROTECTED]> wrote:
After digging around a bit, it looks like I just have to attach
myself to the "stop-httpd" option instead of the "stop" method, but that's
getting less obvious and more deep into an undocumented API.
Got it in a hackety-hacked way; this does what I want.
Actually that sounds as the right solution, since may times we do:
t/TEST -start
t/TEST -run
...
t/TEST -run
t/TEST -stop
so you don't want to re-do your db setup on every run.
I agree that it'd be nice to make it easier to override the server class,
feel free to submit a patch that will do it nicely (I can see it as a
method that will be called from configure if defined).
------------------------------------------------------------------------
#!perl
use strict;
use warnings FATAL => 'all';
use lib qw(lib);
use base q(Apache::TestRunPerl);
use Apache::TestConfig ();
main::->new->run(@ARGV);
sub pre_configure {
my $self = shift;
# mod_bt doesn't like to be loaded if it isn't configured.
Apache::TestConfig::autoconfig_skip_module_add('mod_bt.c')
}
sub configure {
my $self = shift;
bless $self->{server}, "Apache2::AUS::TestServer";
return $self->SUPER::configure(@_);
}
package Apache2::AUS::TestServer;
use base q(Apache::TestServer);
use lib 't/tlib';
use t::dbh;
use DBIx::Migration::Directories;
sub start {
my $self = shift;
warn "installing database schema!";
if(my $dbh = dbh) {
my $mh = DBIx::Migration::Directories->new(
schema => "Schema::RDBMS::AUS",
dbh => $dbh,
);
$mh->full_migrate;
$dbh->disconnect;
}
return $self->SUPER::start(@_);
}
sub stop {
my $self = shift;
my $rv;
if($rv = $self->SUPER::stop(@_)) {
warn "removing database schema!";
if(my $dbh = dbh) {
my $mh = DBIx::Migration::Directories->new(
schema => "Schema::RDBMS::AUS",
dbh => $dbh,
);
$mh->full_delete_schema;
$dbh->disconnect;
}
}
return $rv;
}
--
_____________________________________________________________
Stas Bekman mailto:[EMAIL PROTECTED] http://stason.org/
MailChannels: Assured Messaging(TM) http://mailchannels.com/
The "Practical mod_perl" book http://modperlbook.org/
http://perl.apache.org/ http://perl.org/ http://logilune.com/