Merge 'trunk' into 'replication_dedux'
[dbsrgits/DBIx-Class.git] / t / 36datetime.t
1 use strict;
2 use warnings;  
3
4 use Test::More;
5 use lib qw(t/lib);
6 use DBICTest;
7
8 eval { require DateTime::Format::MySQL };
9
10 plan $@ ? ( skip_all => 'Requires DateTime::Format::MySQL' )
11         : ( tests => 3 );
12
13 my $schema = DBICTest->init_schema(
14     no_deploy => 1, # Deploying would cause an early rebless
15 );
16
17 is(
18     ref $schema->storage, 'DBIx::Class::Storage::DBI',
19     'Starting with generic storage'
20 );
21
22 # Calling date_time_parser should cause the storage to be reblessed,
23 # so that we can pick up datetime_parser_type from subclasses
24
25 my $parser = $schema->storage->datetime_parser();
26
27 # We're currently expecting a MySQL parser. May change in future.
28 is($parser, 'DateTime::Format::MySQL', 'Got expected datetime_parser');
29
30 isa_ok($schema->storage, 'DBIx::Class::Storage::DBI::SQLite', 'storage');
31