Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fapi_validation
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
fapi_validation
Merge requests
!72
Issue
#3502214
: Create a new Unit test for NumericValidator validation plugin
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Issue
#3502214
: Create a new Unit test for NumericValidator validation plugin
issue/fapi_validation-3502214:3502214-create-a-new
into
3.0.x
Overview
0
Commits
1
Pipelines
2
Changes
1
Merged
oleksandr p.
requested to merge
issue/fapi_validation-3502214:3502214-create-a-new
into
3.0.x
3 months ago
Overview
0
Commits
1
Pipelines
2
Changes
1
Expand
Related to
#3502214
0
0
Merge request reports
Compare
3.0.x
3.0.x (base)
and
latest version
latest version
3f266f5e
1 commit,
3 months ago
1 file
+
50
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
tests/src/Unit/Validators/NumericValidatorTest.php
0 → 100644
+
50
−
0
Options
<?php
namespace
Drupal\Tests\fapi_validation\Unit\Validators
;
use
Drupal\fapi_validation
\Plugin\FapiValidationValidator\NumericValidator
;
use
Drupal\fapi_validation
\Validator
;
/**
* Tests numeric validator.
*
* @group fapi_validation
* @group fapi_validation_validators
*/
class
NumericValidatorTest
extends
BaseValidator
{
/**
* Numeric validation.
*
* @var \Drupal\fapi_validation\FapiValidationValidatorsInterface
*/
protected
$plugin
;
/**
* {@inheritdoc}
*/
public
function
setUp
():
void
{
parent
::
setUp
();
$this
->
plugin
=
new
NumericValidator
();
}
/**
* Testing valid string.
*/
public
function
testValidString
()
{
$validator
=
new
Validator
(
'numeric'
,
'675745634452'
);
$this
->
assertTrue
(
$this
->
plugin
->
validate
(
$validator
,
[],
$this
->
decoratedFormState
));
}
/**
* Testing invalid string.
*/
public
function
testInvalidString
()
{
$validator
=
new
Validator
(
'numeric'
,
'sfs343dgfs2dfs'
);
$this
->
assertFalse
(
$this
->
plugin
->
validate
(
$validator
,
[],
$this
->
decoratedFormState
));
}
}
Loading