once()->with(5)->andReturnUsing(static function () use (&$order) { $order[] = 'save'; return 811; }); Functions\expect('wp_get_post_revisions')->once()->with(5, ['posts_per_page' => 1]) ->andReturnUsing(static function () use (&$order): array { $order[] = 'latest'; return [811 => new WP_Post(['ID' => 811, 'post_type' => 'revision'])]; }); self::assertSame(811, RevisionPoint::capture(5)); self::assertSame(['save', 'latest'], $order); } public function testLatestIsNullWithoutRevisions(): void { Functions\when('wp_get_post_revisions')->justReturn([]); self::assertNull(RevisionPoint::latest(5)); } }