no strict 'refs';
*{"${target}::schema"} =
sub { $schema };
- *{"${target}::class"} =
- sub { shift->schema->class(@_) };
+ foreach my $meth (qw/class source resultset/) {
+ *{"${target}::${meth}"} =
+ sub { shift->schema->$meth(@_) };
+ }
}
$base->class_resolver($target);
return $schema;
use DBICTest::BasicRels;
require "t/run/01core.tl";
-run_tests();
+run_tests("DBICTest");
use DBICTest::BasicRels;
require "t/run/04db.tl";
-run_tests();
+run_tests("DBICTest");
use DBICTest::BasicRels;
require "t/run/05multipk.tl";
-run_tests();
+run_tests("DBICTest");
use DBICTest::BasicRels;
require "t/run/06relationship.tl";
-run_tests();
+run_tests("DBICTest");
use DBICTest::BasicRels;
require "t/run/07pager.tl";
-run_tests();
+run_tests("DBICTest");
use DBICTest::BasicRels;
require "t/run/08inflate.tl";
-run_tests();
+run_tests("DBICTest");
use DBICTest::BasicRels;
require "t/run/08inflate_has_a.tl";
-run_tests();
+run_tests("DBICTest");
use DBICTest::BasicRels;
require "t/run/09update.tl";
-run_tests();
+run_tests("DBICTest");
use DBICTest::BasicRels;
require "t/run/10auto.tl";
-run_tests();
+run_tests("DBICTest");
use DBICTest::BasicRels;
require "t/run/11mysql.tl";
-run_tests();
+run_tests("DBICTest");
use DBICTest::BasicRels;
require "t/run/12pg.tl";
-run_tests();
+run_tests("DBICTest");
use DBICTest::BasicRels;
require "t/run/13oracle.tl";
-run_tests();
+run_tests("DBICTest");
use DBICTest::BasicRels;
require "t/run/14mssql.tl";
-run_tests();
+run_tests("DBICTest");
use DBICTest::BasicRels;
require "t/run/15limit.tl";
-run_tests();
+run_tests("DBICTest");
use DBICTest::BasicRels;
require "t/run/16joins.tl";
-run_tests();
+run_tests("DBICTest");
use DBICTest::BasicRels;
require "t/run/17join_count.tl";
-run_tests();
+run_tests("DBICTest");
use DBICTest::BasicRels;
require "t/run/18self_referencial.tl";
-run_tests();
+run_tests("DBICTest");
use DBICTest::HelperRels;
require "t/run/01core.tl";
-run_tests();
+run_tests("DBICTest");
use DBICTest::HelperRels;
require "t/run/04db.tl";
-run_tests();
+run_tests("DBICTest");
use DBICTest::HelperRels;
require "t/run/05multipk.tl";
-run_tests();
+run_tests("DBICTest");
use DBICTest::HelperRels;
require "t/run/06relationship.tl";
-run_tests();
+run_tests("DBICTest");
use DBICTest::HelperRels;
require "t/run/07pager.tl";
-run_tests();
+run_tests("DBICTest");
use DBICTest::HelperRels;
require "t/run/08inflate.tl";
-run_tests();
+run_tests("DBICTest");
use DBICTest::HelperRels;
require "t/run/08inflate_has_a.tl";
-run_tests();
+run_tests("DBICTest");
use DBICTest::HelperRels;
require "t/run/09update.tl";
-run_tests();
+run_tests("DBICTest");
use DBICTest::HelperRels;
require "t/run/10auto.tl";
-run_tests();
+run_tests("DBICTest");
use DBICTest::HelperRels;
require "t/run/11mysql.tl";
-run_tests();
+run_tests("DBICTest");
use DBICTest::HelperRels;
require "t/run/12pg.tl";
-run_tests();
+run_tests("DBICTest");
use DBICTest::HelperRels;
require "t/run/13oracle.tl";
-run_tests();
+run_tests("DBICTest");
use DBICTest::HelperRels;
require "t/run/14mssql.tl";
-run_tests();
+run_tests("DBICTest");
use DBICTest::HelperRels;
require "t/run/15limit.tl";
-run_tests();
+run_tests("DBICTest");
use DBICTest::HelperRels;
require "t/run/16joins.tl";
-run_tests();
+run_tests("DBICTest");
use DBICTest::HelperRels;
require "t/run/17join_count.tl";
-run_tests();
+run_tests("DBICTest");
use DBICTest::HelperRels;
require "t/run/18self_referencial.tl";
-run_tests();
+run_tests("DBICTest");
use DBICTest::HelperRels;
require "t/run/19uuid.tl";
-run_tests();
+run_tests("DBICTest");
sub run_tests {
+my $schema = shift;
plan tests => 34;
-my @art = DBICTest->class("Artist")->search({ }, { order_by => 'name DESC'});
+my @art = $schema->class("Artist")->search({ }, { order_by => 'name DESC'});
cmp_ok(@art, '==', 3, "Three artists returned");
ok($art->update, 'Update run');
-@art = DBICTest->class("Artist")->search({ name => 'We Are In Rehab' });
+@art = $schema->class("Artist")->search({ name => 'We Are In Rehab' });
cmp_ok(@art, '==', 1, "Changed artist returned by search");
$art->delete;
-@art = DBICTest->class("Artist")->search({ });
+@art = $schema->class("Artist")->search({ });
cmp_ok(@art, '==', 2, 'And then there were two');
ok($art->in_storage, "Re-created");
-@art = DBICTest->class("Artist")->search({ });
+@art = $schema->class("Artist")->search({ });
cmp_ok(@art, '==', 3, 'And now there are three again');
-my $new = DBICTest->class("Artist")->create({ artistid => 4 });
+my $new = $schema->class("Artist")->create({ artistid => 4 });
cmp_ok($new->artistid, '==', 4, 'Create produced record ok');
-@art = DBICTest->class("Artist")->search({ });
+@art = $schema->class("Artist")->search({ });
cmp_ok(@art, '==', 4, "Oh my god! There's four of them!");
$new->update;
-$new_again = DBICTest->class("Artist")->find(4);
+$new_again = $schema->class("Artist")->find(4);
is($new_again->name, 'Man With A Spoon', 'Retrieved correctly');
is($new_again->ID, 'DBICTest::Artist|artistid=4', 'unique object id generated correctly');
-is(DBICTest->class("Artist")->count, 4, 'count ok');
+is($schema->class("Artist")->count, 4, 'count ok');
-my $cd = DBICTest->class("CD")->find(1);
+my $cd = $schema->class("CD")->find(1);
my %cols = $cd->get_columns;
cmp_ok(keys %cols, '==', 4, 'get_columns number of columns ok');
$cd->discard_changes;
# check whether ResultSource->ordered_columns returns columns in order originally supplied
-my @cd = DBICTest->class("CD")->find(1)->result_source->ordered_columns;
+my @cd = $schema->source("CD")->ordered_columns;
is_deeply( \@cd, [qw/cdid artist title year/], 'ordered_columns');
-$cd = DBICTest->class("CD")->search({ title => 'Spoonful of bees' }, { cols => ['title'] })->next;
+$cd = $schema->class("CD")->search({ title => 'Spoonful of bees' }, { cols => ['title'] })->next;
is($cd->title, 'Spoonful of bees', 'subset of columns returned correctly');
# insert_or_update
-$new = DBICTest->class("Track")->new( {
+$new = $schema->class("Track")->new( {
trackid => 100,
cd => 1,
position => 1,
# test in update mode
$new->position(5);
$new->insert_or_update;
-is( DBICTest->class("Track")->find(100)->position, 5, 'insert_or_update update ok');
+is( $schema->class("Track")->find(100)->position, 5, 'insert_or_update update ok');
-eval { DBICTest->class("Track")->load_components('DoesNotExist'); };
+eval { $schema->class("Track")->load_components('DoesNotExist'); };
ok $@, $@;
-is(DBICTest->class("Artist")->field_name_for->{name}, 'artist name', 'mk_classdata usage ok');
+is($schema->class("Artist")->field_name_for->{name}, 'artist name', 'mk_classdata usage ok');
my $search = [ { 'tags.tag' => 'Cheesy' }, { 'tags.tag' => 'Blue' } ];
-my $or_rs = DBICTest->class("CD")->search($search, { join => 'tags',
+my $or_rs = $schema->class("CD")->search($search, { join => 'tags',
order_by => 'cdid' });
cmp_ok($or_rs->count, '==', 5, 'Search with OR ok');
-my $distinct_rs = DBICTest->class("CD")->search($search, { join => 'tags', distinct => 1 });
+my $distinct_rs = $schema->class("CD")->search($search, { join => 'tags', distinct => 1 });
cmp_ok($distinct_rs->all, '==', 4, 'DISTINCT search with OR ok');
-my $tag_rs = DBICTest->class('Tag')->search(
+my $tag_rs = $schema->class('Tag')->search(
[ { 'me.tag' => 'Cheesy' }, { 'me.tag' => 'Blue' } ]);
my $rel_rs = $tag_rs->search_related('cd');
sub run_tests {
+my $schema = shift;
plan tests => 2;
# add some rows inside a transaction and commit it
# XXX: Is storage->dbh the only way to get a dbh?
-DBICTest->class("Artist")->txn_begin;
+$schema->class("Artist")->txn_begin;
for (10..15) {
- DBICTest->class("Artist")->create( {
+ $schema->class("Artist")->create( {
artistid => $_,
name => "artist number $_",
} );
}
-DBICTest->class("Artist")->txn_commit;
-my ($artist) = DBICTest->class("Artist")->find(15);
+$schema->class("Artist")->txn_commit;
+my ($artist) = $schema->class("Artist")->find(15);
is($artist->name, 'artist number 15', "Commit ok");
# add some rows inside a transaction and roll it back
-DBICTest->class("Artist")->txn_begin;
+$schema->class("Artist")->txn_begin;
for (21..30) {
- DBICTest->class("Artist")->create( {
+ $schema->class("Artist")->create( {
artistid => $_,
name => "artist number $_",
} );
}
-DBICTest->class("Artist")->txn_rollback;
-($artist) = DBICTest->class("Artist")->search( artistid => 25 );
+$schema->class("Artist")->txn_rollback;
+($artist) = $schema->class("Artist")->search( artistid => 25 );
is($artist, undef, "Rollback ok");
}
sub run_tests {
+my $schema = shift;
plan tests => 4;
$artist = DBICTest::Artist->find(1);
ok($artist->find_related('twokeys', {cd => 1}), "find multiple pks using relationships + args");
-ok(DBICTest->class("FourKeys")->find(1,2,3,4), "find multiple pks without hash");
-ok(DBICTest->class("FourKeys")->find(5,4,3,6), "find multiple pks without hash");
-is(DBICTest->class("FourKeys")->find(1,2,3,4)->ID, 'DBICTest::FourKeys|bar=2|foo=1|goodbye=4|hello=3', 'unique object id ok for multiple pks');
+ok($schema->class("FourKeys")->find(1,2,3,4), "find multiple pks without hash");
+ok($schema->class("FourKeys")->find(5,4,3,6), "find multiple pks without hash");
+is($schema->class("FourKeys")->find(1,2,3,4)->ID, 'DBICTest::FourKeys|bar=2|foo=1|goodbye=4|hello=3', 'unique object id ok for multiple pks');
}
sub run_tests {
+my $schema = shift;
use strict;
use warnings;
plan tests => 17;
# has_a test
-my $cd = DBICTest->class("CD")->find(4);
+my $cd = $schema->class("CD")->find(4);
my ($artist) = ($INC{'DBICTest/HelperRels'}
? $cd->artist
: $cd->search_related('artist'));
is($artist->name, 'Random Boy Band', 'has_a search_related ok');
# has_many test with an order_by clause defined
-$artist = DBICTest->class("Artist")->find(1);
+$artist = $schema->class("Artist")->find(1);
my @cds = ($INC{'DBICTest/HelperRels'}
? $artist->cds
: $artist->search_related('cds'));
is( $artist->count_related('cds'), 4, 'count_related ok' );
# set_from_related
-my $track = DBICTest->class("Track")->create( {
+my $track = $schema->class("Track")->create( {
trackid => 1,
cd => 3,
position => 98,
}
# update_from_related, the same as set_from_related, but it calls update afterwards
-$track = DBICTest->class("Track")->create( {
+$track = $schema->class("Track")->create( {
trackid => 2,
cd => 3,
position => 99,
} );
$track->update_from_related( cd => $cd );
-my $t_cd = (DBICTest->class("Track")->search( cd => 4, position => 99 ))[0]->cd;
+my $t_cd = ($schema->class("Track")->search( cd => 4, position => 99 ))[0]->cd;
if ($INC{'DBICTest/HelperRels.pm'}) { # except inflated object
is( $t_cd->cdid, 4, 'update_from_related ok' );
is( ($artist->search_related('cds'))[4]->title, 'Greatest Hits', 'find_or_create_related new record search ok' );
$artist->delete_related( cds => { title => 'Greatest Hits' });
-cmp_ok( DBICTest->class("CD")->search( title => 'Greatest Hits' ), '==', 0, 'delete_related ok' );
+cmp_ok( $schema->class("CD")->search( title => 'Greatest Hits' ), '==', 0, 'delete_related ok' );
SKIP: {
skip "relationship checking needs fixing", 1;
like($@, qr/join condition/, 'failed when creating a rel without join condition, ok');
# many_to_many helper test
-$cd = DBICTest->class("CD")->find(1);
+$cd = $schema->class("CD")->find(1);
my @producers = $cd->producers();
is( $producers[0]->name, 'Matt S Trout', 'many_to_many ok' );
# test undirected many-to-many relationship (e.g. "related artists")
-my $undir_maps = DBICTest->class("Artist")->find(1)->artist_undirected_maps;
+my $undir_maps = $schema->class("Artist")->find(1)->artist_undirected_maps;
is($undir_maps->count, 1, 'found 1 undirected map for artist 1');
-$undir_maps = DBICTest->class("Artist")->find(2)->artist_undirected_maps;
+$undir_maps = $schema->class("Artist")->find(2)->artist_undirected_maps;
is($undir_maps->count, 1, 'found 1 undirected map for artist 2');
my @art = $undir_maps->search_related('mapped_artists')->all;
sub run_tests {
+my $schema = shift;
plan tests => 12;
# first page
-my $it = DBICTest->class("CD")->search(
+my $it = $schema->class("CD")->search(
{},
{ order_by => 'title',
rows => 3,
is( $it->next, undef, "next past end of page ok" );
# second page, testing with array
-my @page2 = DBICTest->class("CD")->search(
+my @page2 = $schema->class("CD")->search(
{},
{ order_by => 'title',
rows => 3,
is( $page2[0]->title, "Generic Manufactured Singles", "second page first title ok" );
# page a standard resultset
-$it = DBICTest->class("CD")->search(
+$it = $schema->class("CD")->search(
{},
{ order_by => 'title',
rows => 3 }
is( $page->next->title, "Generic Manufactured Singles", "second page of standard resultset ok" );
# test software-based limit paging
-$it = DBICTest->class("CD")->search(
+$it = $schema->class("CD")->search(
{},
{ order_by => 'title',
rows => 3,
sub run_tests {
+my $schema = shift;
eval { require DateTime };
plan skip_all => "Need DateTime for inflation tests" if $@;
Class::C3->reinitialize;
# inflation test
-my $cd = DBICTest->class("CD")->find(3);
+my $cd = $schema->class("CD")->find(3);
is( ref($cd->year), 'DateTime', 'year is a DateTime, ok' );
$cd->year( $now );
$cd->update;
-($cd) = DBICTest->class("CD")->search( year => $now->year );
+($cd) = $schema->class("CD")->search( year => $now->year );
is( $cd->year->year, $now->year, 'deflate ok' );
}
sub run_tests {
+my $schema = shift;
eval { require DateTime };
plan skip_all => "Need DateTime for inflation tests" if $@;
Class::C3->reinitialize;
# inflation test
-my $cd = DBICTest->class("CD")->find(3);
+my $cd = $schema->class("CD")->find(3);
is( ref($cd->year), 'DateTime', 'year is a DateTime, ok' );
$cd->year( $now );
$cd->update;
-($cd) = DBICTest->class("CD")->search( year => $now->year );
+($cd) = $schema->class("CD")->search( year => $now->year );
is( $cd->year->year, $now->year, 'deflate ok' );
# re-test using alternate deflate syntax
-DBICTest->class("CD")->has_a( 'year', 'DateTime',
+$schema->class("CD")->has_a( 'year', 'DateTime',
inflate => sub { DateTime->new( year => shift ) },
deflate => 'year'
);
# inflation test
-$cd = DBICTest->class("CD")->find(3);
+$cd = $schema->class("CD")->find(3);
is( ref($cd->year), 'DateTime', 'year is a DateTime, ok' );
$cd->year( $now );
$cd->update;
-($cd) = DBICTest->class("CD")->search( year => $now->year );
+($cd) = $schema->class("CD")->search( year => $now->year );
is( $cd->year->year, $now->year, 'deflate ok' );
}
sub run_tests {
+my $schema = shift;
BEGIN {
eval "use DBD::SQLite";
plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 3);
}
-my $art = DBICTest->class("Artist")->find(1);
+my $art = $schema->class("Artist")->find(1);
isa_ok $art => 'DBICTest::Artist';
sub run_tests {
+my $schema = shift;
plan tests => 2;
-DBICTest->class("Artist")->load_components(qw/PK::Auto::SQLite/);
+$schema->class("Artist")->load_components(qw/PK::Auto::SQLite/);
# add an artist without primary key to test Auto
-my $artist = DBICTest->class("Artist")->create( { name => 'Auto' } );
+my $artist = $schema->class("Artist")->create( { name => 'Auto' } );
$artist->name( 'Auto Change' );
ok($artist->update, 'update on object created without PK ok');
sub run_tests {
+my $schema = shift;
my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_MYSQL_${_}" } qw/DSN USER PASS/};
sub run_tests {
+my $schema = shift;
my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_PG_${_}" } qw/DSN USER PASS/};
sub run_tests {
+my $schema = shift;
my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_ORA_${_}" } qw/DSN USER PASS/};
-sub run_tests {\r
+sub run_tests {
+my $schema = shift;\r
\r
my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_MSSQL_${_}" } qw/DSN USER PASS/};\r
\r
\r
plan tests => 4;\r
\r
-DBICTest->class("Schema")->compose_connection( 'MSSQLTest' => $dsn, $user, $pass );\r
+$schema->class("Schema")->compose_connection( 'MSSQLTest' => $dsn, $user, $pass );\r
\r
my $dbh = MSSQLTest::Artist->storage->dbh;\r
\r
sub run_tests {
+my $schema = shift;
BEGIN {
eval "use DBD::SQLite";
}
# test LIMIT
-my $it = DBICTest->class("CD")->search( {},
+my $it = $schema->class("CD")->search( {},
{ rows => 3,
order_by => 'title' }
);
is( $it->next, undef, "next past end of resultset ok" );
# test OFFSET
-my @cds = DBICTest->class("CD")->search( {},
+my @cds = $schema->class("CD")->search( {},
{ rows => 2,
offset => 2,
order_by => 'year' }
is( $cds[0]->title, "Spoonful of bees", "offset ok" );
# test software-based limiting
-$it = DBICTest->class("CD")->search( {},
+$it = $schema->class("CD")->search( {},
{ rows => 3,
software_limit => 1,
order_by => 'title' }
$it->next;
is( $it->next, undef, "software next past end of resultset ok" );
-@cds = DBICTest->class("CD")->search( {},
+@cds = $schema->class("CD")->search( {},
{ rows => 2,
offset => 2,
software_limit => 1,
# based on a failing criteria submitted by waswas
# requires SQL::Abstract >= 1.20
-$it = DBICTest->class("CD")->search(
+$it = $schema->class("CD")->search(
{ title => [
-and =>
{
sub run_tests {
+my $schema = shift;
use IO::File;
is( $sa->_recurse_from(@j3), $match, 'join 3 (inner join) ok');
-my $rs = DBICTest->class("CD")->search(
+my $rs = $schema->class("CD")->search(
{ 'year' => 2001, 'artist.name' => 'Caterwauler McCrae' },
{ from => [ { 'me' => 'cd' },
[
is($rs->first->title, 'Forkful of bees', 'Correct record returned');
-$rs = DBICTest->class("CD")->search(
+$rs = $schema->class("CD")->search(
{ 'year' => 2001, 'artist.name' => 'Caterwauler McCrae' },
{ join => 'artist' });
is($rs->first->title, 'Forkful of bees', 'Correct record returned');
-$rs = DBICTest->class("CD")->search(
+$rs = $schema->class("CD")->search(
{ 'artist.name' => 'We Are Goth',
'liner_notes.notes' => 'Kill Yourself!' },
{ join => [ qw/artist liner_notes/ ] });
is($rs->first->title, 'Come Be Depressed With Us', 'Correct record returned');
# when using join attribute, make sure slice()ing all objects has same count as all()
-$rs = DBICTest->class("CD")->search(
+$rs = $schema->class("CD")->search(
{ 'artist' => 1 },
{ join => [qw/artist/], order_by => 'artist.name' }
);
cmp_ok( scalar $rs->all, '==', scalar $rs->slice(0, $rs->count - 1), 'slice() with join has same count as all()' );
-$rs = DBICTest->class("Artist")->search(
+$rs = $schema->class("Artist")->search(
{ 'liner_notes.notes' => 'Kill Yourself!' },
{ join => { 'cds' => 'liner_notes' } });
is($rs->first->name, 'We Are Goth', 'Correct record returned');
-$rs = DBICTest->class("CD")->search(
+$rs = $schema->class("CD")->search(
{ 'artist.name' => 'Caterwauler McCrae' },
{ prefetch => [ qw/artist liner_notes/ ],
order_by => 'me.cdid' });
unlink 't/var/dbic.trace';
is($selects, 1, 'prefetch ran only 1 select statement');
-my ($artist) = DBICTest->class("Artist")->search({ 'cds.year' => 2001 },
+my ($artist) = $schema->class("Artist")->search({ 'cds.year' => 2001 },
{ order_by => 'artistid DESC', join => 'cds' });
is($artist->name, 'Random Boy Band', "Join search by object ok");
-my @cds = DBICTest->class("CD")->search({ 'liner_notes.notes' => 'Buy Merch!' },
+my @cds = $schema->class("CD")->search({ 'liner_notes.notes' => 'Buy Merch!' },
{ join => 'liner_notes' });
cmp_ok(scalar @cds, '==', 1, "Single CD retrieved via might_have");
is($cds[0]->title, "Generic Manufactured Singles", "Correct CD retrieved");
-my @artists = DBICTest->class("Artist")->search({ 'tags.tag' => 'Shiny' },
+my @artists = $schema->class("Artist")->search({ 'tags.tag' => 'Shiny' },
{ join => { 'cds' => 'tags' } });
cmp_ok( @artists, '==', 2, "two-join search ok" );
sub run_tests {
+my $schema = shift;
eval "use DBD::SQLite";
plan skip_all => 'needs DBD::SQLite for testing' if $@;
plan tests => 4;
-cmp_ok(DBICTest->class("CD")->count({ 'artist.name' => 'Caterwauler McCrae' },
+cmp_ok($schema->class("CD")->count({ 'artist.name' => 'Caterwauler McCrae' },
{ join => 'artist' }),
'==', 3, 'Count by has_a ok');
-cmp_ok(DBICTest->class("CD")->count({ 'tags.tag' => 'Blue' }, { join => 'tags' }),
+cmp_ok($schema->class("CD")->count({ 'tags.tag' => 'Blue' }, { join => 'tags' }),
'==', 4, 'Count by has_many ok');
-cmp_ok(DBICTest->class("CD")->count(
+cmp_ok($schema->class("CD")->count(
{ 'liner_notes.notes' => { '!=' => undef } },
{ join => 'liner_notes' }),
'==', 3, 'Count by might_have ok');
-cmp_ok(DBICTest->class("CD")->count(
+cmp_ok($schema->class("CD")->count(
{ 'year' => { '>', 1998 }, 'tags.tag' => 'Cheesy',
'liner_notes.notes' => { 'like' => 'Buy%' } },
{ join => [ qw/tags liner_notes/ ] } ),
-sub run_tests {\r
+sub run_tests {
+my $schema = shift;\r
\r
# this test will check to see if you can have 2 columns\r
# in the same class pointing at the same other class\r
\r
plan tests => 4;\r
\r
-my $item = DBICTest->class("SelfRef")->find( 1 );\r
+my $item = $schema->class("SelfRef")->find( 1 );\r
is( $item->name, 'First', 'proper start item' );\r
\r
my @aliases = $item->aliases;\r
sub run_tests {
+my $schema = shift;
eval 'use Data::UUID ; 1'
or plan skip_all, 'Install Data::UUID run this test';
DBICTest::Schema::Artist->uuid_columns('name');
Class::C3->reinitialize();
-my $artist = DBICTest->class("Artist")->create( { artistid => 100 } );
+my $artist = $schema->class("Artist")->create( { artistid => 100 } );
like $artist->name, qr/[\w-]{36}/, 'got something like uuid';
}