Codebase list libdbix-class-perl / df54756
Fix test suite to work again with DBICTEST_SQLITE_USE_FILE It was never included as part of POISON_ENV and subsequently lapsed. Sigh. (cherry pick of 7154ff35) Peter Rabbitson 9 years ago
6 changed file(s) with 11 addition(s) and 14 deletion(s). Raw diff Collapse all Expand all
8888 # returned results, look through lib, find all mentioned ENVvars and
8989 # set them to true and see if anything explodes
9090 for var in \
91 DBICTEST_SQLITE_USE_FILE \
9192 DBICTEST_SQLITE_REVERSE_DEFAULT_ORDER \
9293 $(grep -P '\$ENV\{' -r lib/ --exclude-dir Optional | grep -oP '\bDBIC\w+' | sort -u | grep -v DBIC_TRACE)
9394 do
1515
1616 cmp_ok(DBICTest->resultset('Artist')->count, '>', 0, 'count is valid');
1717
18 # cleanup globaly cached handle so we do not trigger the leaktest
19 DBICTest->schema->storage->disconnect;
20
2118 done_testing;
6060 );
6161 is( $it->count, 1, "complex abstract count ok" );
6262
63 # cleanup globals so we do not trigger the leaktest
64 for ( map { DBICTest->schema->class($_) } DBICTest->schema->sources ) {
65 $_->class_resolver(undef);
66 $_->resultset_instance(undef);
67 $_->result_source_instance(undef);
68 }
69 {
70 no warnings qw/redefine once/;
71 *DBICTest::schema = sub {};
72 }
73
7463 done_testing;
142142
143143 $SIG{INT} = sub { _cleanup_dbfile(); exit 1 };
144144
145 my $need_global_cleanup;
145146 sub _cleanup_dbfile {
146147 # cleanup if this is us
147148 if (
151152 or
152153 $ENV{DBICTEST_LOCK_HOLDER} == $$
153154 ) {
155 if ($need_global_cleanup and my $dbh = DBICTest->schema->storage->_dbh) {
156 $dbh->disconnect;
157 }
158
154159 my $db_file = _sqlite_dbfilename();
155160 unlink $_ for ($db_file, "${db_file}-journal");
156161 }
315320 my $schema;
316321
317322 if ($args{compose_connection}) {
323 $need_global_cleanup = 1;
318324 $schema = DBICTest::Schema->compose_connection(
319325 'DBICTest', $self->_database(%args)
320326 );
127127 ],
128128 'Expected SQL on correlated realiased subquery'
129129 );
130
131 $schema->storage->disconnect;
130132
131133 # test for subselect identifier leakage
132134 # NOTE - the hodge-podge mix of literal and regular identifuers is *deliberate*
145145 );
146146 }
147147
148 $schema->storage->_dbh->disconnect;
149
148150 # make sure connection-less storages do not throw on _determine_driver
149151 # but work with ENV at the same time
150152 SKIP: for my $env_dsn (undef, (DBICTest->_database)[0] ) {