[Bast-commits] r4839 - DBIx-Class/0.08/branches/warnfree/t
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Mon Sep 22 00:22:23 BST 2008
Author: ribasushi
Date: 2008-09-22 00:22:23 +0100 (Mon, 22 Sep 2008)
New Revision: 4839
Modified:
DBIx-Class/0.08/branches/warnfree/t/63register_class.t
Log:
Add a test for another expected warning
Modified: DBIx-Class/0.08/branches/warnfree/t/63register_class.t
===================================================================
--- DBIx-Class/0.08/branches/warnfree/t/63register_class.t 2008-09-21 22:37:45 UTC (rev 4838)
+++ DBIx-Class/0.08/branches/warnfree/t/63register_class.t 2008-09-21 23:22:23 UTC (rev 4839)
@@ -1,17 +1,25 @@
use strict;
use warnings;
-use Test::More tests => 2;
+use Test::More tests => 3;
use lib qw(t/lib);
use DBICTest;
use DBICTest::Schema;
use DBICTest::Schema::Artist;
DBICTest::Schema::Artist->source_name('MyArtist');
-DBICTest::Schema->register_class('FooA', 'DBICTest::Schema::Artist');
+{
+ my $w;
+ local $SIG{__WARN__} = sub { $w = shift };
+ DBICTest::Schema->register_class('FooA', 'DBICTest::Schema::Artist');
+ like ($w, qr/use register_extra_source/, 'Complain about using register_class on an already-registered class');
+}
my $schema = DBICTest->init_schema();
my $a = $schema->resultset('FooA')->search;
is($a->count, 3, 'have 3 artists');
is($schema->class('FooA'), 'DBICTest::FooA', 'Correct artist class');
+
+# clean up
+DBICTest::Schema->_unregister_source('FooA');
More information about the Bast-commits
mailing list