NAME

DBIO::Test::Schema - Standard test schema for the DBIO ecosystem

VERSION

version 0.900000

SYNOPSIS

use DBIO::Test::Schema;

my $schema = DBIO::Test::Schema->connect(@connect_info);
my $rs = $schema->resultset('Artist');

DESCRIPTION

A test schema with a standard set of Result classes (Artist, CD, Track, etc.) used across the DBIO test suite and by driver distributions.

All Result classes live under DBIO::Test::Schema::*. Treat it as the shared schema fixture for offline SQL tests, driver checks, and cross-repo regression coverage.

METHODS

capture_executed_sql_bind

my $sqlbinds = $schema->capture_executed_sql_bind(sub {
  $schema->resultset('Artist')->all;
});

Runs the coderef with SQL tracing enabled and returns an arrayref of [$op, [$sql, @bind]] tuples.

is_executed_querycount

$schema->is_executed_querycount(sub { ... }, $expected_count, $msg);
$schema->is_executed_querycount(sub { ... }, { SELECT => 1, INSERT => 2 }, $msg);

Runs the coderef and asserts the number of queries executed.

is_executed_sql_bind

$schema->is_executed_sql_bind(
  sub { $rs->all },
  [[ 'SELECT me.* FROM artist me', [] ]],
  'correct SQL generated',
);

Runs the coderef and asserts the generated SQL matches expectations.

AUTHOR

DBIO & DBIx::Class Authors

COPYRIGHT AND LICENSE

Copyright (C) 2026 DBIO Authors Portions Copyright (C) 2005-2025 DBIx::Class Authors Based on DBIx::Class, heavily modified.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.