summaryrefslogtreecommitdiffstats
path: root/tests/regression.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/regression.php')
-rw-r--r--tests/regression.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/regression.php b/tests/regression.php
new file mode 100644
index 0000000..ad11084
--- /dev/null
+++ b/tests/regression.php
@@ -0,0 +1,22 @@
+<?php
+require '../lib/SqlFormatter.php';
+
+//the sample query file is filled with install scripts for PrestaShop
+//and some sample catalog data from Magento
+$contents = file_get_contents('sql.sql');
+
+//queries are separated by 2 new lines
+$queries = explode("\n\n",$contents);
+
+$output = "";
+
+foreach ($queries as $query) {
+ //do formatting and highlighting
+ $output .= SqlFormatter::format($query);
+ $output .= "\n";
+}
+
+$expected = file_get_contents('expected.html');
+
+if($expected === $output) echo "Got expected output. No changes found.";
+else echo $output;