$rows = $stockpile->history(array('limit' => 1));
Tap::is($rows[0]['event'], 'halloween', 'add an item with meta information. the information shows up in the log');
$stockpile->subtract($item_id, 1, array('event' => 'xmas'));
$txn->commit();
$rows = $stockpile->history(array('limit' => 1));
Tap::is($rows[0]['event'], 'xmas', 'subtract an item with meta information. the information shows up in the log');
$user_id = uniqueUserID();
$item_id = uniqueNumber(1, 1000000);
$txn = txn();
$stockpile = stockpile($app, $user_id, $txn);
$stockpile->add($item_id, 1, array('event' => $teststring = 'äó'));
$txn->commit();
$rows = $stockpile->history(array('item_id' => $item_id, 'limit' => 1));
Tap::is($rows[0]['event'], $teststring, 'utf8 characters come through');
$user_id = uniqueUserID();
$item_id = uniqueNumber(1, 1000000);
$txn = txn();
$stockpile = stockpile($app, $user_id, $txn);
for ($i = 0; $i < 20; $i++) {
    $stockpile->add($item_id, $i + 1);
    advanceCurrentTime(3600 * 12);
}
$txn->commit();
$diff = abs(count($history = $stockpile->history()) - 14);
Tap::cmp_ok($diff, '<', 2, 'after logging two entries a day over 10 days, we get back only 7 days worth of data');
$start = $history[0]['touch'];
$last_row = array_pop($history);
$end = $last_row['touch'];
$diff = abs(floor(($start - $end) / (3600 * 24)));
Tap::cmp_ok($diff, '>', 5, 'the timestamps in the data span 6 or 7 days');