public function testOneMissedSimpleGet()
{
// 模拟数据库返回查询未命中缓存的数据
$this->conn->shouldReceive('select')->with('select * from "user" where "id" in (?) limit 1', [1], true)->andReturn([(object) ['id' => 1, 'name' => '海涛']]);
// 模拟缓存查询结果
$this->cache->shouldReceive('set')->with(['3558193cd9818af7fe4d2c2f5bd9d00f' => (object) ['id' => 1, 'name' => '海涛']]);
$this->cache->shouldReceive('get')->with(['3558193cd9818af7fe4d2c2f5bd9d00f'])->andReturn([]);
$dispatcher = M::Mock(Dispatcher::class);
$dispatcher->shouldReceive('fire')->with('angejia.pea.get', ['table' => 'user', 'db' => 'angejia']);
$dispatcher->shouldReceive('fire')->with('angejia.pea.miss.simple', ['table' => 'user', 'db' => 'angejia']);
$this->app->instance(Dispatcher::class, $dispatcher);
// 查询 id 为 1 的记录,应该命中缓存
$u1 = User::find(1);
$this->assertEquals('海涛', $u1->name);
}