Commit | Line | Data |
e8b77df6 |
1 | use warnings; |
e4c24739 |
2 | use strict; |
e8b77df6 |
3 | |
4 | use Test::More; |
e4c24739 |
5 | |
d8190011 |
6 | use lib qw(t/lib); |
87bf71d5 |
7 | use DBICTest; # do not remove even though it is not used (pulls in MRO::Compat if needed) |
d8190011 |
8 | |
e4c24739 |
9 | { |
e8b77df6 |
10 | package AAA; |
e4c24739 |
11 | |
e8b77df6 |
12 | use base "DBIx::Class::Core"; |
13 | } |
e4c24739 |
14 | |
e8b77df6 |
15 | { |
16 | package BBB; |
e4c24739 |
17 | |
e8b77df6 |
18 | use base 'AAA'; |
e4c24739 |
19 | |
e8b77df6 |
20 | #Injecting a direct parent. |
21 | __PACKAGE__->inject_base( __PACKAGE__, 'AAA' ); |
22 | } |
e4c24739 |
23 | |
e8b77df6 |
24 | { |
25 | package CCC; |
e4c24739 |
26 | |
e8b77df6 |
27 | use base 'AAA'; |
e4c24739 |
28 | |
e8b77df6 |
29 | #Injecting an indirect parent. |
30 | __PACKAGE__->inject_base( __PACKAGE__, 'DBIx::Class::Core' ); |
e4c24739 |
31 | } |
32 | |
4f507947 |
33 | eval { mro::get_linear_isa('BBB'); }; |
e4c24739 |
34 | ok (! $@, "Correctly skipped injecting a direct parent of class BBB"); |
35 | |
4f507947 |
36 | eval { mro::get_linear_isa('CCC'); }; |
e4c24739 |
37 | ok (! $@, "Correctly skipped injecting an indirect parent of class BBB"); |
e8b77df6 |
38 | |
39 | use DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server; |
e8b77df6 |
40 | |
41 | is_deeply ( |
42 | mro::get_linear_isa('DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server'), |
43 | [qw/ |
44 | DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server |
45 | DBIx::Class::Storage::DBI::Sybase |
46 | DBIx::Class::Storage::DBI::MSSQL |
47 | DBIx::Class::Storage::DBI::UniqueIdentifier |
fabbd5cc |
48 | DBIx::Class::Storage::DBI::IdentityInsert |
e8b77df6 |
49 | DBIx::Class::Storage::DBI |
50 | DBIx::Class::Storage::DBIHacks |
51 | DBIx::Class::Storage |
52 | DBIx::Class |
53 | DBIx::Class::Componentised |
54 | Class::C3::Componentised |
db29433c |
55 | DBIx::Class::AccessorGroup |
e8b77df6 |
56 | Class::Accessor::Grouped |
57 | /], |
58 | 'Correctly ordered ISA of DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server' |
59 | ); |
60 | |
87bf71d5 |
61 | my $storage = DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server->new; |
c1e5a9ac |
62 | $storage->connect_info(['dbi:SQLite::memory:']); # determine_driver's init() connects for this subclass |
87bf71d5 |
63 | $storage->_determine_driver; |
e8b77df6 |
64 | is ( |
87bf71d5 |
65 | $storage->can('sql_limit_dialect'), |
66 | 'DBIx::Class::Storage::DBI::MSSQL'->can('sql_limit_dialect'), |
e8b77df6 |
67 | 'Correct method picked' |
68 | ); |
69 | |
87bf71d5 |
70 | if ($] >= 5.010) { |
71 | ok (! $INC{'Class/C3.pm'}, 'No Class::C3 loaded on perl 5.10+'); |
72 | |
73 | # Class::C3::Componentised loads MRO::Compat unconditionally to satisfy |
74 | # the assumption that once Class::C3::X is loaded, so is Class::C3 |
75 | #ok (! $INC{'MRO/Compat.pm'}, 'No MRO::Compat loaded on perl 5.10+'); |
76 | } |
77 | |
e8b77df6 |
78 | done_testing; |