DBIO-SQLite
view release on metacpan or search on metacpan
t/34-diff-column-changed.t view on Meta::CPAN
# Focused offline test pinning the real behaviour of the column-comparison
# used in DBIO::SQLite::Diff::Column->diff.
#
# The underlying core helper DBIO::Diff::Compare::changed_column_fields is
# MISLEADINGLY NAMED: despite the name it returns the LIST OF CHANGED FIELDS
# (empty list = identical). DBIO::SQLite::Diff::Column consumes it as
# `changed_column_fields($src, $tgt) ? 1 : 0` -- truthy (changed) => emit an `alter`.
#
# This test asserts the OBSERVABLE behaviour through the public diff() entry
# point so the meaning is locked regardless of the helper's name:
# * identical column info => NO alter op
# * differing column info => an alter op
# It also directly pins changed_column_fields's "non-empty = different" contract.
use_ok 'DBIO::SQLite::Diff::Column';
use DBIO::Diff::Compare qw(changed_column_fields);
my $src_tables = { t => { table_name => 't', kind => 'table' } };
my $tgt_tables = { t => { table_name => 't', kind => 'table' } };
t/52leaks.t view on Meta::CPAN
pager => $pager,
);
}
# FIXME - ideally this kind of collector ought to be global, but attempts
# with an invasive debugger-based tracer did not quite work out... yet
# Manually scan the innards of everything we have in the base collection
# we assembled so far (skip the DT madness below) *recursively*
#
# Only do this when we do have the bits to look inside CVs properly,
# without it we are liable to pick up object defaults that are locked
# in method closures
#
# Some elaborate SQLAC-replacements leak, do not worry about it for now
if (
DBIO::Test::Util::LeakTracer::CV_TRACING
and
! $ENV{DBIO_TEST_SWAPOUT_SQLAC_WITH}
) {
visit_refs(
refs => [ $base_collection ],
t/61findnot.t view on Meta::CPAN
ok(!defined($next), 'Nothing next in ResultSet');
$cd = $schema->resultset("CD")->search({title => 'Call of the West'});
@cd = $cd->single;
cmp_ok(@cd, '==', 1, 'Return something even in array context');
ok(@cd && !defined($cd[0]), 'Array contains an undef as only element');
$cd = $schema->resultset("CD")->first;
my $artist_rs = $schema->resultset("Artist")->search({ artistid => $cd->artist->artistid });
for my $key ('', 'primary') {
my $art = $artist_rs->find({ name => 'some other name' }, { $key ? (key => $key) : () });
is($art->artistid, $cd->get_column('artist'), "Artist found through @{[ $key ? 'explicit' : 'implicit' ]} key locked in the resultset");
}
# collapsing and non-collapsing are separate codepaths, thus the separate tests
$artist_rs = $schema->resultset("Artist");
warnings_exist {
$artist_rs->find({})
} qr/\QQuery returned more than one row. SQL that returns multiple rows is DEPRECATED for ->find and ->single/
( run in 1.036 second using v1.01-cache-2.11-cpan-bbe5e583499 )