forked from dnorman/perl-DBR
-
Notifications
You must be signed in to change notification settings - Fork 1
/
rt_40.t
35 lines (26 loc) · 972 Bytes
/
rt_40.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/perl
use strict;
$| = 1;
use lib './lib';
use t::lib::Test;
use Test::More tests => 14;
use DBR::Config::Scope;
my $dbr = setup_schema_ok('rt_40');
my $dbh = $dbr->connect('rt_40');
ok($dbh, 'dbr connect');
my $rv;
# Repeat the whole test twice to test both query modes (Unregistered and Prefetch)
for my $ct (1..2){
my $albums = $dbh->album->where(
'artist.name' => 'Artist A'
);
ok( defined($albums) , 'select albums where artist.name = "Artist A"');
# this will loop four times
while (my $album = $albums->next()) {
ok( $album->date_released, 'fetch date_released' );
ok ( $album->date_released( 'now' ) , '->date_released("now")' ); # Do it nowwwww
ok ( $album->set( date_released => 'now' ) , 'set(date_released => "now")'); # Do it nowwwww
ok($album->name, 'fetch name');
ok ( $album->set( name => 'New name' ) , 'set(name => "New name")'); # Do it nowwwww
}
}