From: Matt S Trout Date: Fri, 8 Jan 2010 00:29:05 +0000 (+0000) Subject: add class attribute test X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1e948dd4cabe92dedc033ccce3b1dded55b99b3e;p=dbsrgits%2FDBIx-Data-Store-old.git add class attribute test --- diff --git a/t/01basic_collection.t b/t/01basic_collection.t index 5b57064..48f746b 100644 --- a/t/01basic_collection.t +++ b/t/01basic_collection.t @@ -1,12 +1,12 @@ -use strict; -use warnings FATAL => 'all'; use Test::More; use DBIx::Data::Store; use DBIx::Data::Store::CRUD; use DBIx::Data::Collection::Set; - use DBI; +use strict; +use warnings FATAL => 'all'; + my $dsn = 'dbi:SQLite:tmp.db'; my @expect; @@ -27,12 +27,15 @@ my @expect; } sub make_set { + my ($set, $crud) = @_; DBIx::Data::Collection::Set->new( store => DBIx::Data::Store::CRUD->new( raw_store => DBIx::Data::Store->connect($dsn), select_sql => q{SELECT id, name FROM person}, select_column_order => [ qw(id name) ], + %$crud, ), + %$set ); } @@ -48,4 +51,12 @@ is_deeply([ $set->flatten ], \@expect, 'Basic data out ok (flatten)'); is_deeply(\@got, \@expect, 'Basic data out ok (stream)'); } +$set = make_set { class => 'Spoon' }; + +is_deeply( + [ $set->flatten ], + [ map { bless({ %$_ }, 'Spoon') } @expect ], + 'Basic data with class out ok' +); + done_testing;