From 8e466ad9a11bea78357bc10c023460182e1ec757 Mon Sep 17 00:00:00 2001 From: davidspeijer Date: Sun, 24 Jan 2021 15:32:22 +0100 Subject: [PATCH 1/6] Update bootstrap.php Validator::errors()` is deprecated. Use `Validator::validate()` instead. --- config/bootstrap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/bootstrap.php b/config/bootstrap.php index 42f59b9..8fdcc2b 100644 --- a/config/bootstrap.php +++ b/config/bootstrap.php @@ -17,7 +17,7 @@ // Validate the Configure Data $validator = new ConfigValidator(); -$errors = $validator->errors(Configure::read('Recaptcha')); +$errors = $validator->validate(Configure::read('Recaptcha')); if (!empty($errors)) { $errMsg = ''; From bc5cd1aa7076aeb2689a25b9d0ef27ba42e73714 Mon Sep 17 00:00:00 2001 From: davidspeijer Date: Sun, 24 Jan 2021 15:35:39 +0100 Subject: [PATCH 2/6] Update RecaptchaHelper.php `Validator::errors()` is deprecated. Use `Validator::validate()` instead. --- src/View/Helper/RecaptchaHelper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/View/Helper/RecaptchaHelper.php b/src/View/Helper/RecaptchaHelper.php index 7886f22..017c2e3 100644 --- a/src/View/Helper/RecaptchaHelper.php +++ b/src/View/Helper/RecaptchaHelper.php @@ -67,7 +67,7 @@ public function __construct(View $view, $config = []) } // Validate the Configure Data $validator = new RecaptchaValidator(); - $errors = $validator->errors($this->getConfig()); + $errors = $validator->validate($this->getConfig()); if (!empty($errors)) { throw new \Exception(__d('recaptcha', 'One of your recaptcha config value is incorrect')); // throw an exception with config error that is raised From 92d872e9db0fc29425c932c469e60d8fea20d42b Mon Sep 17 00:00:00 2001 From: davidspeijer Date: Mon, 1 Feb 2021 12:56:18 +0100 Subject: [PATCH 3/6] Update RecaptchaHelper.php `Validator::errors()` is deprecated. Use `Validator::validate()` instead. --- src/View/Helper/RecaptchaHelper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/View/Helper/RecaptchaHelper.php b/src/View/Helper/RecaptchaHelper.php index 017c2e3..202c59d 100644 --- a/src/View/Helper/RecaptchaHelper.php +++ b/src/View/Helper/RecaptchaHelper.php @@ -95,7 +95,7 @@ public function display(array $options = []) // Validate the Configure Data $validator = new RecaptchaValidator(); - $errors = $validator->errors($options); + $errors = $validator->validate($options); if (!empty($errors)) { throw new \Exception(__d('recaptcha', 'One of your recaptcha config value is incorrect')); // throw an exception with config error that is raised @@ -137,7 +137,7 @@ public function widget(array $options = []) // Validate the Configure Data $validator = new RecaptchaValidator(); - $errors = $validator->errors($options); + $errors = $validator->validate($options); if (!empty($errors)) { throw new \Exception(__d('recaptcha', 'One of your recaptcha config value is incorrect in a widget')); // throw an exception with config error that is raised From 3b31e3abe58b7ce79318d7453bd65c4092dce021 Mon Sep 17 00:00:00 2001 From: davidspeijer Date: Mon, 1 Feb 2021 12:58:22 +0100 Subject: [PATCH 4/6] Update ConfigValidatorTest.php `Validator::errors()` is deprecated. Use `Validator::validate()` instead. --- .../Validation/ConfigValidatorTest.php | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/TestCase/Validation/ConfigValidatorTest.php b/tests/TestCase/Validation/ConfigValidatorTest.php index 31faea1..fa64eab 100644 --- a/tests/TestCase/Validation/ConfigValidatorTest.php +++ b/tests/TestCase/Validation/ConfigValidatorTest.php @@ -26,22 +26,22 @@ public function testConfigValidationWithMissingSecretParam() { $validator = new ConfigValidator(); $data = ['lang' => 'fr']; - $errors = $validator->errors($data); + $errors = $validator->validate($data); $this->assertArrayHasKey('secret', $errors); $validator = new ConfigValidator(); $data = ['theme' => 'light']; - $errors = $validator->errors($data); + $errors = $validator->validate($data); $this->assertArrayHasKey('secret', $errors); $validator = new ConfigValidator(); $data = ['type' => 'image']; - $errors = $validator->errors($data); + $errors = $validator->validate($data); $this->assertArrayHasKey('secret', $errors); $validator = new ConfigValidator(); $data = ['size' => 'normal']; - $errors = $validator->errors($data); + $errors = $validator->validate($data); $this->assertArrayHasKey('secret', $errors); } @@ -54,22 +54,22 @@ public function testConfigValidationWithExistingParams() { $validator = new ConfigValidator(); $data = ['secret' => 'fff', 'lang' => 'fr']; - $errors = $validator->errors($data); + $errors = $validator->validate($data); $this->assertEmpty($errors); $validator = new ConfigValidator(); $data = ['secret' => 'fff', 'theme' => 'light']; - $errors = $validator->errors($data); + $errors = $validator->validate($data); $this->assertEmpty($errors); $validator = new ConfigValidator(); $data = ['secret' => 'fff', 'type' => 'image']; - $errors = $validator->errors($data); + $errors = $validator->validate($data); $this->assertEmpty($errors); $validator = new ConfigValidator(); $data = ['secret' => 'fff', 'size' => 'normal']; - $errors = $validator->errors($data); + $errors = $validator->validate($data); $this->assertEmpty($errors); } @@ -82,22 +82,22 @@ public function testConfigValidationWithNonExistingParams() { $validator = new ConfigValidator(); $data = ['secret' => 'fff', 'lang' => 'non-existing-lang']; - $errors = $validator->errors($data); + $errors = $validator->validate($data); $this->assertArrayHasKey('lang', $errors); $validator = new ConfigValidator(); $data = ['secret' => 'fff', 'theme' => 'non-existing-theme']; - $errors = $validator->errors($data); + $errors = $validator->validate($data); $this->assertArrayHasKey('theme', $errors); $validator = new ConfigValidator(); $data = ['secret' => 'fff', 'type' => 'non-existing-type']; - $errors = $validator->errors($data); + $errors = $validator->validate($data); $this->assertArrayHasKey('type', $errors); $validator = new ConfigValidator(); $data = ['secret' => 'fff', 'size' => 'non-existing-size']; - $errors = $validator->errors($data); + $errors = $validator->validate($data); $this->assertArrayHasKey('size', $errors); } From b69e1395f2325d1e08f6941c346ac5ae09481cde Mon Sep 17 00:00:00 2001 From: davidspeijer Date: Mon, 1 Feb 2021 12:59:26 +0100 Subject: [PATCH 5/6] Update GlobalValidatorTest.php `Validator::errors()` is deprecated. Use `Validator::validate()` instead. --- .../Validation/GlobalValidatorTest.php | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/TestCase/Validation/GlobalValidatorTest.php b/tests/TestCase/Validation/GlobalValidatorTest.php index 031f100..f04c005 100644 --- a/tests/TestCase/Validation/GlobalValidatorTest.php +++ b/tests/TestCase/Validation/GlobalValidatorTest.php @@ -26,22 +26,22 @@ public function testGlobalValidationWithExistingParams() { $validator = new GlobalValidator(); $data = ['lang' => 'fr']; - $errors = $validator->errors($data); + $errors = $validator->validate($data); $this->assertEmpty($errors); $validator = new GlobalValidator(); $data = ['theme' => 'light']; - $errors = $validator->errors($data); + $errors = $validator->validate($data); $this->assertEmpty($errors); $validator = new GlobalValidator(); $data = ['type' => 'image']; - $errors = $validator->errors($data); + $errors = $validator->validate($data); $this->assertEmpty($errors); $validator = new GlobalValidator(); $data = ['size' => 'normal']; - $errors = $validator->errors($data); + $errors = $validator->validate($data); $this->assertEmpty($errors); } @@ -54,22 +54,22 @@ public function testGlobalValidationWithNonExistingParams() { $validator = new GlobalValidator(); $data = ['lang' => 'non-existing-lang']; - $errors = $validator->errors($data); + $errors = $validator->validate($data); $this->assertArrayHasKey('lang', $errors); $validator = new GlobalValidator(); $data = ['theme' => 'non-existing-theme']; - $errors = $validator->errors($data); + $errors = $validator->validate($data); $this->assertArrayHasKey('theme', $errors); $validator = new GlobalValidator(); $data = ['type' => 'non-existing-type']; - $errors = $validator->errors($data); + $errors = $validator->validate($data); $this->assertArrayHasKey('type', $errors); $validator = new GlobalValidator(); $data = ['size' => 'non-existing-size']; - $errors = $validator->errors($data); + $errors = $validator->validate($data); $this->assertArrayHasKey('size', $errors); } @@ -87,7 +87,7 @@ public function testGlobalValidationWithBlockOfExistingParams() 'type' => 'audio', 'size' => 'compact' ]; - $errors = $validator->errors($data); + $errors = $validator->validate($data); $this->assertEmpty($errors); } @@ -105,7 +105,7 @@ public function testGlobalValidationWithBlockOfNonExistingParams() 'type' => 'non-existing-type', 'size' => 'non-existing-size' ]; - $errors = $validator->errors($data); + $errors = $validator->validate($data); $this->assertArrayHasKey('lang', $errors); $this->assertArrayHasKey('theme', $errors); $this->assertArrayHasKey('type', $errors); From d497d016ad9a7f01a470bb10f3db151fb35e4cca Mon Sep 17 00:00:00 2001 From: davidspeijer Date: Mon, 1 Feb 2021 13:00:02 +0100 Subject: [PATCH 6/6] Update RecaptchaValidatorTest.php `Validator::errors()` is deprecated. Use `Validator::validate()` instead. --- .../Validation/RecaptchaValidatorTest.php | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/TestCase/Validation/RecaptchaValidatorTest.php b/tests/TestCase/Validation/RecaptchaValidatorTest.php index 87b7b18..8eef070 100644 --- a/tests/TestCase/Validation/RecaptchaValidatorTest.php +++ b/tests/TestCase/Validation/RecaptchaValidatorTest.php @@ -26,22 +26,22 @@ public function testRecaptchaValidationWithExistingParams() { $validator = new RecaptchaValidator(); $data = ['lang' => 'fr']; - $errors = $validator->errors($data); + $errors = $validator->validate($data); $this->assertEmpty($errors); $validator = new RecaptchaValidator(); $data = ['theme' => 'light']; - $errors = $validator->errors($data); + $errors = $validator->validate($data); $this->assertEmpty($errors); $validator = new RecaptchaValidator(); $data = ['type' => 'image']; - $errors = $validator->errors($data); + $errors = $validator->validate($data); $this->assertEmpty($errors); $validator = new RecaptchaValidator(); $data = ['size' => 'normal']; - $errors = $validator->errors($data); + $errors = $validator->validate($data); $this->assertEmpty($errors); } @@ -54,22 +54,22 @@ public function testRecaptchaValidationWithNonExistingParams() { $validator = new RecaptchaValidator(); $data = ['lang' => 'non-existing-lang']; - $errors = $validator->errors($data); + $errors = $validator->validate($data); $this->assertArrayHasKey('lang', $errors); $validator = new RecaptchaValidator(); $data = ['theme' => 'non-existing-theme']; - $errors = $validator->errors($data); + $errors = $validator->validate($data); $this->assertArrayHasKey('theme', $errors); $validator = new RecaptchaValidator(); $data = ['type' => 'non-existing-type']; - $errors = $validator->errors($data); + $errors = $validator->validate($data); $this->assertArrayHasKey('type', $errors); $validator = new RecaptchaValidator(); $data = ['size' => 'non-existing-size']; - $errors = $validator->errors($data); + $errors = $validator->validate($data); $this->assertArrayHasKey('size', $errors); } @@ -87,7 +87,7 @@ public function testRecaptchaValidationWithBlockOfExistingParams() 'type' => 'audio', 'size' => 'compact' ]; - $errors = $validator->errors($data); + $errors = $validator->validate($data); $this->assertEmpty($errors); } @@ -105,7 +105,7 @@ public function testRecaptchaValidationWithBlockOfNonExistingParams() 'type' => 'non-existing-type', 'size' => 'non-existing-size' ]; - $errors = $validator->errors($data); + $errors = $validator->validate($data); $this->assertArrayHasKey('lang', $errors); $this->assertArrayHasKey('theme', $errors); $this->assertArrayHasKey('type', $errors);