| Test-DBUnit documentation | view source | Contained in the Test-DBUnit distribution. |
Test::DBUnit::Generator - dbunit dataset generator
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,
);
This class generates xml or perl test datasets based on passed in sql. Additionally it can generate schema validator code.
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',
},
);
Returns xml content that contains dataset
Generated dataset as perl code
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,
Returns dataset structure
| Test-DBUnit documentation | view source | Contained in the Test-DBUnit distribution. |