X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F84serialize.t;h=dedf8daebdb0d5128e7ee42590fc8ab1033dddbd;hb=4376a1574bc5b25f4b9160e8fc3ce329ae226e0f;hp=55aa74bdb0630e1b4e08a6a5e6c8eebcc57a8af5;hpb=50261284a5486d1974adb202eb84e5ed782d3665;p=dbsrgits%2FDBIx-Class.git diff --git a/t/84serialize.t b/t/84serialize.t index 55aa74b..dedf8da 100644 --- a/t/84serialize.t +++ b/t/84serialize.t @@ -151,4 +151,42 @@ for my $name (keys %stores) { $schema->storage->debugcb(undef); } +# test schema-less detached thaw +{ + my $artist = $schema->resultset('Artist')->find(1); + + $artist = dclone $artist; + + is( $artist->name, 'Caterwauler McCrae', 'getting column works' ); + + ok( $artist->update, 'Non-dirty update noop' ); + + ok( $artist->name( 'Beeeeeeees' ), 'setting works' ); + + ok( $artist->is_column_changed( 'name' ), 'Column dirtyness works' ); + ok( $artist->is_changed, 'object dirtyness works' ); + + my $rs = $artist->result_source->resultset; + $rs->set_cache([ $artist ]); + + is( $rs->count, 1, 'Synthetic resultset count works' ); + + my $exc = qr/Unable to perform storage-dependent operations with a detached result source.+use \$schema->thaw/; + + throws_ok { $artist->update } + $exc, + 'Correct exception on row op' + ; + + throws_ok { $artist->discard_changes } + $exc, + 'Correct exception on row op' + ; + + throws_ok { $rs->find(1) } + $exc, + 'Correct exception on rs op' + ; +} + done_testing;