public function testFetch()
{
list($conn, $keygen, $query) = $this->getMocks();
$instance = new DraftRepository($conn, $keygen);
$conn->shouldReceive('table')->andReturn($query);
$query->shouldReceive('where')->once()->with('userId', 'userId')->andReturnSelf();
$query->shouldReceive('where')->once()->with('key', 'someKey')->andReturnSelf();
$query->shouldReceive('get')->once()->andReturn([['id' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', 'key' => 'someKey', 'val' => 'qux', 'etc' => 'a:1:{s:3:"foo";s:3:"bar";}'], ['id' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxy', 'key' => 'someKey', 'val' => 'qux1', 'etc' => 'a:1:{s:3:"foo";s:3:"baz";}']]);
$drafts = $instance->fetch(['userId' => 'userId', 'key' => 'someKey']);
$this->assertEquals(2, count($drafts));
}