regression.php 590B

123456789101112131415161718192021222324
  1. <?php
  2. require '../lib/SqlFormatter.php';
  3. //the sample query file is filled with install scripts for PrestaShop
  4. //and some sample catalog data from Magento
  5. $contents = file_get_contents('sql.sql');
  6. //queries are separated by 2 new lines
  7. $queries = explode("\n\n",$contents);
  8. $output = "<ol>\n";
  9. foreach ($queries as $query) {
  10. //do formatting and highlighting
  11. $output .= "<li>".SqlFormatter::format($query)."</li>\n\n";
  12. }
  13. $output .= "</ol>";
  14. $expected = file_get_contents('expected.html');
  15. if($expected === $output) echo "Got expected output. No changes found.";
  16. else echo $output;