use Test::More;
-plan tests => 21;
+plan tests => 23;
use lib qw(t/lib);
cmp_ok(@art, '==', 2, 'And then there were two');
-ok(!$art->in_database, "It knows it's dead");
+ok(!$art->in_storage, "It knows it's dead");
eval { $art->delete; };
$art->insert;
-ok($art->in_database, "Re-created");
+ok($art->in_storage, "Re-created");
@art = DBICTest::Artist->search({ });
$new->update;
-$new_again = DBICTest::Artist->retrieve(4);
+$new_again = DBICTest::Artist->find(4);
is($new_again->name, 'Man With A Spoon', 'Retrieved correctly');
is(DBICTest::Artist->count, 4, 'count ok');
-# add an artist without primary key to test Auto
-my $artist = DBICTest::Artist->create( { name => 'Auto' } );
-$artist->name( 'Auto Change' );
-ok($artist->update, 'update on object created without PK ok');
+# insert_or_update
+$new = DBICTest::Track->new( {
+ trackid => 100,
+ cd => 1,
+ position => 1,
+ title => 'Insert or Update',
+} );
+$new->insert_or_update;
+ok($new->in_storage, 'insert_or_update insert ok');
+# test in update mode
+$new->position(5);
+$new->insert_or_update;
+is( DBICTest::Track->find(100)->position, 5, 'insert_or_update update ok');
+
+eval { DBICTest::Track->load_components('DoesNotExist'); };
+
+ok $@, $@;