@@ -55,19 +55,29 @@ public function testAddSimpleProductToCart()
55
55
self ::assertArrayHasKey ('prices ' , $ response ['addSimpleProductsToCart ' ]['cart ' ]['items ' ][0 ]);
56
56
57
57
self ::assertArrayHasKey ('price ' , $ response ['addSimpleProductsToCart ' ]['cart ' ]['items ' ][0 ]['prices ' ]);
58
- self ::assertArrayHasKey ('value ' , $ response ['addSimpleProductsToCart ' ]['cart ' ]['items ' ][0 ]['prices ' ]['price ' ]);
59
- self ::assertEquals (10 , $ response ['addSimpleProductsToCart ' ]['cart ' ]['items ' ][0 ]['prices ' ]['price ' ]['value ' ]);
60
- self ::assertEquals ('USD ' , $ response ['addSimpleProductsToCart ' ]['cart ' ]['items ' ][0 ]['prices ' ]['price ' ]['currency ' ]);
58
+ $ price = $ response ['addSimpleProductsToCart ' ]['cart ' ]['items ' ][0 ]['prices ' ]['price ' ];
59
+ self ::assertArrayHasKey ('value ' , $ price );
60
+ self ::assertEquals (10 , $ price ['value ' ]);
61
+ self ::assertArrayHasKey ('currency ' , $ price );
62
+ self ::assertEquals ('USD ' , $ price ['currency ' ]);
61
63
62
64
self ::assertArrayHasKey ('row_total ' , $ response ['addSimpleProductsToCart ' ]['cart ' ]['items ' ][0 ]['prices ' ]);
63
- self ::assertArrayHasKey ('value ' , $ response ['addSimpleProductsToCart ' ]['cart ' ]['items ' ][0 ]['prices ' ]['row_total ' ]);
64
- self ::assertEquals (20 , $ response ['addSimpleProductsToCart ' ]['cart ' ]['items ' ][0 ]['prices ' ]['row_total ' ]['value ' ]);
65
- self ::assertEquals ('USD ' , $ response ['addSimpleProductsToCart ' ]['cart ' ]['items ' ][0 ]['prices ' ]['row_total ' ]['currency ' ]);
65
+ $ rowTotal = $ response ['addSimpleProductsToCart ' ]['cart ' ]['items ' ][0 ]['prices ' ]['row_total ' ];
66
+ self ::assertArrayHasKey ('value ' , $ rowTotal );
67
+ self ::assertEquals (20 , $ rowTotal ['value ' ]);
68
+ self ::assertArrayHasKey ('currency ' , $ rowTotal );
69
+ self ::assertEquals ('USD ' , $ rowTotal ['currency ' ]);
66
70
67
- self ::assertArrayHasKey ('row_total_including_tax ' , $ response ['addSimpleProductsToCart ' ]['cart ' ]['items ' ][0 ]['prices ' ]);
68
- self ::assertArrayHasKey ('value ' , $ response ['addSimpleProductsToCart ' ]['cart ' ]['items ' ][0 ]['prices ' ]['row_total_including_tax ' ]);
69
- self ::assertEquals (20 , $ response ['addSimpleProductsToCart ' ]['cart ' ]['items ' ][0 ]['prices ' ]['row_total_including_tax ' ]['value ' ]);
70
- self ::assertEquals ('USD ' , $ response ['addSimpleProductsToCart ' ]['cart ' ]['items ' ][0 ]['prices ' ]['row_total_including_tax ' ]['currency ' ]);
71
+ self ::assertArrayHasKey (
72
+ 'row_total_including_tax ' ,
73
+ $ response ['addSimpleProductsToCart ' ]['cart ' ]['items ' ][0 ]['prices ' ]
74
+ );
75
+ $ rowTotalIncludingTax =
76
+ $ response ['addSimpleProductsToCart ' ]['cart ' ]['items ' ][0 ]['prices ' ]['row_total_including_tax ' ];
77
+ self ::assertArrayHasKey ('value ' , $ rowTotalIncludingTax );
78
+ self ::assertEquals (20 , $ rowTotalIncludingTax ['value ' ]);
79
+ self ::assertArrayHasKey ('currency ' , $ rowTotalIncludingTax );
80
+ self ::assertEquals ('USD ' , $ rowTotalIncludingTax ['currency ' ]);
71
81
}
72
82
73
83
/**
0 commit comments