1 BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
8 use DBIx::Class::Optional::Dependencies;
10 my @global_ISA_tail = qw(
12 DBIx::Class::Componentised
13 Class::C3::Componentised
14 DBIx::Class::AccessorGroup
15 DBIx::Class::MethodAttributes
16 Class::Accessor::Grouped
22 "Correct mro on base class '$_'",
23 ) for grep { $_ =~ /^DBIx::Class/ } @global_ISA_tail;
28 use base "DBIx::Class::Core";
36 #Injecting a direct parent.
37 __PACKAGE__->inject_base( __PACKAGE__, 'AAA' );
45 #Injecting an indirect parent.
46 __PACKAGE__->inject_base( __PACKAGE__, 'DBIx::Class::Core' );
49 eval { mro::get_linear_isa('BBB'); };
50 ok (! $@, "Correctly skipped injecting a direct parent of class BBB");
52 eval { mro::get_linear_isa('CCC'); };
53 ok (! $@, "Correctly skipped injecting an indirect parent of class BBB");
56 my $art = DBICTest->init_schema->resultset("Artist")->next;
58 check_ancestry($_) for (
60 ref( $art->result_source ),
61 ref( $art->result_source->resultset ),
62 ref( $art->result_source->schema ),
64 { ref $art->result_source->schema->source($_) }
65 $art->result_source->schema->sources
68 ((! DBIx::Class::Optional::Dependencies->req_ok_for('cdbicompat') ) ? () : do {
69 unshift @INC, 't/cdbi/testlib';
70 map { eval "require $_" or die $@; $_ } qw(
71 Film Lazy Actor ActorAlias ImplicitInflate
76 use DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server;
79 mro::get_linear_isa('DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server'),
81 DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server
82 DBIx::Class::Storage::DBI::Sybase
83 DBIx::Class::Storage::DBI::MSSQL
84 DBIx::Class::Storage::DBI::UniqueIdentifier
85 DBIx::Class::Storage::DBI::IdentityInsert
86 DBIx::Class::Storage::DBI
87 DBIx::Class::Storage::DBIHacks
90 'Correctly ordered ISA of DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server'
93 my $storage = DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server->new;
94 $storage->connect_info(['dbi:SQLite::memory:']); # determine_driver's init() connects for this subclass
95 $storage->_determine_driver;
97 $storage->can('sql_limit_dialect'),
98 'DBIx::Class::Storage::DBI::MSSQL'->can('sql_limit_dialect'),
99 'Correct method picked'
102 if ( "$]" >= 5.010 ) {
103 ok (! $INC{'Class/C3.pm'}, 'No Class::C3 loaded on perl 5.10+');
105 # Class::C3::Componentised loads MRO::Compat unconditionally to satisfy
106 # the assumption that once Class::C3::X is loaded, so is Class::C3
107 #ok (! $INC{'MRO/Compat.pm'}, 'No MRO::Compat loaded on perl 5.10+');
113 die "Expecting classname" if length ref $class;
115 my @linear_ISA = @{ mro::get_linear_isa($class) };
117 # something is *VERY* wrong, the splice below won't make it
118 unless (@linear_ISA > @global_ISA_tail) {
120 "Unexpectedly shallow \@ISA for class '$class': "
121 . join ', ', map { "'$_'" } @linear_ISA
127 [ splice @linear_ISA, ($#linear_ISA - $#global_ISA_tail) ],
129 "Correct end of \@ISA for '$class'"
132 # check the remainder
133 for my $c (@linear_ISA) {
134 # nothing to see there
135 next if $c =~ /^DBICTest::/;
137 next if mro::get_mro($c) eq 'c3';
139 fail( "Incorrect mro '@{[ mro::get_mro($c) ]}' on '$c' (parent of '$class')" );