X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F05components.t;h=335fb068fc8be82ec5fc9bb67f9a3d0970cb11ae;hb=63ee8b7896e02ee888eb26251fc28311721832c5;hp=303f0285876b693ec573c927a8aa52f8f3c91112;hpb=fe0e9f6788cd319d430b447d31912f739097705e;p=dbsrgits%2FDBIx-Class.git diff --git a/t/05components.t b/t/05components.t index 303f028..335fb06 100644 --- a/t/05components.t +++ b/t/05components.t @@ -1,16 +1,21 @@ -#!/usr/bin/perl +BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) } use strict; use warnings; use Test::More; -use lib qw(t/lib); -use DBICTest::ForeignComponent; -plan tests => 6; +use DBICTest; + +{ + package DBICTest::SomeResult; + use base 'DBIx::Class::Core'; + __PACKAGE__->table("boguz"); +} # Tests if foreign component was loaded by calling foreign's method -ok( DBICTest::ForeignComponent->foreign_test_method, 'foreign component' ); +ok( ! $INC{"DBICTest/ForeignComponent.pm"}, "DBICTest::ForeignComponent not yet loaded" ); +ok( DBICTest::SomeResult->result_class("DBICTest::ForeignComponent")->foreign_test_method, 'foreign component loaded correctly' ); # Test for inject_base to filter out duplicates { package DBICTest::_InjectBaseTest; @@ -35,32 +40,7 @@ is_deeply( \@DBICTest::_InjectBaseTest::ISA, 'inject_base filters duplicates' ); -# Test for a warning with incorrect order in load_components -my @warnings = (); -{ - package A::Test; - our @ISA = 'DBIx::Class'; - { - local $SIG{__WARN__} = sub { push @warnings, shift}; - __PACKAGE__->load_components(qw(Core UTF8Columns)); - } -} -like( $warnings[0], qr/Core loaded before UTF8Columns/, - 'warning issued for incorrect order in load_components()' ); -is( scalar @warnings, 1, - 'only one warning issued for incorrect load_components call' ); - -# Test that no warning is issued for the correct order in load_components -{ - @warnings = (); - package B::Test; - our @ISA = 'DBIx::Class'; - { - local $SIG{__WARN__} = sub { push @warnings, shift }; - __PACKAGE__->load_components(qw(UTF8Columns Core)); - } -} -is( scalar @warnings, 0, - 'warning not issued for correct order in load_components()' ); - use_ok('DBIx::Class::AccessorGroup'); +use_ok('DBIx::Class::Componentised'); + +done_testing;