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_dataset;
print $generator->dataset;
pritn $generator->schema_validator(
has_table => 1,
has_columns => 1,
has_pk => 1,
has_fk => 1,
has_index => 1,
);
DESCRIPTION
This class generates xml or perl test datasets based on passed in sql. Additionally it can generate schema validator code.
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_dataset
-
Returns xml content that contains dataset
- dataset
-
Generated dataset as perl code
- _inscrease_tests_no
- schema_validator
-
Generates schema validation code. Takes the following options as paramters:
has_table => 1, has_columns => 1, has_pk => 1, has_fk => 1, has_index => 1,
- _has_table
- _dataset_order
- _has_columns
- _has_pk
- _has_fk
- _has_index
- _select_dataset
-
Returns dataset structure