11 plan skip_all => 'Test needs ' .
12 DBIx::Class::Optional::Dependencies->req_missing_for('deploy')
13 unless DBIx::Class::Optional::Dependencies->req_ok_for('deploy');
17 = PrefetchBug->connect( DBICTest->_database (quote_char => '"') );
18 ok( $schema, 'Connected to PrefetchBug schema OK' );
20 #################### DEPLOY
22 $schema->deploy( { add_drop_table => 1 } );
24 # Test simple has_many prefetch:
26 my $leftc = $schema->resultset('Left')->create({});
27 my $rightc = $schema->resultset('Right')->create({ id => 60, name => 'Johnny', category => 'something', description=> 'blah', propagates => 0, locked => 1 });
28 $rightc->create_related('prefetch_leftright', { left => $leftc, value => 'lr' });
30 # start with fresh whatsit
31 my $left = $schema->resultset('Left')->find({ id => $leftc->id });
33 my @left_rights = $left->search_related('prefetch_leftright', {}, { prefetch => 'right' });
34 ok(defined $left_rights[0]->right, 'Prefetched Right side correctly');