use Test::More;
use Test::Exception;
-use Path::Class qw/dir/;
-
use DBICTest;
+use DBICTest::Util qw( slurp_bytes rm_rf );
+use DBIx::Class::_Util 'mkdir_p';
local $ENV{DBI_DSN};
my $schema = DBICTest->init_schema( quote_names => 1 );
-my $var = dir ("t/var/ddl_dir-$$");
-$var->mkpath unless -d $var;
+my $var_dir = "t/var/ddl_dir-$$/";
+mkdir_p $var_dir unless -d $var_dir;
-my $test_dir_1 = $var->subdir ('test1', 'foo', 'bar' );
-$test_dir_1->rmtree if -d $test_dir_1;
+my $test_dir_1 = $var_dir . 'test1/foo/bar';
+rm_rf $test_dir_1 if -d $test_dir_1;
$schema->create_ddl_dir( [qw(SQLite MySQL)], 1, $test_dir_1 );
ok( -d $test_dir_1, 'create_ddl_dir did a make_path on its target dir' );
my $type = $_->[0];
my $q = quotemeta($_->[1]);
- for my $f (map { $test_dir_1->file("DBICTest-Schema-${_}-$type.sql") } qw(1 2) ) {
- like scalar $f->slurp, qr/CREATE TABLE ${q}track${q}/, "Proper quoting in $f";
+ for my $f (map { $test_dir_1 . "/DBICTest-Schema-${_}-$type.sql" } qw(1 2) ) {
+ like (
+ scalar slurp_bytes $f,
+ qr/CREATE TABLE ${q}track${q}/,
+ "Proper quoting in $f"
+ );
}
{
local $TODO = 'SQLT::Producer::MySQL has no knowledge of the mythical beast of quoting...'
if $type eq 'MySQL';
- my $f = $test_dir_1->file("DBICTest-Schema-1-2-$type.sql");
- like scalar $f->slurp, qr/DROP TABLE ${q}bindtype_test${q}/, "Proper quoting in diff $f";
+ my $f = $test_dir_1 . "/DBICTest-Schema-1-2-$type.sql";
+ like (
+ scalar slurp_bytes $f,
+ qr/DROP TABLE ${q}bindtype_test${q}/,
+ "Proper quoting in diff $f"
+ );
}
}
}
END {
- $var->rmtree;
+ rm_rf $var_dir;
}
done_testing;