NAME

Test::DBUnit::Generator - dbunit dataset generator

SYNOPSIS

use Test::DBUnit::Generator;

my $connection = DBIx::Connection->new(
    name     => 'test',
    dsn      => $ENV{DB_TEST_CONNECTION},
    username => $ENV{DB_TEST_USERNAME},
    password => $ENV{DB_TEST_PASSWORD},
);

my $generator = Test::DBUnit::Generator->new(
    connection      => $connection,
    datasets => {
        emp => 'SELECT * FROM emp',
        dept => 'SELECT * FROM demp',
    },
);

print $generator->xml;
print $generator->perl;

DESCRIPTION

This class generates xml or perl test datasets based on passed in sql

ATTRIBUTES

connection
datasets_order

Specifies order of the dataset in the generation result.

my $generator = Test::DBUnit::Generator->new(
    connection      => $connection,
    datasets_order   => ['emp', 'dept'],
    datasets => {
        emp => 'SELECT * FROM emp',
        dept => 'SELECT * FROM demp',
    },
);
datasets

METHODS

xml

Returns xml content that contains dataset

perl
select_dataset

Returns dataset structure