Tap::ok($found, 'returned only rows we created');
$owned = TRUE;
foreach ($ids as $id) {
    if ($listings[$id]->seller == $seller_id) {
        continue;
    }
    $owned = FALSE;
    break;
}
Tap::ok($owned, 'search returned only rows created by the seller');
$sorted_ids = $ids;
sort($sorted_ids);
Tap::is($ids, $sorted_ids, 'the ids are sorted in the correct order');
$res = $souk->fetch($ids);
Tap::is(array_keys($res), $ids, 'fetch returns results sorted in the same order as the ids we passed in');
cachemock()->flush();
$res = $souk->fetch($ids);
Tap::is(array_keys($res), $ids, 'flushing the cache doesnt change anything');
$ids = souk($app)->search(array('sort' => 'just_added', 'item_id' => $item_id, 'seller' => $seller_id));
Tap::cmp_ok(count($ids), '>', 12, 'search found results');
$found = TRUE;
foreach ($ids as $id) {
    if (isset($listings[$id])) {
        continue;
    }
    $found = FALSE;
    break;
}
Tap::ok($found, 'returned only rows we created');
$ids_array_search = souk($app)->search(array('sort' => 'just_added', 'item_id' => array($item_id, 0), 'seller' => array($seller_id, 0)));
Tap::is($ids_array_search, $ids, 'item and seller array search works');
Exemplo n.º 2
0
function souk($app, $user_id = NULL)
{
    return new Gaia\Souk\Cacher(new Gaia\Souk($app, $user_id), cachemock());
}