createStub(Service::class)); $live->existing = [5]; (new ReflectionProperty(Service::class, 'liveService'))->setValue($service, $live); $result = $service->entityExtant('INBOX', 5, '6', 'abc', 0); $this->assertSame([5 => true, 6 => false, 'abc' => false, 0 => false], $result); $this->assertSame([['INBOX', [5, 6]]], $live->extantCalls); } } final class ServiceTestLiveStub extends LiveMailService { /** @var int[] */ public array $existing = []; public array $extantCalls = []; public function entityExtant(string $collection, int ...$uids): array { $this->extantCalls[] = [$collection, $uids]; return array_values(array_intersect($uids, $this->existing)); } }