1 use DBIx::Class::Fixtures;
3 use File::Path 'rmtree';
7 use Test::TempDir::Tiny;
10 my $tempdir = tempdir;
12 (my $schema = ExtraTest::Schema->connect(
13 'DBI:SQLite::memory:','',''))->init_schema;
15 open(my $fh, '<', io->catfile(qw't 18-extra.t')->name) ||
16 die "Can't open the filehandle, test is trash!";
27 my $fixtures = DBIx::Class::Fixtures
29 config_dir => io->catfile(qw't var configs')->name,
30 config_attrs => { photo_dir => io->catfile(qw't var files')->name },
35 config => 'extra.json',
37 directory => io->catfile($tempdir, qw" photos")->name }),
38 'fetch dump executed okay');
40 ok my $key = $schema->resultset('Photo')->first->file;
42 ok -e $key, 'File Created';
44 ok $schema->resultset('Photo')->delete;
46 ok ! -e $key, 'File Deleted';
52 directory => io->catfile($tempdir, qw" photos")->name}),
55 is $key, $schema->resultset('Photo')->first->file,
58 ok -e $key, 'File Restored';
63 rmtree io->catfile(qw't var files')->name;
64 rmtree io->catfile($tempdir, qw'photos')->name;