withCookieParams([ 'num' => '-1.2', 'int' => '414', 'bool' => 'true', ]); $validator = (new ValidatorBuilder())->fromYamlFile($this->apiSpecFile)->getServerRequestValidator(); $validator->validate($request); $this->addToAssertionCount(1); } /** * @return mixed[][] */ public function dataProviderCookiesRed() : array { return [ ['num', '-'], ['num', 'ac'], ['int', 'ac'], ['int', '1.0'], ['bool', '1'], ['bool', 'yes'], ['bool', ''], ]; } /** * @dataProvider dataProviderCookiesRed */ public function testItDeserializesServerRequestCookieParametersRed(string $cookieName, string $cookieValue) : void { $request = (new ServerRequest('get', new Uri('/deserialize-cookies'))) ->withCookieParams([$cookieName => $cookieValue]); $validator = (new ValidatorBuilder())->fromYamlFile($this->apiSpecFile)->getServerRequestValidator(); $this->expectException(InvalidCookies::class); $this->expectExceptionMessage( sprintf('Value "%s" for cookie "%s" is invalid for Request [get /deserialize-cookies]', $cookieValue, $cookieName) ); $validator->validate($request); } }