Merge 'trunk' into 'DBIx-Class-current'
[dbsrgits/DBIx-Class.git] / t / run / 01core.tl
index 9ef60a0..5d04001 100644 (file)
@@ -1,7 +1,7 @@
 sub run_tests {
 my $schema = shift;
 
-plan tests => 44; 
+plan tests => 49;
 
 # figure out if we've got a version of sqlite that is older than 3.2.6, in
 # which case COUNT(DISTINCT()) doesn't work
@@ -194,6 +194,21 @@ is($typeinfo->{data_type}, 'INTEGER', 'column_info ok');
 $schema->source("Artist")->column_info('artistid');
 ok($schema->source("Artist")->{_columns_info_loaded} == 1, 'Columns info flag set');
 
+# source_name should be set for normal modules
+is($schema->source('CD')->source_name, 'CD', 'source_name is set to moniker');
+
+# test the result source that uses source_name
+ok($schema->source('SourceNameArtists'), 'SourceNameArtists result source exists');
+
+my @artsn = $schema->resultset("SourceNameArtists")->search({ }, { order_by => 'name DESC'});
+cmp_ok(@artsn, '==', 4, "Four artists returned");
+
+
+# test removed columns
+is_deeply([$schema->source('CD')->columns], [qw/cdid artist title year/]);
+$schema->source('CD')->remove_columns('year');
+is_deeply([$schema->source('CD')->columns], [qw/cdid artist title/]);
+
 }
 
 1;