8 plan ( ($] >= 5.009000 and $] < 5.010001)
9 ? (skip_all => 'warnings::register broken under 5.10: http://rt.perl.org/rt3/Public/Bug/Display.html?id=62522')
15 local $SIG{__WARN__} = sub { push @w, @_ };
17 my $code = gen_code ( suffix => 1 );
20 ok ( (grep { $_ =~ /The many-to-many relationship bars is trying to create/ } @w), "Warning triggered without relevant 'no warnings'");
25 local $SIG{__WARN__} = sub { push @w, @_ };
27 my $code = gen_code ( suffix => 2, no_warn => 1 );
30 ok ( (not grep { $_ =~ /The many-to-many relationship bars is trying to create/ } @w), "No warning triggered with relevant 'no warnings'");
36 my $suffix = $args->{suffix};
37 my $no_warn = ( $args->{no_warn}
38 ? "no warnings 'DBIx::Class::Relationship::ManyToMany';"
48 DBICTest::Schema::Foo${suffix};
49 use base 'DBIx::Class::Core';
50 __PACKAGE__->table('foo');
51 __PACKAGE__->add_columns(
53 data_type => 'integer',
54 is_auto_increment => 1,
57 __PACKAGE__->set_primary_key('fooid');
60 __PACKAGE__->has_many('foo_to_bar' => 'DBICTest::Schema::FooToBar${suffix}' => 'bar');
61 __PACKAGE__->many_to_many( foos => foo_to_bar => 'bar' );
65 DBICTest::Schema::FooToBar${suffix};
67 use base 'DBIx::Class::Core';
68 __PACKAGE__->table('foo_to_bar');
69 __PACKAGE__->add_columns(
71 data_type => 'integer',
74 data_type => 'integer',
77 __PACKAGE__->belongs_to('foo' => 'DBICTest::Schema::Foo${suffix}');
78 __PACKAGE__->belongs_to('bar' => 'DBICTest::Schema::Foo${suffix}');
82 DBICTest::Schema::Bar${suffix};
84 use base 'DBIx::Class::Core';
85 __PACKAGE__->table('bar');
86 __PACKAGE__->add_columns(
88 data_type => 'integer',
89 is_auto_increment => 1,
94 __PACKAGE__->set_primary_key('barid');
95 __PACKAGE__->has_many('foo_to_bar' => 'DBICTest::Schema::FooToBar${suffix}' => 'foo');
97 __PACKAGE__->many_to_many( bars => foo_to_bar => 'foo' );