I have a maypole application that has a Config class, which specifies
the dsn/user/pass like so:

Config.pm:
MyApp->config->{dsn} = "dbi:mysql:bla";
MyApp->config->{user} = "user";
MyApp->config->{pass} = "pass";

The dbi connect call happens in MyApp::DBI.pm:

package MyApp::DBI;
use base qw(Class::DBI::mysql);
MyApp::DBI->connection(MyApp->config->{dsn},
                            MyApp->config->{user},
                            MyApp->config->{pass});
MyApp::DBI->autoupdate(1);

I want to test MyApp against a dummy database - i.e. using a different
dbi connection in my tests.

Since my package that uses Maypole::Application then pulls in my
Config class, and then calls setup.

package MyApp;
use URI;
use Maypole::Application qw(-Debug Authentication::UserSessionCookie);
use MyApp::Config;
use MyApp::DBI;
use MyApp::User;
...

MyApp->config->model("Maypole::Model::CDBI::Plain");
MyApp->setup([qw/MyApp::User...

I can't find out how I can set the dsn to be different in my test class.

Is there any modular way from a test to reset the database connection
to my test database/user?  How could I structure it so the
dsn/user/pass info was able to be changed?

Thanks,
johnk

-- 
Check out my AdWords and Overture blog:
http://gotads.blogspot.com


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Maypole-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/maypole-users

Reply via email to