/** * @Then the output should be a Json containing :productCount product's info with :totalPrice as the total price */ public function theOutputShouldBeAJsonContainingProductSInfoWithAsTheTotalPrice($productCount, $totalPrice) { $result = $this->commandTester->getDisplay(); assertJson($result); $resultToArray = json_decode($result, true); assertCount((int) $productCount, $resultToArray['result']); assertEquals((double) $totalPrice, $resultToArray['total']); }
/** * @Then response body should be a valid json */ public function responseBodyShouldBeAValidJson() { assertJson($this->client->getResponse()->getContent()); }
/** * @Then Assert the json :arg1 is valid * @param $string */ public function assertJson($string) { assertJson((string) $string, sprintf("Assert the json [%s] is valid", $string)); }