X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F60core.t;h=8e1ff464b066f40a9c4c08be908dc02aabafc73d;hb=46e316fd5f510ce7ce79a4b1e15eaa378db7de2f;hp=a46be69d384a32bc1ae784710812a306c5332428;hpb=a1cb5921a914f087163914b010ca0c4e72a57dcc;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/t/60core.t b/t/60core.t index a46be69..8e1ff46 100644 --- a/t/60core.t +++ b/t/60core.t @@ -7,7 +7,7 @@ use DBICTest; my $schema = DBICTest->init_schema(); -plan tests => 84; +plan tests => 88; eval { require DateTime::Format::MySQL }; my $NO_DTFM = $@ ? 1 : 0; @@ -335,10 +335,29 @@ ok(!$@, "stringify to false value doesn't cause error"); # test remove_columns { - is_deeply([$schema->source('CD')->columns], [qw/cdid artist title year genreid single_track/]); - $schema->source('CD')->remove_columns('year'); - is_deeply([$schema->source('CD')->columns], [qw/cdid artist title genreid single_track/]); - ok(! exists $schema->source('CD')->_columns->{'year'}, 'year still exists in _columns'); + is_deeply( + [$schema->source('CD')->columns], + [qw/cdid artist title year genreid single_track/], + 'initial columns', + ); + + $schema->source('CD')->remove_columns('coolyear'); #should not delete year + is_deeply( + [$schema->source('CD')->columns], + [qw/cdid artist title year genreid single_track/], + 'nothing removed when removing a non-existent column', + ); + + $schema->source('CD')->remove_columns('genreid', 'year'); + is_deeply( + [$schema->source('CD')->columns], + [qw/cdid artist title single_track/], + 'removed two columns', + ); + + my $priv_columns = $schema->source('CD')->_columns; + ok(! exists $priv_columns->{'year'}, 'year purged from _columns'); + ok(! exists $priv_columns->{'genreid'}, 'genreid purged from _columns'); } # test get_inflated_columns with objects @@ -360,3 +379,11 @@ SKIP: { my $table = $class->table($class->table); is($table, $class->table, '->table($table) returns $table'); } + +#make sure insert doesn't use set_column +{ + my $en_row = $schema->resultset('Encoded')->new_result({encoded => 'wilma'}); + is($en_row->encoded, 'amliw', 'new encodes'); + $en_row->insert; + is($en_row->encoded, 'amliw', 'insert does not encode again'); +}