skeleton insert code
[dbsrgits/DBIx-Data-Store-old.git] / t / 01basic_collection.t
index 7b744cf..0c14444 100644 (file)
@@ -35,6 +35,7 @@ sub sort_set {
 sub make_set {
   my ($set, $crud) = @_;
   DBIx::Data::Collection::Set->new(
+    set_over => [ 'id' ],
     store => DBIx::Data::Store::CRUD->new(
       raw_store => DBIx::Data::Store->connect($dsn),
       select_sql => q{SELECT id, name FROM person},
@@ -65,4 +66,24 @@ is_deeply(
   'Basic data with class out ok'
 );
 
+$set = make_set {}, {
+  insert_sql => q{INSERT INTO person (name) VALUES (?) },
+  insert_argument_order => [ 'name' ],
+  insert_command_constructor => sub {
+    require DBIx::Data::Store::Command::Insert::LastInsertId;
+    my $self = shift;
+    DBIx::Data::Store::Command::Insert::LastInsertId->new(
+      id_column => 'id',
+      raw_store => $self->raw_store,
+      insert_call_command => $self->raw_store->new_call_command(@_)
+    );
+  }
+};
+
+my $doug = $set->add({ name => 'Doug' });
+
+use Devel::Dwarn;
+
+Dwarn $doug;
+
 done_testing;