File: 36datetime.t

package info (click to toggle)
libdbix-class-perl 0.08010-2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 2,052 kB
  • ctags: 1,064
  • sloc: perl: 10,536; sql: 225; makefile: 45
file content (31 lines) | stat: -rwxr-xr-x 807 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use strict;
use warnings;  

use Test::More;
use lib qw(t/lib);
use DBICTest;

eval { require DateTime::Format::MySQL };

plan $@ ? ( skip_all => 'Requires DateTime::Format::MySQL' )
        : ( tests => 3 );

my $schema = DBICTest->init_schema(
    no_deploy => 1, # Deploying would cause an early rebless
);

is(
    ref $schema->storage, 'DBIx::Class::Storage::DBI',
    'Starting with generic storage'
);

# Calling date_time_parser should cause the storage to be reblessed,
# so that we can pick up datetime_parser_type from subclasses

my $parser = $schema->storage->datetime_parser();

# We're currently expecting a MySQL parser. May change in future.
is($parser, 'DateTime::Format::MySQL', 'Got expected datetime_parser');

isa_ok($schema->storage, 'DBIx::Class::Storage::DBI::SQLite', 'storage');