Commit 23f6ac464f2090fb0c6d1ae344e79efc72549705

Authored by nbm
1 parent a74a292e

Convert to SimpleTest unit test.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5402 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 34 additions and 2 deletions
tests/SQLFile/test_sqlfile.php
1 1 <?php
  2 +require_once(dirname(__FILE__) . "/../test.php");
2 3  
3   -require_once("../../config/dmsDefaults.php");
4 4 require_once(KT_DIR . "/lib/database/sqlfile.inc.php");
5 5  
6   -var_dump(SQLFile::sqlFromFile("test_sqlfile.sql"));
  6 +class SQLFileTestCase extends KTUnitTestCase {
  7 + function testSQLFile() {
  8 + $aExpected = array(
  9 + "SELECT \"as;\";",
  10 + "SELECT \"as\\\";\";",
  11 + "SELECT \"as\\\\\";",
  12 + "SELECT \"as\\\\\";",
  13 + "SELECT \"as\\\\\";",
  14 + "SELECT \"as\\\\\";",
  15 + "SELECT 'as\\\\';",
  16 + "SELECT 'as\\\\';",
  17 + "SELECT 'as\\\\';",
  18 + "SELECT 'as\\\\';",
  19 + "SELECT 'as\\\\';",
  20 + "SELECT 'as\\';';",
  21 + "SELECT \"'as\\'\"';';",
  22 + "SELECT 'as\\\\';",
  23 + "SELECT 'as\\\\';",
  24 + "SELECT 'as\\\\';",
  25 + "SELECT 'as\\\\';",
  26 + "SELECT 'as\\\\';",
  27 + "SELECT 'as\\\\';",
  28 + "SELECT '
  29 +asdf; \"\\\" \\'
  30 +
  31 +asdf; ';",
  32 + );
  33 +
  34 + $aReceived = SQLFile::sqlFromFile(dirname(__FILE__) . "/test_sqlfile.sql");
  35 +
  36 + $this->assertExpectedResults($aExpected, $aReceived);
  37 + }
  38 +}
7 39  
8 40 ?>
... ...