chore: bump daves-email-validation-tool from 0.1.5 to 1.2.0 (#1)

This commit is contained in:
Octol1ttle 2024-11-25 18:20:13 +05:00 committed by GitHub
parent 92d74e3369
commit 0d8ccdebcf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 23 additions and 10 deletions

View File

@ -16,13 +16,19 @@
} }
], ],
"require": { "require": {
"php": ">=7", "php": ">=7.1",
"yiisoft/yii2": "*", "yiisoft/yii2": "*",
"daveearley/daves-email-validation-tool": "^0.1.5" "daveearley/daves-email-validation-tool": "^1.2.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "~4.8 || ~5.0" "phpunit/phpunit": "^9.6"
}, },
"repositories": [
{
"type": "composer",
"url": "https://asset-packagist.org"
}
],
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Ely\\Yii2\\": "src" "Ely\\Yii2\\": "src"
@ -30,5 +36,10 @@
}, },
"scripts": { "scripts": {
"test": "phpunit" "test": "phpunit"
},
"config": {
"allow-plugins": {
"yiisoft/yii2-composer": true
}
} }
} }

View File

@ -19,7 +19,7 @@ class TempmailValidator extends Validator
} }
} }
protected function validateValue($value) protected function validateValue($value): ?array
{ {
$validator = $this->buildValidator($value); $validator = $this->buildValidator($value);
$results = $validator->getValidationResults()->asArray(); $results = $validator->getValidationResults()->asArray();

View File

@ -1,20 +1,21 @@
<?php <?php
namespace Ely\Yii2; namespace Ely\Yii2;
include __DIR__ . '/../vendor/yiisoft/yii2/Yii.php'; include __DIR__ . '/../../../vendor/yiisoft/yii2/Yii.php';
use PHPUnit\Framework\TestCase;
use yii\base\Model; use yii\base\Model;
use yii\console\Application; use yii\console\Application;
class TempmailValidatorTest extends \PHPUnit_Framework_TestCase class TempmailValidatorTest extends TestCase
{ {
protected function setUp() protected function setUp(): void
{ {
parent::setUp(); parent::setUp();
new Application([ new Application([
'id' => 'testapp', 'id' => 'testapp',
'basePath' => __DIR__, 'basePath' => __DIR__,
'vendorPath' => __DIR__ . '/../vendor', 'vendorPath' => __DIR__ . '/../../../vendor',
]); ]);
} }
@ -43,14 +44,15 @@ class TempmailValidatorTest extends \PHPUnit_Framework_TestCase
$this->assertSame('Email with custom message.', $model->getFirstError('email')); $this->assertSame('Email with custom message.', $model->getFirstError('email'));
} }
private function createDummyModel(string $customMessage = null) { private function createDummyModel(string $customMessage = null): Model
{
return new class(['customMessage' => $customMessage]) extends Model return new class(['customMessage' => $customMessage]) extends Model
{ {
public $email; public $email;
public $customMessage; public $customMessage;
public function rules() public function rules(): array
{ {
return [ return [
[['email'], TempmailValidator::class, 'message' => $this->customMessage], [['email'], TempmailValidator::class, 'message' => $this->customMessage],