-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;
}
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
);
}
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;