1#!/usr/bin/perl -w
2
3use strict;
4use warnings;  
5
6use Test::More;
7use lib qw(t/lib);
8use DBICTest;
9
10my $schema = DBICTest->init_schema();
11
12plan tests => 1;
13
14{
15    my @warnings;
16    local $SIG{__WARN__} = sub { push @warnings, @_; };
17    {
18        # Test that this doesn't cause infinite recursion.
19        local *DBICTest::Artist::DESTROY;
20        local *DBICTest::Artist::DESTROY = sub { $_[0]->discard_changes };
21        
22        my $artist = $schema->resultset("Artist")->create( { 
23            artistid    => 10,
24            name        => "artist number 10",
25        });
26        
27        $artist->name("Wibble");
28        
29        print "# About to call DESTROY\n";
30    }
31    is_deeply \@warnings, [];
32}