X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fstorage%2Ftxn_scope_guard.t;h=342f0a7156e771e32219683e97b517978b3f197d;hb=0d2033c32e2efba74edab1cd83814fe8ec1f7a33;hp=2df2ab6156d470f90a692ce01cd5241dd4b6fa8b;hpb=35cf7d1af791226b0acfea95828c003e64bf4975;p=dbsrgits%2FDBIx-Class.git diff --git a/t/storage/txn_scope_guard.t b/t/storage/txn_scope_guard.t index 2df2ab6..342f0a7 100644 --- a/t/storage/txn_scope_guard.t +++ b/t/storage/txn_scope_guard.t @@ -90,10 +90,8 @@ use DBICTest; { my $schema = DBICTest->init_schema; - no strict 'refs'; no warnings 'redefine'; - - local *{DBIx::Class::Storage::DBI::txn_rollback} = sub { die 'die die my darling' }; + local *DBIx::Class::Storage::DBI::txn_rollback = sub { die 'die die my darling' }; Class::C3->reinitialize() if DBIx::Class::_ENV_::OLD_MRO; throws_ok (sub { @@ -122,32 +120,10 @@ for my $post_poison (0,1) { my $schema = DBICTest->init_schema(no_populate => 1); - no strict 'refs'; no warnings 'redefine'; - local *{DBIx::Class::Storage::DBI::txn_rollback} = sub { die 'die die my darling' }; + local *DBIx::Class::Storage::DBI::txn_rollback = sub { die 'die die my darling' }; Class::C3->reinitialize() if DBIx::Class::_ENV_::OLD_MRO; -#The warn from within a DESTROY callback freaks out Test::Warn, do it old-school -=begin - warnings_exist ( - sub { - my $guard = $schema->txn_scope_guard; - $schema->resultset ('Artist')->create ({ name => 'bohhoo'}); - - # this should freak out the guard rollback - # but it won't work because DBD::SQLite is buggy - # instead just install a toxic rollback above - #$schema->storage->_dbh( $schema->storage->_dbh->clone ); - }, - [ - qr/A DBIx::Class::Storage::TxnScopeGuard went out of scope without explicit commit or error. Rolling back./, - qr/\*+ ROLLBACK FAILED\!\!\! \*+/, - ], - 'proper warnings generated on out-of-scope+rollback failure' - ); -=cut - -# delete this once the above works properly (same test) my @want = ( qr/A DBIx::Class::Storage::TxnScopeGuard went out of scope without explicit commit or error. Rolling back./, qr/\*+ ROLLBACK FAILED\!\!\! \*+/,