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 Class::Accessor::Grouped
21 "Correct mro on base class '$_'",
22 ) for grep { $_ =~ /^DBIx::Class/ } @global_ISA_tail;
27 use base "DBIx::Class::Core";
35 #Injecting a direct parent.
36 __PACKAGE__->inject_base( __PACKAGE__, 'AAA' );
44 #Injecting an indirect parent.
45 __PACKAGE__->inject_base( __PACKAGE__, 'DBIx::Class::Core' );
48 eval { mro::get_linear_isa('BBB'); };
49 ok (! $@, "Correctly skipped injecting a direct parent of class BBB");
51 eval { mro::get_linear_isa('CCC'); };
52 ok (! $@, "Correctly skipped injecting an indirect parent of class BBB");
55 my $art = DBICTest->init_schema->resultset("Artist")->next;
57 check_ancestry($_) for (
59 ref( $art->result_source ),
60 ref( $art->result_source->resultset ),
61 ref( $art->result_source->schema ),
63 { ref $art->result_source->schema->source($_) }
64 $art->result_source->schema->sources
67 ((! DBIx::Class::Optional::Dependencies->req_ok_for('cdbicompat') ) ? () : do {
68 unshift @INC, 't/cdbi/testlib';
69 map { eval "require $_" or die $@; $_ } qw(
70 Film Lazy Actor ActorAlias ImplicitInflate
75 use DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server;
78 mro::get_linear_isa('DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server'),
80 DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server
81 DBIx::Class::Storage::DBI::Sybase
82 DBIx::Class::Storage::DBI::MSSQL
83 DBIx::Class::Storage::DBI::UniqueIdentifier
84 DBIx::Class::Storage::DBI::IdentityInsert
85 DBIx::Class::Storage::DBI
86 DBIx::Class::Storage::DBIHacks
89 'Correctly ordered ISA of DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server'
92 my $storage = DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server->new;
93 $storage->connect_info(['dbi:SQLite::memory:']); # determine_driver's init() connects for this subclass
94 $storage->_determine_driver;
96 $storage->can('sql_limit_dialect'),
97 'DBIx::Class::Storage::DBI::MSSQL'->can('sql_limit_dialect'),
98 'Correct method picked'
101 if ( "$]" >= 5.010 ) {
102 ok (! $INC{'Class/C3.pm'}, 'No Class::C3 loaded on perl 5.10+');
104 # Class::C3::Componentised loads MRO::Compat unconditionally to satisfy
105 # the assumption that once Class::C3::X is loaded, so is Class::C3
106 #ok (! $INC{'MRO/Compat.pm'}, 'No MRO::Compat loaded on perl 5.10+');
112 die "Expecting classname" if length ref $class;
114 my @linear_ISA = @{ mro::get_linear_isa($class) };
116 # something is *VERY* wrong, the splice below won't make it
117 unless (@linear_ISA > @global_ISA_tail) {
119 "Unexpectedly shallow \@ISA for class '$class': "
120 . join ', ', map { "'$_'" } @linear_ISA
126 [ splice @linear_ISA, ($#linear_ISA - $#global_ISA_tail) ],
128 "Correct end of \@ISA for '$class'"
131 # check the remainder
132 for my $c (@linear_ISA) {
133 # nothing to see there
134 next if $c =~ /^DBICTest::/;
136 next if mro::get_mro($c) eq 'c3';
138 fail( "Incorrect mro '@{[ mro::get_mro($c) ]}' on '$c' (parent of '$class')" );