Yay, test passes!
[dbsrgits/DBIx-Class-Journal.git] / t / 01test.t
CommitLineData
b5851590 1use strict;
2use warnings;
3
4use Test::More;
5use lib qw(t/lib);
6use DBICTest;
7use Data::Dumper;
8
9BEGIN {
10 eval "use DBD::SQLite";
11 plan $@
12 ? ( skip_all => 'needs DBD::SQLite for testing' )
c5fba518 13 : ( tests => 6 );
b5851590 14}
15
16my $schema = DBICTest->init_schema(no_populate => 1);
17
18ok($schema, 'Created a Schema');
c5fba518 19isa_ok($schema->_journal_schema, 'DBIx::Class::Schema::Journal::DB', 'Actually have a schema object for the journaling');
20isa_ok($schema->_journal_schema->source('CDAuditHistory'), 'DBIx::Class::ResultSource', 'CDAuditHistory source exists');
21isa_ok($schema->_journal_schema->source('ArtistAuditLog'), 'DBIx::Class::ResultSource', 'ArtistAuditLog source exists');
22
f4f0b7c9 23my $new_cd = $schema->txn_do( sub {
f3602465 24 my $artist = $schema->resultset('Artist')->create({
25 name => 'Fred Bloggs',
26 });
f4f0b7c9 27 return $schema->resultset('CD')->create({
28 title => 'Angry young man',
f3602465 29 artist => $artist,
f4f0b7c9 30 year => 2000,
c5fba518 31 });
f4f0b7c9 32});
c5fba518 33isa_ok($new_cd, 'DBIx::Class::Journal', 'Created CD object');
34
35my $search = $schema->_journal_schema->resultset('CDAuditLog')->search();
36ok($search->count, 'Created an entry in the CD audit log');
37
b5851590 38