X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fdiscard_changes_in_DESTROY.t;h=cefcda4381e22ed45aaf8a813600878cc1709e84;hb=47a435d239f7a6d8b5770698e6ae785c2f56b66a;hp=950d9bdb048cf56c92b3d199be59b4ba790eb864;hpb=1b32d56ec274e0f7054381c5b630b73f2ce3a699;p=dbsrgits%2FDBIx-Class.git diff --git a/t/discard_changes_in_DESTROY.t b/t/discard_changes_in_DESTROY.t index 950d9bd..cefcda4 100644 --- a/t/discard_changes_in_DESTROY.t +++ b/t/discard_changes_in_DESTROY.t @@ -1,29 +1,30 @@ -#!/usr/bin/perl -w - use strict; -use Test::More; +use warnings; -BEGIN { - eval "use DBIx::Class::CDBICompat;"; - plan $@ ? (skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@") - : (tests=> 1); -} +use Test::More; +use lib qw(t/lib); +use DBICTest; -INIT { - use lib 't/testlib'; - use Film; -} +my $schema = DBICTest->init_schema(); { my @warnings; local $SIG{__WARN__} = sub { push @warnings, @_; }; { # Test that this doesn't cause infinite recursion. - local *Film::DESTROY; - local *Film::DESTROY = sub { $_[0]->discard_changes }; - - my $film = Film->insert({ Title => "Eegah!" }); - $film->director("Arch Hall Sr."); + local *DBICTest::Artist::DESTROY; + local *DBICTest::Artist::DESTROY = sub { $_[0]->discard_changes }; + + my $artist = $schema->resultset("Artist")->create( { + artistid => 10, + name => "artist number 10", + }); + + $artist->name("Wibble"); + + print "# About to call DESTROY\n"; } is_deeply \@warnings, []; -} \ No newline at end of file +} + +done_testing;