Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
framework
Serialize
Test
Unit
JsonValidatorTest.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Framework\Serialize\Test\Unit
;
7
8
use
Magento\Framework\Serialize\JsonValidator
;
9
10
class
JsonValidatorTest
extends
\PHPUnit\Framework\TestCase
11
{
15
private
$jsonValidator;
16
17
protected
function
setUp
()
18
{
19
$this->jsonValidator =
new
JsonValidator
();
20
}
21
27
public
function
testIsValid
(
$value
, $expected)
28
{
29
$this->assertEquals(
30
$expected,
31
$this->jsonValidator->isValid(
$value
)
32
);
33
}
34
38
public
function
isValidDataProvider
()
39
{
40
return
[
41
[
'""'
,
true
],
42
[
'"string"'
,
true
],
43
[
'null'
,
true
],
44
[
'false'
,
true
],
45
[
'{"a":"b","d":123}'
,
true
],
46
[
'123'
,
true
],
47
[
'10.56'
,
true
],
48
[123,
true
],
49
[10.56,
true
],
50
[
'{}'
,
true
],
51
[
'"'
,
false
],
52
[
'"string'
,
false
],
53
[
null
,
false
],
54
[
false
,
false
],
55
[
'{"a'
,
false
],
56
[
'{'
,
false
],
57
[
''
,
false
]
58
];
59
}
60
}
Magento\Framework\Serialize\Test\Unit\JsonValidatorTest\setUp
setUp()
Definition:
JsonValidatorTest.php:17
Magento\Framework\Serialize\Test\Unit\JsonValidatorTest\testIsValid
testIsValid($value, $expected)
Definition:
JsonValidatorTest.php:27
$value
$value
Definition:
gender.phtml:16
Magento\Framework\Serialize\Test\Unit\JsonValidatorTest\isValidDataProvider
isValidDataProvider()
Definition:
JsonValidatorTest.php:38
Magento\Framework\Serialize\Test\Unit
Definition:
JsonValidatorTest.php:6
Magento\Framework\Serialize\Test\Unit\JsonValidatorTest
Definition:
JsonValidatorTest.php:10
Magento\Framework\Serialize\JsonValidator
Definition:
JsonValidator.php:11