Resolve $rsrc instance duality on metadata traversal
[dbsrgits/DBIx-Class.git] / t / 70auto.t
1 BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
2
3 use strict;
4 use warnings;
5
6 use Test::More;
7
8 use DBICTest;
9
10 my $schema = DBICTest->init_schema();
11
12 plan tests => 2;
13
14 $schema->class("Artist")->load_components(qw/PK::Auto::SQLite/);
15   # Should just be PK::Auto but this ensures the compat shim works
16
17 # add an artist without primary key to test Auto
18 my $artist = $schema->resultset("Artist")->create( { name => 'Auto' } );
19 $artist->name( 'Auto Change' );
20 ok($artist->update, 'update on object created without PK ok');
21
22 my $copied = $artist->copy({ name => 'Don\'t tell the RIAA', artistid => undef });
23 is($copied->name, 'Don\'t tell the RIAA', "Copied with PKs ok.");
24