Update Tests to supports namespaces

This commit is contained in:
Dominique FOURNIER
2021-05-07 16:55:38 +02:00
parent ccf0f47c7f
commit 55530b055c
49 changed files with 82 additions and 64 deletions
+29 -13
View File
@@ -1,29 +1,45 @@
<?php
/** Autoload */
spl_autoload_register(function ($class) {
@include $class . '.php';
$classes = array ();
foreach (scandir ("src") as $file)
{
$fileShort = basename ($file);
if ($fileShort == "." || $fileShort == "..")
continue;
$classFile = substr ($fileShort, 0, -4);
$classes["Domframework\\".$classFile] = "src/$file";
}
if (key_exists ($class, $classes))
{
@include ($classes[$class]);
}
else
{
echo "ERROR : $class : doesnt exists in src\n";
}
});
define ("PHPUNIT", "ON-GOING");
file_put_contents ("Tests/dblayerooSqliteTest.php",
file_put_contents ("Tests/DblayerooSqliteTest.php",
str_replace ("{ENGINE}", "sqlite",
file_get_contents ("Tests/dblayerooComplet.php")));
file_put_contents ("Tests/dblayerooMySQLTest.php",
file_get_contents ("Tests/DblayerooComplet.php")));
file_put_contents ("Tests/DblayerooMySQLTest.php",
str_replace ("{ENGINE}", "mysql",
file_get_contents ("Tests/dblayerooComplet.php")));
file_put_contents ("Tests/dblayerooPostgreSQLTest.php",
file_get_contents ("Tests/DblayerooComplet.php")));
file_put_contents ("Tests/DblayerooPostgreSQLTest.php",
str_replace ("{ENGINE}", "pgsql",
file_get_contents ("Tests/dblayerooComplet.php")));
file_put_contents ("Tests/dblayerSqliteTest.php",
file_get_contents ("Tests/DblayerooComplet.php")));
file_put_contents ("Tests/DblayerSqliteTest.php",
str_replace ("{ENGINE}", "sqlite",
file_get_contents ("Tests/dblayerComplet.php")));
file_put_contents ("Tests/dblayerMySQLTest.php",
file_get_contents ("Tests/DblayerComplet.php")));
file_put_contents ("Tests/DblayerMySQLTest.php",
str_replace ("{ENGINE}", "mysql",
file_get_contents ("Tests/dblayerComplet.php")));
file_put_contents ("Tests/dblayerPostgreSQLTest.php",
file_get_contents ("Tests/DblayerComplet.php")));
file_put_contents ("Tests/DblayerPostgreSQLTest.php",
str_replace ("{ENGINE}", "pgsql",
file_get_contents ("Tests/dblayerComplet.php")));
file_get_contents ("Tests/DblayerComplet.php")));
// vim: syntax=on filetype=php