Re: [CDBI] Mocking CDBI classes
[prev]
[thread]
[next]
[Date index for 2005/09/27]
On 9/27/05, William Ross <will@xxxxxxx.xxx> wrote:
> I like the question, though. I hate building sqlite databases just to
> run tests, with all the nasty MakeFile hacking that inevitably
> follows. Ideally I'd like there to be a standard cdbi test database
> included in the distribution and available to everyone. Then we could
> all use that.
Hmm, Devel::Maypole does that. It installs a simple set of sql files
and whips up a SQLite db in a temp file and gives you back a
connection string. You can ignore the Maypole bits.
In a test script:
use Devel::Maypole qw/ :test :find /;
# build a db from Devel::Maypole's 'default' resource kit
my $ddl =3D find_ddl( 'Devel::Maypole', 'default' );
my $data =3D find_data( 'Devel::Maypole', 'default' );
my $dsn =3D database( ddl =3D> "$ddl/beerdb.simple.sql",
data =3D> "$data/beerdb.simple.sql",
);
I'm planning to package more SQL kits Real Soon Now. You can also use
it to install and load your own resource kits.
Installation is a PITA if you are missing any dependencies - it tries
to use itself to install the SQL files :-( So you'd need to install
the deps first, the cpan shell won't do it. A Better Way is in the
pipeline.
d.
_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi