X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Finflate%2Ffile_column.t;h=24588c0f35c00a30060793b950cddcb9267d1657;hb=199fbc453ec03891d0e156d7353c5e992ba4de47;hp=b8330bfd6f8838d3346c9586024446335bdb63f7;hpb=1239d14e2874c2209270d5388fd5055e348cf83f;p=dbsrgits%2FDBIx-Class.git diff --git a/t/inflate/file_column.t b/t/inflate/file_column.t index b8330bf..24588c0 100644 --- a/t/inflate/file_column.t +++ b/t/inflate/file_column.t @@ -4,22 +4,53 @@ use warnings; use Test::More; use lib qw(t/lib); -# inject IC::File into the result baseclass for testing -BEGIN { - $ENV{DBIC_IC_FILE_NOWARN} = 1; - require DBICTest::BaseResult; - DBICTest::BaseResult->load_components (qw/InflateColumn::File/); -} - use DBICTest; +use DBICTest::Schema; use File::Compare; use Path::Class qw/file/; +{ + local $ENV{DBIC_IC_FILE_NOWARN} = 1; + + package DBICTest::Schema::FileColumn; + + use strict; + use warnings; + use base qw/DBICTest::BaseResult/; + + use File::Temp qw/tempdir/; + + __PACKAGE__->load_components (qw/InflateColumn::File/); + __PACKAGE__->table('file_columns'); + + __PACKAGE__->add_columns( + id => { data_type => 'integer', is_auto_increment => 1 }, + file => { + data_type => 'varchar', + is_file_column => 1, + file_column_path => tempdir(CLEANUP => 1), + size => 255 + } + ); + + __PACKAGE__->set_primary_key('id'); +} +DBICTest::Schema->load_classes('FileColumn'); + my $schema = DBICTest->init_schema; plan tests => 10; +if (not $ENV{DBICTEST_SQLT_DEPLOY}) { + $schema->storage->dbh->do(<<'EOF'); + CREATE TABLE file_columns ( + id INTEGER PRIMARY KEY, + file VARCHAR(255) + ) +EOF +} + my $rs = $schema->resultset('FileColumn'); my $source_file = file(__FILE__); my $fname = $source_file->basename;