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 );
32 ok ( (not grep { $_ =~ /The many-to-many relationship bars is trying to create/ } @w), "No warning triggered with relevant 'no warnings'");
38 my $suffix = $args->{suffix};
39 my $no_warn = ( $args->{no_warn}
40 ? "no warnings 'DBIx::Class::Relationship::ManyToMany';"
50 DBICTest::Schema::Foo${suffix};
51 use base 'DBIx::Class::Core';
52 __PACKAGE__->table('foo');
53 __PACKAGE__->add_columns(
55 data_type => 'integer',
56 is_auto_increment => 1,
59 __PACKAGE__->set_primary_key('fooid');
62 __PACKAGE__->has_many('foo_to_bar' => 'DBICTest::Schema::FooToBar${suffix}' => 'bar');
63 __PACKAGE__->many_to_many( foos => foo_to_bar => 'bar' );
67 DBICTest::Schema::FooToBar${suffix};
69 use base 'DBIx::Class::Core';
70 __PACKAGE__->table('foo_to_bar');
71 __PACKAGE__->add_columns(
73 data_type => 'integer',
76 data_type => 'integer',
79 __PACKAGE__->belongs_to('foo' => 'DBICTest::Schema::Foo${suffix}');
80 __PACKAGE__->belongs_to('bar' => 'DBICTest::Schema::Foo${suffix}');
84 DBICTest::Schema::Bar${suffix};
86 use base 'DBIx::Class::Core';
87 __PACKAGE__->table('bar');
88 __PACKAGE__->add_columns(
90 data_type => 'integer',
91 is_auto_increment => 1,
96 __PACKAGE__->set_primary_key('barid');
97 __PACKAGE__->has_many('foo_to_bar' => 'DBICTest::Schema::FooToBar${suffix}' => 'foo');
99 __PACKAGE__->many_to_many( bars => foo_to_bar => 'foo' );