[Bast-commits] r4897 - DBIx-Class-InflateColumn-FS/1.000/trunk/t

semifor at dev.catalyst.perl.org semifor at dev.catalyst.perl.org
Tue Oct 7 03:00:41 BST 2008


Author: semifor
Date: 2008-10-07 03:00:41 +0100 (Tue, 07 Oct 2008)
New Revision: 4897

Added:
   DBIx-Class-InflateColumn-FS/1.000/trunk/t/01-fs_columns.t
   DBIx-Class-InflateColumn-FS/1.000/trunk/t/99-pod_coverage.t
Removed:
   DBIx-Class-InflateColumn-FS/1.000/trunk/t/01-schema.t
   DBIx-Class-InflateColumn-FS/1.000/trunk/t/03podcoverage.t
Log:
Renamed some tests

Copied: DBIx-Class-InflateColumn-FS/1.000/trunk/t/01-fs_columns.t (from rev 4883, DBIx-Class-InflateColumn-FS/1.000/trunk/t/01-schema.t)
===================================================================
--- DBIx-Class-InflateColumn-FS/1.000/trunk/t/01-fs_columns.t	                        (rev 0)
+++ DBIx-Class-InflateColumn-FS/1.000/trunk/t/01-fs_columns.t	2008-10-07 02:00:41 UTC (rev 4897)
@@ -0,0 +1,74 @@
+use warnings;
+use strict;
+use DBICx::TestDatabase;
+use Test::More tests => 13;
+use Path::Class qw/file/;
+use File::Compare;
+use lib qw(t/lib);
+
+my $schema = DBICx::TestDatabase->new('My::TestSchema');
+my $rs = $schema->resultset('Book');
+
+# we'll use *this* file as our content
+# TODO: Copy it or create something else so errant tests don't inadvertently
+# delete it!
+my $file = file($0);
+
+my $book = $rs->create({
+    name => 'Alice in Wonderland',
+    cover_image => $file,
+});
+
+isa_ok( $book->cover_image, 'Path::Class::File' );
+isnt( $book->cover_image, $file, 'storage is a different file' );
+ok( compare($book->cover_image, $file) == 0, 'file contents equivalent');
+
+# setting a file to itself should be a no-op
+my $storage = Path::Class::File->new($book->cover_image);
+$book->update({ cover_image => $storage });
+
+is( $storage, $book->cover_image, 'setting storage to self' );
+
+# deleting the row should delete the associated file
+$book->delete;
+ok( ! -e $storage, 'file successfully deleted' );
+
+# multiple rows
+my ($book1, $book2) = map {
+    $rs->create({ name => $_, cover_image => $file })
+} qw/Book1 Book2/;
+
+isnt( $book1->cover_image, $book2->cover_image, 'rows have different storage' );
+
+$rs->delete;
+ok ( ! -e $book1->cover_image, "storage deleted for row 1" );
+ok ( ! -e $book2->cover_image, "storage deleted for row 2" );
+
+
+# null fs_column
+$book = $rs->create({ name => 'No cover image', cover_image => undef });
+
+ok ( !defined $book->cover_image, 'null fs_column' );
+
+
+# file handle
+open my $fh, '<', $0 or die "failed to open $0 for read: $!\n";
+
+$book->cover_image($fh);
+$book->update;
+close $fh or die;
+
+ok( compare($book->cover_image, $0) == 0, 'store from filehandle' );
+
+# setting fs_column to null should delete storage
+$book = $rs->create({ name => 'Here today, gone tomorrow',
+        cover_image => $file });
+$storage = $book->cover_image;
+ok( -e $storage, 'storage exists before nulling' );
+$book->update({ cover_image => undef });
+ok( ! -e $storage, 'does not exist after nulling' );
+
+$book->update({ cover_image => $file });
+$book->update({ id => 999 });
+$book->discard_changes;
+ok( -e $book->cover_image, 'storage renamed on PK change' );

Deleted: DBIx-Class-InflateColumn-FS/1.000/trunk/t/01-schema.t
===================================================================
--- DBIx-Class-InflateColumn-FS/1.000/trunk/t/01-schema.t	2008-10-06 23:29:20 UTC (rev 4896)
+++ DBIx-Class-InflateColumn-FS/1.000/trunk/t/01-schema.t	2008-10-07 02:00:41 UTC (rev 4897)
@@ -1,74 +0,0 @@
-use warnings;
-use strict;
-use DBICx::TestDatabase;
-use Test::More tests => 13;
-use Path::Class qw/file/;
-use File::Compare;
-use lib qw(t/lib);
-
-my $schema = DBICx::TestDatabase->new('My::TestSchema');
-my $rs = $schema->resultset('Book');
-
-# we'll use *this* file as our content
-# TODO: Copy it or create something else so errant tests don't inadvertently
-# delete it!
-my $file = file($0);
-
-my $book = $rs->create({
-    name => 'Alice in Wonderland',
-    cover_image => $file,
-});
-
-isa_ok( $book->cover_image, 'Path::Class::File' );
-isnt( $book->cover_image, $file, 'storage is a different file' );
-ok( compare($book->cover_image, $file) == 0, 'file contents equivalent');
-
-# setting a file to itself should be a no-op
-my $storage = Path::Class::File->new($book->cover_image);
-$book->update({ cover_image => $storage });
-
-is( $storage, $book->cover_image, 'setting storage to self' );
-
-# deleting the row should delete the associated file
-$book->delete;
-ok( ! -e $storage, 'file successfully deleted' );
-
-# multiple rows
-my ($book1, $book2) = map {
-    $rs->create({ name => $_, cover_image => $file })
-} qw/Book1 Book2/;
-
-isnt( $book1->cover_image, $book2->cover_image, 'rows have different storage' );
-
-$rs->delete;
-ok ( ! -e $book1->cover_image, "storage deleted for row 1" );
-ok ( ! -e $book2->cover_image, "storage deleted for row 2" );
-
-
-# null fs_column
-$book = $rs->create({ name => 'No cover image', cover_image => undef });
-
-ok ( !defined $book->cover_image, 'null fs_column' );
-
-
-# file handle
-open my $fh, '<', $0 or die "failed to open $0 for read: $!\n";
-
-$book->cover_image($fh);
-$book->update;
-close $fh or die;
-
-ok( compare($book->cover_image, $0) == 0, 'store from filehandle' );
-
-# setting fs_column to null should delete storage
-$book = $rs->create({ name => 'Here today, gone tomorrow',
-        cover_image => $file });
-$storage = $book->cover_image;
-ok( -e $storage, 'storage exists before nulling' );
-$book->update({ cover_image => undef });
-ok( ! -e $storage, 'does not exist after nulling' );
-
-$book->update({ cover_image => $file });
-$book->update({ id => 999 });
-$book->discard_changes;
-ok( -e $book->cover_image, 'storage renamed on PK change' );

Deleted: DBIx-Class-InflateColumn-FS/1.000/trunk/t/03podcoverage.t
===================================================================
--- DBIx-Class-InflateColumn-FS/1.000/trunk/t/03podcoverage.t	2008-10-06 23:29:20 UTC (rev 4896)
+++ DBIx-Class-InflateColumn-FS/1.000/trunk/t/03podcoverage.t	2008-10-07 02:00:41 UTC (rev 4897)
@@ -1,16 +0,0 @@
-use Test::More;
-
-eval "use Pod::Coverage 0.19";
-plan skip_all => 'Pod::Coverage 0.19 required' if $@;
-eval "use Test::Pod::Coverage 1.04";
-plan skip_all => 'Test::Pod::Coverage 1.04 required' if $@;
-
-plan skip_all => 'set TEST_POD to enable this test'
-  unless ($ENV{TEST_POD} || -e 'MANIFEST.SKIP');
-
-my @modules = sort { $a cmp $b } (Test::Pod::Coverage::all_modules());
-plan tests => scalar(@modules);
-
-foreach my $module (@modules) {
-    pod_coverage_ok($module, "$module POD coverage");
-}

Copied: DBIx-Class-InflateColumn-FS/1.000/trunk/t/99-pod_coverage.t (from rev 4883, DBIx-Class-InflateColumn-FS/1.000/trunk/t/03podcoverage.t)
===================================================================
--- DBIx-Class-InflateColumn-FS/1.000/trunk/t/99-pod_coverage.t	                        (rev 0)
+++ DBIx-Class-InflateColumn-FS/1.000/trunk/t/99-pod_coverage.t	2008-10-07 02:00:41 UTC (rev 4897)
@@ -0,0 +1,16 @@
+use Test::More;
+
+eval "use Pod::Coverage 0.19";
+plan skip_all => 'Pod::Coverage 0.19 required' if $@;
+eval "use Test::Pod::Coverage 1.04";
+plan skip_all => 'Test::Pod::Coverage 1.04 required' if $@;
+
+plan skip_all => 'set TEST_POD to enable this test'
+  unless ($ENV{TEST_POD} || -e 'MANIFEST.SKIP');
+
+my @modules = sort { $a cmp $b } (Test::Pod::Coverage::all_modules());
+plan tests => scalar(@modules);
+
+foreach my $module (@modules) {
+    pod_coverage_ok($module, "$module POD coverage");
+}




More information about the Bast-commits mailing list