1 BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
10 my $schema = DBICTest->init_schema();
15 my $new_artistid = $schema->resultset("Artist")->get_column('artistid')->max + 1;
19 my $artist = $schema->resultset("Artist")->find($old_artistid);
20 ok(defined $artist, 'found an artist with the new PK');
22 $artist->update({ artistid => $new_artistid });
23 is($artist->artistid, $new_artistid, 'artist ID matches');
28 my $artist = $schema->resultset("Artist")->find($old_artistid);
29 ok(!defined $artist, 'no artist found with the old PK');
34 my $artist = $schema->resultset("Artist")->find($new_artistid);
35 ok(defined $artist, 'found an artist with the new PK');
36 is($artist->artistid, $new_artistid, 'artist ID matches');
39 # Do it all over again, using a different methodology:
40 $old_artistid = $new_artistid;
45 my $artist = $schema->resultset("Artist")->find($old_artistid);
46 ok(defined $artist, 'found an artist with the new PK');
48 $artist->artistid($new_artistid);
50 is($artist->artistid, $new_artistid, 'artist ID matches');
55 my $artist = $schema->resultset("Artist")->find($old_artistid);
56 ok(!defined $artist, 'no artist found with the old PK');
61 my $artist = $schema->resultset("Artist")->find($new_artistid);
62 ok(defined $artist, 'found an artist with the new PK');
63 is($artist->artistid, $new_artistid, 'artist ID matches');