8 my $schema = DBICTest->init_schema();
12 ok ( $schema->storage->debug(1), 'debug' );
14 $schema->storage->debugfh(
15 IO::File->new('t/var/sql.log', 'w')
21 my $rs = $schema->resultset('CD')->search({});
24 my $log = new IO::File('t/var/sql.log', 'r') or die($!);
27 ok($line =~ /^SELECT COUNT/, 'Log success');
29 $schema->storage->debugfh(undef);
30 $ENV{'DBIC_TRACE'} = '=t/var/foo.log';
31 $rs = $schema->resultset('CD')->search({});
33 $log = new IO::File('t/var/foo.log', 'r') or die($!);
36 ok($line =~ /^SELECT COUNT/, 'Log success');
38 $schema->storage->debugobj->debugfh(undef);
39 delete($ENV{'DBIC_TRACE'});
40 open(STDERRCOPY, '>&STDERR');
41 stat(STDERRCOPY); # nop to get warnings quiet
44 $rs = $schema->resultset('CD')->search({});
47 ok($@, 'Died on closed FH');
48 open(STDERR, '>&STDERRCOPY');