Special photo column that creates jpg files with uuid names.
[blog.pm-common-perl-mods.git] / Rose-DBx-Object-Metadata-Column-Photo / t / fh.t
blobd5621da8b76aadee87b074e6fccc38836cf3ff87
1 #!/usr/bin/perl
3 use strict;
4 use warnings;
6 use Test::More 'tests' => 5;
7 use IO::File;
9 use lib 't/lib';
11 use NewDB;
12 use User;
14 my $db = NewDB->new();
16 $db->init();
18 my $fh = IO::File->new();
19 $fh->open( "< t/data/linux.png" );
21 my $u = User->new( name => 'qqaa', photo => $fh );
22 $u->save();
24 ok( $u );
25 ok( $u->photo );
27 my $newfile = 't/uploads/user/' . $u->photo;
28 ok( -d 't/uploads' );
29 ok( -f $newfile );
31 $u->delete();
33 ok( !-e 't/uploads' );
35 $fh->close();