X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F76select.t;h=d7c2b4a5788c26db882a198548039f7acb75fac6;hb=c26edbe82938abb6503078514fc07c215931f93f;hp=bee69e6b12864f0a63b21f0fb7ecc12247c2d7d6;hpb=af6aac2d51a435fa60151ac047e1559257fd4eba;p=dbsrgits%2FDBIx-Class.git diff --git a/t/76select.t b/t/76select.t index bee69e6..d7c2b4a 100644 --- a/t/76select.t +++ b/t/76select.t @@ -1,5 +1,5 @@ use strict; -use warnings; +use warnings; use Test::More; use Test::Exception; @@ -9,8 +9,6 @@ use DBIC::SqlMakerTest; my $schema = DBICTest->init_schema(); -plan tests => 24; - my $rs = $schema->resultset('CD')->search({}, { '+select' => \ 'COUNT(*)', @@ -29,16 +27,6 @@ $rs = $schema->resultset('CD')->search({}, lives_ok(sub { $rs->first->get_column('count') }, 'multiple +select/+as columns, 1st rscolumn present'); lives_ok(sub { $rs->first->get_column('addedtitle') }, 'multiple +select/+as columns, 2nd rscolumn present'); -# Tests a regression in ResultSetColumn wrt +select -$rs = $schema->resultset('CD')->search(undef, - { - '+select' => [ \'COUNT(*) AS year_count' ], - order_by => 'year_count' - } -); -my @counts = $rs->get_column('cdid')->all; -ok(scalar(@counts), 'got rows from ->all using +select'); - $rs = $schema->resultset('CD')->search({}, { '+select' => [ \ 'COUNT(*)', 'title' ], @@ -64,6 +52,7 @@ my $cds = $schema->resultset ('CD')->search ({}, { order_by => 'me.cdid'}); # ma cmp_ok ($cds->count, '>', 2, 'Initially populated with more than 2 CDs'); my $table = $cds->result_source->name; +$table = $$table if ref $table eq 'SCALAR'; my $subsel = $cds->search ({}, { columns => [qw/cdid title/], from => \ "(SELECT cdid, title FROM $table LIMIT 2) me", @@ -195,3 +184,5 @@ TODO: { 'columns/select/as fold properly on sub-searches', ); } + +done_testing;