function test_query() { $infos = Test\Info::take(4); $first_info = $infos[0]; $this->assertEquals("info", $first_info->post_type); $this->assertEquals("publish", $first_info->post_status); $first_info->set_meta("show_at_home", true); $this->assertCount(1, Test\Info::all("meta_key=show_at_home&meta_value=1")); $rs = []; $query = ["meta_query" => [["key" => "show_at_home", "value" => "1"]]]; foreach (Test\Info::where($query) as $info) { $rs[] = $info->show_at_home; } $this->assertCount(1, $rs); $this->assertEquals("1", $rs[0]); $this->assertEquals("info", Test\Info::take([])->post_type); }