and run the passing tests as real tests.
);
ok ($schema->storage->connected, 'Still connected');
{
- local $TODO = 'SQLite is retarded wrt detecting COMMIT' if $c_commit;
+ local $TODO = 'SQLite is retarded wrt detecting COMMIT' if $c_commit and ! $c_begin;
ok ($schema->storage->_dbh->{AutoCommit}, "DBD aware txn ended with comments on $prefix_comment");
}
};
is $@, '', "No errors";
-TODO: { local $TODO = 'TODOifying failing tests, waiting for Schwern'; ok (1, 'remove me');
eval {
my $data = { %$data };
$data->{NumExplodingSheep} = 3;
ok my $bt = Film->find_or_create($data),
"find_or_create Modified accessor - create with column name";
isa_ok $bt, "Film";
+
+ local $TODO = 'TODOifying failing tests, waiting for Schwern';
is $bt->sheep, 3, 'sheep bursting violently';
};
is $@, '', "No errors";
ok my $bt = Film->find_or_create($data),
"find_or_create Modified accessor - create with accessor";
isa_ok $bt, "Film";
+
+ local $TODO = 'TODOifying failing tests, waiting for Schwern';
is $bt->sheep, 4, 'sheep bursting violently';
};
is $@, '', "No errors";
my @film = Film->search({ sheep => 1 });
is @film, 2, "Can search with modified accessor";
};
-is $@, '', "No errors";
-
+{
+ local $TODO = 'TODOifying failing tests, waiting for Schwern';
+ is $@, '', "No errors";
}
{
#
# ribasushi
-TODO: { my $f = __FILE__; local $TODO = "See comment at top of $f for discussion of the TODO";
+my $TODO_msg = "See comment at top of @{[ __FILE__ ]} for discussion of the TODO";
{
my $counts;
$counts->{$_} = $schema->resultset($_)->count for qw/Track CD Genre/;
- lives_ok (sub {
- my $existing_nogen_cd = $schema->resultset('CD')->search (
- { 'genre.genreid' => undef },
- { join => 'genre' },
- )->first;
-
- $schema->resultset('Track')->create ({
- title => 'Sugar-coated',
- cd => {
- title => $existing_nogen_cd->title,
- genre => {
- name => 'sugar genre',
- }
+ my $existing_nogen_cd = $schema->resultset('CD')->search (
+ { 'genre.genreid' => undef },
+ { join => 'genre' },
+ )->first;
+
+ $schema->resultset('Track')->create ({
+ title => 'Sugar-coated',
+ cd => {
+ title => $existing_nogen_cd->title,
+ genre => {
+ name => 'sugar genre',
}
- });
+ }
+ });
- is ($schema->resultset('Track')->count, $counts->{Track} + 1, '1 new track');
- is ($schema->resultset('CD')->count, $counts->{CD}, 'No new cds');
- is ($schema->resultset('Genre')->count, $counts->{Genre} + 1, '1 new genre');
+ is ($schema->resultset('Track')->count, $counts->{Track} + 1, '1 new track');
+ is ($schema->resultset('CD')->count, $counts->{CD}, 'No new cds');
+ TODO: {
+ todo_skip $TODO_msg, 1;
+ is ($schema->resultset('Genre')->count, $counts->{Genre} + 1, '1 new genre');
is ($existing_nogen_cd->genre->title, 'sugar genre', 'Correct genre assigned to CD');
- }, 'create() did not throw');
+ }
}
+
{
my $counts;
$counts->{$_} = $schema->resultset($_)->count for qw/Artist CD Producer/;
is ($schema->resultset('Artist')->count, $counts->{Artist}, 'No new artists');
is ($schema->resultset('Producer')->count, $counts->{Producer} + 1, '1 new producers');
+
+ local $TODO = $TODO_msg;
is ($schema->resultset('CD')->count, $counts->{CD} + 2, '2 new cds');
is ($producer->cds->count, 2, 'CDs assigned to correct producer');
}, 'create() did not throw');
}
-}
-
done_testing;
use Test::More;
use lib qw(t/lib);
use DBICTest;
-use IO::File;
my $schema = DBICTest->init_schema();
my $sdebug = $schema->storage->debug;
ok(! $o_mm_warn, 'no warning on attempt to prefetch several same level has_many\'s (1 -> M + M)');
+ {
+ local $TODO;
is($queries, 1, 'prefetch one->(has_many,has_many) ran exactly 1 query');
+ }
$schema->storage->debugcb (undef);
$schema->storage->debug ($sdebug);
ok(! $m_o_mm_warn, 'no warning on attempt to prefetch several same level has_many\'s (M -> 1 -> M + M)');
+ {
+ local $TODO;
+
is($queries, 1, 'prefetch one->(has_many,has_many) ran exactly 1 query');
$schema->storage->debugcb (undef);
$schema->storage->debug ($sdebug);
is($pr_tags_count, $tags_count, 'equal count of prefetched relations over several same level has_many\'s (M -> 1 -> M + M)');
is($pr_tags_rs->all, $tags_rs->all, 'equal amount of objects with and without prefetch over several same level has_many\'s (M -> 1 -> M + M)');
+ }
}
# remove this closure once the TODO above is working
is($rs->count, 1, 'distinct with prefetch (count)');
TODO: {
- local $TODO = "This makes another 2 trips to the database, it can't be right";
-
$queries = 0;
$schema->storage->debugcb ($debugcb);
$schema->storage->debug (1);
is($rs->search_related('cds')->all, 2, 'prefetched distinct with prefetch (objects)');
is($rs->search_related('cds')->count, 2, 'prefetched distinct with prefetch (count)');
+ local $TODO = "This makes another 2 trips to the database, it can't be right";
is ($queries, 0, 'No extra queries fired (prefetch survives search_related)');
$schema->storage->debugcb (undef);
);
TODO: {
- local $TODO = 'New objects should also be inflated';
my $user = $schema->resultset('User')->create($user_data);
my $admin = $schema->resultset('User')->create($admin_data);
is( ref $user, 'My::Schema::Result::User' );
+ local $TODO = 'New objects should also be inflated';
is( ref $admin, 'My::Schema::Result::User::Admin' );
}