X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Frun%2F01core.tl;h=412ac8f74133be7b6a7d7a6b77e6dca72e9e9817;hb=5ac6a04477849fabc50271c5b7ab15a080ae0109;hp=1fbb4ebce32b40b859654bf8583cc479bd1407ee;hpb=20518cb4f1edcd17aae541e4ad9c44f85c7cdfcd;p=dbsrgits%2FDBIx-Class.git diff --git a/t/run/01core.tl b/t/run/01core.tl index 1fbb4eb..412ac8f 100644 --- a/t/run/01core.tl +++ b/t/run/01core.tl @@ -1,7 +1,7 @@ sub run_tests { my $schema = shift; -plan tests => 34; +plan tests => 38; my @art = $schema->resultset("Artist")->search({ }, { order_by => 'name DESC'}); @@ -71,7 +71,7 @@ $new_again = $schema->resultset("Artist")->find(4); is($new_again->name, 'Man With A Spoon', 'Retrieved correctly'); -is($new_again->ID, 'DBICTest::Artist|artistid=4', 'unique object id generated correctly'); +is($new_again->ID, 'DBICTest::Artist|artist|artistid=4', 'unique object id generated correctly'); is($schema->resultset("Artist")->count, 4, 'count ok'); @@ -99,6 +99,11 @@ is_deeply( \@cd, [qw/cdid artist title year/], 'column order'); $cd = $schema->resultset("CD")->search({ title => 'Spoonful of bees' }, { cols => ['title'] })->next; is($cd->title, 'Spoonful of bees', 'subset of columns returned correctly'); +$cd = $schema->resultset("CD")->search(undef, { include_columns => [ 'artist.name' ], join => [ 'artist' ] })->find(1); + +is($cd->title, 'Spoonful of bees', 'Correct CD returned with include'); +is($cd->get_column('name'), 'Caterwauler McCrae', 'Additional column returned'); + # insert_or_update $new = $schema->resultset("Track")->new( { trackid => 100, @@ -110,9 +115,9 @@ $new->insert_or_update; ok($new->in_storage, 'insert_or_update insert ok'); # test in update mode -$new->position(5); +$new->pos(5); $new->insert_or_update; -is( $schema->resultset("Track")->find(100)->position, 5, 'insert_or_update update ok'); +is( $schema->resultset("Track")->find(100)->pos, 5, 'insert_or_update update ok'); eval { $schema->class("Track")->load_components('DoesNotExist'); }; @@ -140,6 +145,13 @@ cmp_ok($rel_rs->count, '==', 5, 'Related search ok'); cmp_ok($or_rs->next->cdid, '==', $rel_rs->next->cdid, 'Related object ok'); + +ok($schema->storage(), 'Storage available'); + +$schema->source("Artist")->{_columns}{'artistid'} = {}; + +my $typeinfo = $schema->source("Artist")->column_info('artistid'); +is($typeinfo->{data_type}, 'INTEGER', 'column_info ok'); } 1;