repository = new CacheFunctionDefinitionRepository( new FakeFunctionDefinitionRepository(), new FakeCache() ); } public function test_function_is_saved_in_cache(): void { $callableA = fn (): int => 42; $callableB = fn (): int => 1337; $functionA = $this->repository->for($callableA); $functionB = $this->repository->for($callableA); $functionC = $this->repository->for($callableB); self::assertSame($functionA, $functionB); self::assertNotSame($functionA, $functionC); } }