8 my $exp_warn = qr/The many-to-many relationship 'bars' is trying to create/;
12 local $SIG{__WARN__} = sub { $_[0] =~ $exp_warn ? push @w, $_[0] : warn $_[0] };
13 my $code = gen_code ( suffix => 1 );
15 ok (! $@, 'Eval code without warnings suppression')
18 ok (@w, "Warning triggered without DBIC_OVERWRITE_HELPER_METHODS_OK");
23 local $SIG{__WARN__} = sub { $_[0] =~ $exp_warn ? push @w, $_[0] : warn $_[0] };
25 my $code = gen_code ( suffix => 2 );
27 local $ENV{DBIC_OVERWRITE_HELPER_METHODS_OK} = 1;
29 ok (! $@, 'Eval code with warnings suppression')
32 ok (! @w, "No warning triggered with DBIC_OVERWRITE_HELPER_METHODS_OK");
38 my $suffix = $args->{suffix};
46 DBICTest::Schema::Foo${suffix};
47 use base 'DBIx::Class::Core';
49 __PACKAGE__->table('foo');
50 __PACKAGE__->add_columns(
52 data_type => 'integer',
53 is_auto_increment => 1,
56 __PACKAGE__->set_primary_key('fooid');
59 __PACKAGE__->has_many('foo_to_bar' => 'DBICTest::Schema::FooToBar${suffix}' => 'bar');
60 __PACKAGE__->many_to_many( foos => foo_to_bar => 'bar' );
64 DBICTest::Schema::FooToBar${suffix};
66 use base 'DBIx::Class::Core';
67 __PACKAGE__->table('foo_to_bar');
68 __PACKAGE__->add_columns(
70 data_type => 'integer',
73 data_type => 'integer',
76 __PACKAGE__->belongs_to('foo' => 'DBICTest::Schema::Foo${suffix}');
77 __PACKAGE__->belongs_to('bar' => 'DBICTest::Schema::Foo${suffix}');
81 DBICTest::Schema::Bar${suffix};
83 use base 'DBIx::Class::Core';
85 __PACKAGE__->table('bar');
86 __PACKAGE__->add_columns(
88 data_type => 'integer',
89 is_auto_increment => 1,
93 __PACKAGE__->set_primary_key('barid');
94 __PACKAGE__->has_many('foo_to_bar' => 'DBICTest::Schema::FooToBar${suffix}' => 'foo');
96 __PACKAGE__->many_to_many( bars => foo_to_bar => 'foo' );