10 eval "use DBD::SQLite";
12 ? ( skip_all => 'needs DBD::SQLite for testing' )
16 my $schema = DBICTest->init_schema(no_populate => 1);
18 ok($schema, 'Created a Schema');
19 isa_ok($schema->_journal_schema, 'DBIx::Class::Schema::Journal::DB', 'Actually have a schema object for the journaling');
20 isa_ok($schema->_journal_schema->source('CDAuditHistory'), 'DBIx::Class::ResultSource', 'CDAuditHistory source exists');
21 isa_ok($schema->_journal_schema->source('ArtistAuditLog'), 'DBIx::Class::ResultSource', 'ArtistAuditLog source exists');
24 my $new_cd = $schema->txn_do( sub {
25 $artist = $schema->resultset('Artist')->create({
26 name => 'Fred Bloggs',
28 return $schema->resultset('CD')->create({
29 title => 'Angry young man',
34 isa_ok($new_cd, 'DBIx::Class::Journal', 'Created CD object');
36 my $search = $schema->_journal_schema->resultset('CDAuditLog')->search();
37 ok($search->count, 'Created an entry in the CD audit log');
39 $schema->txn_do( sub {
44 is($new_cd->year, 2003, 'Changed year to 2003');
45 my $cdah = $schema->_journal_schema->resultset('CDAuditHistory')->search();
46 ok($cdah->count, 'Created an entry in the CD audit history');
48 $schema->txn_do( sub {
49 $schema->resultset('CD')->create({
56 $schema->txn_do( sub {
60 my $alentry = $search->find({ ID => $new_cd->get_column($new_cd->primary_columns) });
61 ok(defined($alentry->deleted), 'Deleted set in audit_log');