X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F04dont_break_c3.t;h=6a8496d78099b5e247b77eb1a2192cc5f7d71517;hb=8e9b9ce5f997bb8f90a56ecfee9b96b0f5b6ff9d;hp=d5cb5d1726a48a5becd5da80da0f57ba4d75f490;hpb=4f507947b537abfbd940706b12d71f89aa2b23ff;p=dbsrgits%2FDBIx-Class.git diff --git a/t/04dont_break_c3.t b/t/04dont_break_c3.t index d5cb5d1..6a8496d 100644 --- a/t/04dont_break_c3.t +++ b/t/04dont_break_c3.t @@ -1,30 +1,34 @@ -#!/usr/bin/perl -w -#Simon Ilyushchenko, 12/05/05 -#Testing the case when we try to inject into @ISA a class that's already a parent of the target class. - +use warnings; use strict; -use Test::More tests => 2; + +use Test::More; use MRO::Compat; -{ -package AAA; +use lib qw(t/lib); +use DBICTest; # do not remove even though it is not used -use base "DBIx::Class::Core"; +{ + package AAA; -package BBB; + use base "DBIx::Class::Core"; +} -use base 'AAA'; +{ + package BBB; -#Injecting a direct parent. -__PACKAGE__->inject_base( __PACKAGE__, 'AAA' ); + use base 'AAA'; + #Injecting a direct parent. + __PACKAGE__->inject_base( __PACKAGE__, 'AAA' ); +} -package CCC; +{ + package CCC; -use base 'AAA'; + use base 'AAA'; -#Injecting an indirect parent. -__PACKAGE__->inject_base( __PACKAGE__, 'DBIx::Class::Core' ); + #Injecting an indirect parent. + __PACKAGE__->inject_base( __PACKAGE__, 'DBIx::Class::Core' ); } eval { mro::get_linear_isa('BBB'); }; @@ -32,3 +36,33 @@ ok (! $@, "Correctly skipped injecting a direct parent of class BBB"); eval { mro::get_linear_isa('CCC'); }; ok (! $@, "Correctly skipped injecting an indirect parent of class BBB"); + +use DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server; +use B; + +is_deeply ( + mro::get_linear_isa('DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server'), + [qw/ + DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server + DBIx::Class::Storage::DBI::Sybase + DBIx::Class::Storage::DBI::MSSQL + DBIx::Class::Storage::DBI::UniqueIdentifier + DBIx::Class::Storage::DBI + DBIx::Class::Storage::DBIHacks + DBIx::Class::Storage + DBIx::Class + DBIx::Class::Componentised + Class::C3::Componentised + Class::Accessor::Grouped + /], + 'Correctly ordered ISA of DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server' +); + +my $dialect_ref = DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server->can('sql_limit_dialect'); +is ( + B::svref_2object($dialect_ref)->GV->STASH->NAME, + 'DBIx::Class::Storage::DBI::MSSQL', + 'Correct method picked' +); + +done_testing;