X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F01core.t;h=3e95f08875930fe521039ad56130d5de706e04e4;hb=656796f2088da66cc80f4eb127c39c923ef3c1dd;hp=92dbdd5bf94d4cc112d81884d192965445ae985d;hpb=b978d0ef5ef75a0bac2c4a54a3887c768123b9fc;p=dbsrgits%2FDBIx-Class.git diff --git a/t/01core.t b/t/01core.t index 92dbdd5..3e95f08 100644 --- a/t/01core.t +++ b/t/01core.t @@ -1,6 +1,6 @@ use Test::More; -plan tests => 20; +plan tests => 22; use lib qw(t/lib); @@ -70,14 +70,23 @@ $new->name('Man With A Spoon'); $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_database, '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');