unless ($dsn && $user);
{
- my $srv_ver = DBICTest::Schema->connect($dsn, $user, $pass)->storage->_server_info->{dbms_version};
+ my $srv_ver = DBICTest->connect_schema($dsn, $user, $pass)->storage->_server_info->{dbms_version};
ok ($srv_ver, 'Got a test server version on fresh schema: ' . ($srv_ver||'???') );
}
for my $opts_name (keys %opts) {
SKIP: {
my $opts = $opts{$opts_name}{opts};
- $schema = DBICTest::Schema->connect($dsn, $user, $pass, $opts);
+ $schema = DBICTest->connect_schema($dsn, $user, $pass, $opts);
try {
$schema->storage->ensure_connected
lives_ok ( sub {
# start a new connection, make sure rebless works
- my $schema = DBICTest::Schema->connect($dsn, $user, $pass, $opts);
+ my $schema = DBICTest->connect_schema($dsn, $user, $pass, $opts);
$schema->populate ('Owners', [
[qw/id name /],
[qw/1 wiggle/],
lives_ok (sub {
# start a new connection, make sure rebless works
# test an insert with a supplied identity, followed by one without
- my $schema = DBICTest::Schema->connect($dsn, $user, $pass, $opts);
+ my $schema = DBICTest->connect_schema($dsn, $user, $pass, $opts);
for (2, 1) {
my $id = $_ * 20 ;
$schema->resultset ('Owners')->create ({ id => $id, name => "troglodoogle $id" });
lives_ok ( sub {
# start a new connection, make sure rebless works
- my $schema = DBICTest::Schema->connect($dsn, $user, $pass, $opts);
+ my $schema = DBICTest->connect_schema($dsn, $user, $pass, $opts);
$schema->populate ('BooksInLibrary', [
[qw/source owner title /],
[qw/Library 1 secrets0/],
) {
for my $quoted (0, 1) {
- $schema = DBICTest::Schema->connect($dsn, $user, $pass, {
+ $schema = DBICTest->connect_schema($dsn, $user, $pass, {
limit_dialect => $dialect,
%$opts,
$quoted
my $sealed_owners = $owners->as_subselect_rs;
is_deeply (
- [ map { $_->name } ($sealed_owners->all) ],
- [ map { $_->name } ($owners->all) ],
+ [ sort map { $_->name } ($sealed_owners->all) ],
+ [ sort map { $_->name } ($owners->all) ],
"$test_type: Sort preserved from within a subquery",
);
}
is ($limited_rs->count, 6, "$test_type: Correct count of limited right-sorted joined resultset");
is ($limited_rs->count_rs->next, 6, "$test_type: Correct count_rs of limited right-sorted joined resultset");
- my $queries;
- my $orig_debug = $schema->storage->debug;
- $schema->storage->debugcb(sub { $queries++; });
- $schema->storage->debug(1);
-
- is_deeply (
- [map { $_->owner->name } ($limited_rs->all) ],
- [@owner_names[2 .. 7]],
- "$test_type: Prefetch-limited rows were properly ordered"
- );
- is ($queries, 1, "$test_type: Only one query with prefetch");
-
- $schema->storage->debugcb(undef);
- $schema->storage->debug($orig_debug);
+ $schema->is_executed_querycount( sub {
+ is_deeply (
+ [map { $_->owner->name } ($limited_rs->all) ],
+ [@owner_names[2 .. 7]],
+ "$test_type: Prefetch-limited rows were properly ordered"
+ );
+ }, 1, "$test_type: Only one query with prefetch" );
is_deeply (
[map { $_->name } ($limited_rs->search_related ('owner')->all) ],
});
# start disconnected to make sure insert works on an un-reblessed storage
- $schema = DBICTest::Schema->connect($dsn, $user, $pass, $opts);
+ $schema = DBICTest->connect_schema($dsn, $user, $pass, $opts);
my $row;
lives_ok {