Introducing DBIx::Class::Schema::SanityChecker
[dbsrgits/DBIx-Class.git] / xt / extra / diagnostics / invalid_component_composition.t
CommitLineData
12e7015a 1BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
2
3BEGIN { delete $ENV{DBIC_ASSERT_NO_FAILING_SANITY_CHECKS} }
4
5use strict;
6use warnings;
7
8use Test::More;
9
10use DBICTest::Util 'capture_stderr';
11use DBICTest;
12
13
14{
15 package DBICTest::Some::BaseResult;
16 use base "DBIx::Class::Core";
17
18 # order is important
19 __PACKAGE__->load_components(qw( FilterColumn InflateColumn::DateTime ));
20}
21
22{
23 package DBICTest::Some::Result;
24 use base "DBICTest::Some::BaseResult";
25
26 __PACKAGE__->table("sometable");
27
28 __PACKAGE__->add_columns(
29 somecolumn => { data_type => "datetime" },
30 );
31}
32
33{
34 package DBICTest::Some::Schema;
35 use base "DBIx::Class::Schema";
36 __PACKAGE__->schema_sanity_checker("DBIx::Class::Schema::SanityChecker");
37 __PACKAGE__->register_class( some_result => "DBICTest::Some::Result" );
38}
39
40like(
41 capture_stderr {
42 DBICTest::Some::Schema->connection(sub {} );
43 },
44 qr/Class 'DBICTest::Some::Result' was originally using the 'dfs' MRO affecting .+ register_column\(\)/,
45 'Proper incorrect composition warning emitted on StdErr'
46);
47
48done_testing;