Commit | Line | Data |
b1e43108 |
1 | package dbixcsl_mssql_extra_tests; |
2 | |
3 | use Test::More; |
4 | |
7cb9244f |
5 | my $vendor = 'mssql'; |
6 | |
7 | sub vendor { |
8 | shift; |
9 | $vendor = shift; |
10 | } |
11 | |
b1e43108 |
12 | sub extra { +{ |
13 | create => [ |
14 | qq{ |
7cb9244f |
15 | CREATE TABLE [${vendor}_loader_test1.dot] ( |
b1e43108 |
16 | id INT IDENTITY NOT NULL PRIMARY KEY, |
17 | dat VARCHAR(8) |
18 | ) |
19 | }, |
20 | ], |
7cb9244f |
21 | drop => [ "[${vendor}_loader_test1.dot]" ], |
d89bca78 |
22 | count => 6, |
b1e43108 |
23 | run => sub { |
24 | my ($schema, $monikers, $classes) = @_; |
25 | |
d89bca78 |
26 | # Test that the table above (with '.' in name) gets loaded correctly. |
7cb9244f |
27 | my $vendor_titlecased = "\u\L$vendor"; |
28 | |
29 | ok((my $rs = eval { |
30 | $schema->resultset("${vendor_titlecased}LoaderTest1Dot") }), |
b1e43108 |
31 | 'got a resultset'); |
32 | |
33 | ok((my $from = eval { $rs->result_source->from }), |
34 | 'got an $rsrc->from'); |
35 | |
36 | is ref($from), 'SCALAR', '->table is a scalar ref'; |
37 | |
7cb9244f |
38 | is eval { $$from }, "[${vendor}_loader_test1.dot]", |
b1e43108 |
39 | '->table name is correct'; |
d89bca78 |
40 | |
41 | # Test that identity columns do not have 'identity' in the data_type, and do |
42 | # have is_auto_increment. |
43 | my $identity_col_info = $schema->resultset('LoaderTest10') |
44 | ->result_source->column_info('id10'); |
45 | |
46 | is $identity_col_info->{data_type}, 'int', |
47 | q{'INT IDENTITY' column has data_type => 'int'}; |
48 | |
49 | is $identity_col_info->{is_auto_increment}, 1, |
50 | q{'INT IDENTITY' column has is_auto_increment => 1}; |
b1e43108 |
51 | }, |
52 | }} |
53 | |
54 | 1; |