Switch cursor accessor to CAG's component_class type for autoloading
[dbsrgits/DBIx-Class.git] / t / 04_c3_mro.t
CommitLineData
e8b77df6 1use warnings;
e4c24739 2use strict;
e8b77df6 3
4use Test::More;
e4c24739 5
d8190011 6use lib qw(t/lib);
87bf71d5 7use 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 33eval { mro::get_linear_isa('BBB'); };
e4c24739 34ok (! $@, "Correctly skipped injecting a direct parent of class BBB");
35
4f507947 36eval { mro::get_linear_isa('CCC'); };
e4c24739 37ok (! $@, "Correctly skipped injecting an indirect parent of class BBB");
e8b77df6 38
39use DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server;
e8b77df6 40
41is_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
48 DBIx::Class::Storage::DBI
49 DBIx::Class::Storage::DBIHacks
50 DBIx::Class::Storage
51 DBIx::Class
52 DBIx::Class::Componentised
53 Class::C3::Componentised
db29433c 54 DBIx::Class::AccessorGroup
e8b77df6 55 Class::Accessor::Grouped
56 /],
57 'Correctly ordered ISA of DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server'
58);
59
87bf71d5 60my $storage = DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server->new;
61$storage->_determine_driver;
e8b77df6 62is (
87bf71d5 63 $storage->can('sql_limit_dialect'),
64 'DBIx::Class::Storage::DBI::MSSQL'->can('sql_limit_dialect'),
e8b77df6 65 'Correct method picked'
66);
67
87bf71d5 68if ($] >= 5.010) {
69 ok (! $INC{'Class/C3.pm'}, 'No Class::C3 loaded on perl 5.10+');
70
71 # Class::C3::Componentised loads MRO::Compat unconditionally to satisfy
72 # the assumption that once Class::C3::X is loaded, so is Class::C3
73 #ok (! $INC{'MRO/Compat.pm'}, 'No MRO::Compat loaded on perl 5.10+');
74}
75
e8b77df6 76done_testing;