new config option to DBICTest to let you set an alternative storage type, start on...
[dbsrgits/DBIx-Class.git] / t / discard_changes_in_DESTROY.t
CommitLineData
e60dc79f 1#!/usr/bin/perl -w
2
3use strict;
7e36a763 4use warnings;
5
e60dc79f 6use Test::More;
7e36a763 7use lib qw(t/lib);
8use DBICTest;
e60dc79f 9
7e36a763 10my $schema = DBICTest->init_schema();
e60dc79f 11
7e36a763 12plan tests => 1;
e60dc79f 13
14{
15 my @warnings;
16 local $SIG{__WARN__} = sub { push @warnings, @_; };
17 {
18 # Test that this doesn't cause infinite recursion.
7e36a763 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");
e60dc79f 28
7e36a763 29 print "# About to call DESTROY\n";
e60dc79f 30 }
31 is_deeply \@warnings, [];
32}