/** * @test */ public function runClosureConversion() { $key = 'sha'; $value = 'rvoweicoewicjwoi102931029380921oimi1m3'; $function = function ($data) use($value) { return $data == $value; }; $hash = spl_object_hash($function); $validator = new ValidatorService([$key => $value]); $validator->setRule($key, 'Commit SHA', ['required', 'maxLength[800]', 'alphaNumeric', $function]); $this->assertTrue($validator->run()); $rules = $validator->getRulesProvider(); $container = $rules->getRule($hash); $this->assertSame($function, $container->getClosure()); }