9 use Path::Class qw/file/;
11 my $schema = DBICTest->init_schema();
15 my $rs = $schema->resultset('FileColumn');
16 my $fname = '96file_column.t';
17 my $source_file = file('t', $fname);
18 my $fh = $source_file->open('r') or die "failed to open $source_file: $!\n";
20 $rs->create({ file => { handle => $fh, filename => $fname } })
22 is ( $@, '', 'created' );
27 $fc->column_info('file')->{file_column_path},
29 $fc->file->{filename},
31 ok ( -e $storage, 'storage exists' );
34 $fc = $rs->find({ id => $fc->id });
36 is ( $fc->file->{filename}, $fname, 'filename matches' );
37 ok ( compare($storage, $source_file) == 0, 'file contents matches' );
40 my $new_fname = 'File.pm';
41 my $new_source_file = file(qw/lib DBIx Class InflateColumn File.pm/);
42 my $new_storage = file(
43 $fc->column_info('file')->{file_column_path},
47 $fh = $new_source_file->open('r') or die "failed to open $new_source_file: $!\n";
49 $fc->file({ handle => $fh, filename => $new_fname });
53 local $TODO = 'design change required';
54 ok ( ! -e $storage, 'old storage does not exist' );
57 ok ( -e $new_storage, 'new storage exists' );
60 $fc = $rs->find({ id => $fc->id });
62 is ( $fc->file->{filename}, $new_fname, 'new filname matches' );
63 ok ( compare($new_storage, $new_source_file) == 0, 'new content matches' );
67 ok ( ! -e $storage, 'storage deleted' );