Fix circular relationship diagnostics
[dbsrgits/DBIx-Class-Schema-Loader.git] / t / backcompat / 0.04006 / lib / dbixcsl_common_tests.pm
index 0a1e2d7..c29ed4e 100644 (file)
@@ -43,7 +43,7 @@ sub _monikerize {
 sub run_tests {
     my $self = shift;
 
-    plan tests => 98;
+    plan tests => 97;
 
     $self->create();
 
@@ -84,28 +84,25 @@ sub run_tests {
         $warn_count++ if grep /Dynamic schema detected/, @loader_warnings;
         $warn_count++ for grep /^Bad table or view/, @loader_warnings;
 
-        if($self->{skip_rels}) {
-            is(scalar(@loader_warnings), $warn_count)
-              or diag "Did not get the expected 0 warnings.  Warnings are: "
-                . join('',@loader_warnings);
-            ok(1);
-        }
-        else {
-            $warn_count++;
-            is(scalar(@loader_warnings), $warn_count)
-              or diag "Did not get the expected 1 warning.  Warnings are: "
-                . join('',@loader_warnings);
-            is(grep(/loader_test9 has no primary key/, @loader_warnings), 1);
-        }
+        is(scalar(@loader_warnings), $warn_count)
+          or diag "Did not get the expected 0 warnings.  Warnings are: "
+            . join('',@loader_warnings);
     }
 
     my $conn = $schema_class->clone;
     my $monikers = {};
     my $classes = {};
     foreach my $source_name ($schema_class->sources) {
-        my $table_name = $schema_class->source($source_name)->from;
+        my $table_name = $schema_class->loader->moniker_to_table->{$source_name};
+
+        my $result_class = $schema_class->source($source_name)->result_class;
+
         $monikers->{$table_name} = $source_name;
-        $classes->{$table_name} = $schema_class . q{::} . $source_name;
+        $classes->{$table_name} = $result_class;
+
+        # some DBs (Firebird, Oracle) uppercase everything
+        $monikers->{lc $table_name} = $source_name;
+        $classes->{lc $table_name} = $result_class;
     }
 
 # for debugging...
@@ -439,7 +436,11 @@ sub run_tests {
                 $obj10_2->loader_test11( $obj11->id11() );
                 $obj10_2->update();
             };
-            is($@, '', 'No errors after eval{}');
+            is($@, '', 'No errors after eval{}')
+                or do {
+                    diag explain $rsobj10->result_source->relationship_info('loader_test11');
+                    diag explain $rsobj11->result_source->relationship_info('loader_test10');
+                };
 
             SKIP: {
                 skip 'Previous eval block failed', 3