[Bast-commits] r6497 - DBIx-Class/0.08/branches/test_added_relships/t/relationship

wintrmute at dev.catalyst.perl.org wintrmute at dev.catalyst.perl.org
Thu Jun 4 08:35:58 GMT 2009


Author: wintrmute
Date: 2009-06-04 08:35:57 +0000 (Thu, 04 Jun 2009)
New Revision: 6497

Added:
   DBIx-Class/0.08/branches/test_added_relships/t/relationship/afterthought.t
Log:
New test which attempts to add a new relationship to an existing class, after
the schema has been initialised.
Currently the test fails, as the relationship is not added.
Discussion on IRC indicates this probably *should* work.


Added: DBIx-Class/0.08/branches/test_added_relships/t/relationship/afterthought.t
===================================================================
--- DBIx-Class/0.08/branches/test_added_relships/t/relationship/afterthought.t	                        (rev 0)
+++ DBIx-Class/0.08/branches/test_added_relships/t/relationship/afterthought.t	2009-06-04 08:35:57 UTC (rev 6497)
@@ -0,0 +1,33 @@
+#!/usr/bin/perl -w
+
+use strict;
+use warnings;  
+
+use Test::More tests => 2;
+use lib qw(t/lib);
+use DBICTest;
+
+=head1 DESCRIPTION
+
+Attempt to add a relationship to a class *after* they've been initialised..
+
+=cut
+
+my $schema = DBICTest->init_schema();
+
+my @previous_rels = sort $schema->source('Artist')->relationships;
+
+my $class = $schema->class('Artist');
+$class->belongs_to('rank' => $schema->class('Lyrics'));
+
+# Now check we have the relationship:
+my $source = $schema->source('Artist');
+
+is_deeply(
+    [sort $source->relationships],
+    [sort(@previous_rels, 'rank')],
+    'Found rank in relationships'
+);
+
+ok($source->relationship_info('rank'), "We have relationship info for rank");
+




More information about the Bast-commits mailing list