10 use Support::TestSetup;
 
  15 tie %dir, 'IO::Dir', 'SL/DB';
 
  16 my @pms = grep { m/\.pm$/ } keys %dir;
 
  18 foreach my $pm (sort @pms) {
 
  19   my $content = read_file("SL/DB/${pm}");
 
  20   next unless $content =~ m/__PACKAGE__->meta->add_relationships?\((.+?)\);/s;
 
  24   while ($code =~ m/\b(?:map_)?class\s*=>\s*['"]SL::DB::(.+?)['"]/g) {
 
  25     push @not_existing, $1 unless -f "SL/DB/${1}.pm";
 
  29     fail("$pm: Non-existing relationship model(s) " . join(' ', @not_existing));
 
  31     pass("$pm: all relationship model(s) exist");
 
  35 # print Dumper(\@pms);