public function checkItemsOrder($order)
{
if ($this->responseIsJson) {
$order = explode(',', $order);
foreach ($order as $key => $value) {
$order[$key] = $this->extractValueByGivenLocation($value);
}
$actualOrder = array();
foreach ($this->responseData['items'] as $key => $item) {
$actualOrder[] = $item['number'];
}
if ($order !== $actualOrder) {
throw new \Exception(sprintf("Unexpected order.\nExpected order:\n%s\nActual response:\n%s", json_encode($order), json_encode($actualOrder)));
}
} else {
return new Step\Then('the response isn\'t JSON');
}
}