diff --git a/UnitTestFiles/Test/SQL_Injection_Test.php b/UnitTestFiles/Test/SQL_Injection_Test.php new file mode 100644 index 0000000..ffbf3a3 --- /dev/null +++ b/UnitTestFiles/Test/SQL_Injection_Test.php @@ -0,0 +1,44 @@ +expectException(\Exception::class); + \tts\safer_sql::get_safer_sql_text($a); + } + + /** + * @dataProvider safeDataProviderForTest + */ + public function testSafeSQL($a) { + $this->expectNotToPerformAssertions(); + \tts\safer_sql::get_safer_sql_text($a); + } + + public function dataProviderForTest() { + return [ + ["admin: {\$ne : ''}"], + ["' or 1=1-- -"], + ["Drop database me;"], + ["' \|\| DELETE 1=1; --"] + ]; + } + + public function safeDataProviderForTest() { + return [ + ["John walks (down the road)."], + ["Hey, Boy - Good Work!"], + ["I think; I'm good!"] + ]; + } + + +} \ No newline at end of file