diff --git a/src/ApiContext.php b/src/ApiContext.php index c098bd4..6617d6f 100644 --- a/src/ApiContext.php +++ b/src/ApiContext.php @@ -355,4 +355,16 @@ public function jeTrieLeResultatPar($field) return $a->$field <=> $b->$field; }); } + + /** + * @Then /^le csv devrait être équivalent au fichier csv "(.*)"$/ + */ + public function leCsvDevraitEtreEquivalentAuFichierCsv($filename) + { + $filepath = realpath($this->results_path . "/" . $filename); + $csv_result = str_getcsv(preg_replace('/\r\n?/', "\n",$this->response['body']), ';'); + $csv_expected = str_getcsv(preg_replace('/\r\n?/', "\n",file_get_contents($filepath)), ';'); + $this->check($csv_result, $csv_expected, 'results', $errors); + $this->handleErrors($csv_expected, $errors); + } }