File tree Expand file tree Collapse file tree 1 file changed +4
-9
lines changed
dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -29,23 +29,18 @@ public function testGetAllRatesByProductClassJson()
29
29
/** @var \Magento\Catalog\Block\Adminhtml\Product\Edit\Js $block */
30
30
$ block = $ objectManager ->create (\Magento \Catalog \Block \Adminhtml \Product \Edit \Js::class);
31
31
$ jsonResult = $ block ->getAllRatesByProductClassJson ();
32
- $ decodedResult = json_decode ($ jsonResult );
33
- $ this -> assertNotEmpty ( $ decodedResult , ' Resulting JSON is invalid. ' );
34
- $ taxClassesArray = ( array ) $ decodedResult ;
32
+ $ this -> assertJson ($ jsonResult, ' Resulting JSON is invalid. ' );
33
+ $ decodedResult = json_decode ( $ jsonResult , true );
34
+ $ this -> assertNotNull ( $ decodedResult, ' Cannot decode resulting JSON. ' ) ;
35
35
$ noneTaxClass = 0 ;
36
36
$ defaultProductTaxClass = 2 ;
37
37
$ expectedProductTaxClasses = array_unique (
38
38
array_merge ($ fixtureTaxRule ->getProductTaxClasses (), [$ defaultProductTaxClass , $ noneTaxClass ])
39
39
);
40
- $ this ->assertCount (
41
- count ($ expectedProductTaxClasses ),
42
- $ taxClassesArray ,
43
- 'Invalid quantity of rates for tax classes. '
44
- );
45
40
foreach ($ expectedProductTaxClasses as $ taxClassId ) {
46
41
$ this ->assertArrayHasKey (
47
42
"value_ {$ taxClassId }" ,
48
- $ taxClassesArray ,
43
+ $ decodedResult ,
49
44
"Rates for tax class with ID ' {$ taxClassId }' is missing. "
50
45
);
51
46
}
You can’t perform that action at this time.
0 commit comments