my $rs = ref ($_[0]) || $_[0];
if ($rs->can ('result_source_instance') ) {
- return $rs->result_source_instance;
+ my $x = $rs->result_source_instance;
+ use Data::Dumper;
+ die Dumper $x;
}
else {
$class->throw_exception (
my $orig_source = $source;
$source = $source->new({ %$source, source_name => $moniker });
+ use Data::Dumper;
+ die Dumper $source;
$source->schema($self);
Scalar::Util::weaken($source->{schema}) if ref($self);
require DBIx::Class;
unless ( DBIx::Class::Optional::Dependencies->req_ok_for ('test_podcoverage') ) {
my $missing = DBIx::Class::Optional::Dependencies->req_missing_for ('test_podcoverage');
- $ENV{RELEASE_TESTING} || DBICTest::AuthorCheck->is_author
- ? die ("Failed to load release-testing module requirements: $missing")
+ DBICTest::AuthorCheck->is_author
+ ? die ("Failed to load author-testing module requirements: $missing")
: plan skip_all => "Test needs: $missing"
}
use strict;
use warnings;
use Test::More;
+use Test::Warn;
use lib qw(t/lib);
use DBICTest; # do not remove even though it is not used
-my $warnings;
-eval {
- local $SIG{__WARN__} = sub { $warnings .= shift };
+warnings_exist (
+ sub {
package DBICNSTest;
use base qw/DBIx::Class::Schema/;
__PACKAGE__->load_namespaces;
-};
-ok(!$@, 'load_namespaces doesnt die') or diag $@;
-like($warnings, qr/load_namespaces found ResultSet class C with no corresponding Result class/, 'Found warning about extra ResultSet classes');
-
-like($warnings, qr/load_namespaces found ResultSet class DBICNSTest::ResultSet::D that does not subclass DBIx::Class::ResultSet/, 'Found warning about ResultSets with incorrect subclass');
+ },
+ [
+ qr/load_namespaces found ResultSet class C with no corresponding Result class/,
+ qr/load_namespaces found ResultSet class DBICNSTest::ResultSet::D that does not subclass DBIx::Class::ResultSet/,
+ ],
+ 'Found warning about extra ResultSet classes, and incorrectly subclassed ResultSets',
+);
my $source_a = DBICNSTest->source('A');
isa_ok($source_a, 'DBIx::Class::ResultSource::Table');
}
SKIP: {
- skip "Need DBD::Pg 2.9.2 or newer for array tests", 4 if $DBD::Pg::VERSION < 2.009002;
+ skip "Need DBD::Pg 2.9.2 or newer for array tests", 5 if $DBD::Pg::VERSION < 2.009002;
lives_ok {
$schema->resultset('ArrayTest')->create({
});
} 'updating arrayref as pg array data';
+ lives_ok {
+ my $row = $schema->resultset('ArrayTest')->next;
+ $row->arrayfield ([5, 6]);
+ $row->update;
+ } 'updating dirty arrayref as pg array data';
+
$schema->resultset('ArrayTest')->create({
- arrayfield => [5, 6],
+ arrayfield => [7, 8],
});
my $count;
}
}
+ # make sure subqueried count still works
+ lives_ok ( sub {
+
+ }, 'for does not propagate on count subqueries');
+
######## other older Auto-pk tests