|
Lines 61-67
$quote = GetDailyQuote('random'=>1);
Link Here
|
| 61 |
ok($quote, "Got a random quote."); |
61 |
ok($quote, "Got a random quote."); |
| 62 |
cmp_ok($quote->{'id'}, '>', 0, 'Id is greater than 0'); |
62 |
cmp_ok($quote->{'id'}, '>', 0, 'Id is greater than 0'); |
| 63 |
|
63 |
|
| 64 |
my $timestamp = DateTime::Format::MySQL->format_datetime(dt_from_string->add( hours => 1 )); # To make it the last one |
64 |
my $timestamp = DateTime::Format::MySQL->format_datetime(dt_from_string->add( seconds => 1 )); # To make it the last one |
| 65 |
my $query = 'UPDATE quotes SET timestamp = ? WHERE id = ?'; |
65 |
my $query = 'UPDATE quotes SET timestamp = ? WHERE id = ?'; |
| 66 |
my $sth = C4::Context->dbh->prepare($query); |
66 |
my $sth = C4::Context->dbh->prepare($query); |
| 67 |
$sth->execute( $timestamp , $expected_quote->{'id'}); |
67 |
$sth->execute( $timestamp , $expected_quote->{'id'}); |
|
Lines 70-76
$expected_quote->{'timestamp'} = $timestamp;
Link Here
|
| 70 |
|
70 |
|
| 71 |
$quote = GetDailyQuote(); # this is the "default" mode of selection |
71 |
$quote = GetDailyQuote(); # this is the "default" mode of selection |
| 72 |
cmp_ok($quote->{'id'}, '==', $expected_quote->{'id'}, "Id is correct"); |
72 |
cmp_ok($quote->{'id'}, '==', $expected_quote->{'id'}, "Id is correct"); |
| 73 |
is($quote->{'quote'}, $expected_quote->{'quote'}, "Quote is correct"); |
73 |
is($quote->{'source'}, $expected_quote->{'source'}, "Source is correct"); |
| 74 |
is($quote->{'timestamp'}, $expected_quote->{'timestamp'}, "Timestamp $timestamp is correct"); |
74 |
is($quote->{'timestamp'}, $expected_quote->{'timestamp'}, "Timestamp $timestamp is correct"); |
| 75 |
|
75 |
|
| 76 |
$dbh->do(q|DELETE FROM quotes|); |
76 |
$dbh->do(q|DELETE FROM quotes|); |
| 77 |
- |
|
|