13 local $SIG{__WARN__} = sub { die @_ };
15 ok($@, "Warning triggered without relevant 'no warnings'");
19 # Clean up the packages
20 delete $INC{'DBICTest/ManyToManyWarning.pm'};
21 delete $DBICTest::{"Schema::"};
23 $no_warn = "no warnings 'DBIx::Class::Relationship::ManyToMany';";
24 local $SIG{__WARN__} = sub { die @_ };
26 ok(!$@, "No Warning triggered with relevant 'no warnings'");
36 DBICTest::Schema::Foo;
37 use base 'DBIx::Class::Core';
38 __PACKAGE__->table('foo');
39 __PACKAGE__->add_columns(
41 data_type => 'integer',
42 is_auto_increment => 1,
45 __PACKAGE__->set_primary_key('fooid');
48 __PACKAGE__->has_many('foo_to_bar' => 'DBICTest::Schema::FooToBar' => 'bar');
49 __PACKAGE__->many_to_many( foos => foo_to_bar => 'bar' );
54 DBICTest::Schema::FooToBar;
56 use base 'DBIx::Class::Core';
57 __PACKAGE__->table('foo_to_bar');
58 __PACKAGE__->add_columns(
60 data_type => 'integer',
63 data_type => 'integer',
66 __PACKAGE__->belongs_to('foo' => 'DBICTest::Schema::Foo');
67 __PACKAGE__->belongs_to('bar' => 'DBICTest::Schema::Foo');
71 DBICTest::Schema::Bar;
72 use base 'DBIx::Class::Core';
73 __PACKAGE__->table('bar');
74 __PACKAGE__->add_columns(
76 data_type => 'integer',
77 is_auto_increment => 1,
81 use DBIx::Class::Relationship::ManyToMany;
83 __PACKAGE__->set_primary_key('barid');
84 __PACKAGE__->has_many('foo_to_bar' => 'DBICTest::Schema::FooToBar' => 'foo');
85 __PACKAGE__->many_to_many( bars => foo_to_bar => 'foo' );