Explicitly normalize results of relationship resolution
[dbsrgits/DBIx-Class.git] / t / schema / clone.t
index 4ce817f..877da18 100644 (file)
@@ -1,16 +1,29 @@
+BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
+
 use strict;
 use warnings;
 use Test::More;
 
-use lib qw(t/lib);
+
 use DBICTest;
 
 my $schema = DBICTest->init_schema();
 
-ok ($schema->storage->connected, 'initialized schema connected');
+{
+  my $clone = $schema->clone;
+  cmp_ok ($clone->storage, 'eq', $schema->storage, 'Storage copied into new schema (not a new instance)');
+}
+
+{
+  is $schema->custom_attr, undef;
+  my $clone = $schema->clone(custom_attr => 'moo');
+  is $clone->custom_attr, 'moo', 'cloning can change existing attrs';
+}
+
+{
+  my $clone = $schema->clone({ custom_attr => 'moo' });
+  is $clone->custom_attr, 'moo', 'cloning can change existing attrs';
+}
 
-my $clone = $schema->clone;
-ok (!$clone->storage->connected, 'The clone storage is not connected');
-cmp_ok ($clone->storage, 'ne', $schema->storage, 'Storage cloned with schema');
 
 done_testing;