diff --git a/.gitignore b/.gitignore index 4d3b6a20e..713406857 100644 --- a/.gitignore +++ b/.gitignore @@ -7,14 +7,12 @@ composer.lock *.cache cs-fixer.phar *.log -src/app/storage -app/storage /release/ php-cs-fixer-v2.phar -app/sto -app/config/* +App/sto +App/Config/* .idea/* -!/app/config/config-with-err-00.json +!/App/Config/config-with-err-00.json *.Identifier tests/clover.xml /.vscode diff --git a/app/apis/.gitkeep b/App/Apis/.gitkeep similarity index 100% rename from app/apis/.gitkeep rename to App/Apis/.gitkeep diff --git a/app/apis/RoutingTestClass.php b/App/Apis/RoutingTestClass.php similarity index 95% rename from app/apis/RoutingTestClass.php rename to App/Apis/RoutingTestClass.php index 1c55d9453..f605ba9ee 100644 --- a/app/apis/RoutingTestClass.php +++ b/App/Apis/RoutingTestClass.php @@ -1,5 +1,5 @@ 'Ibrahim Ali' + // 'WebFiori@example.com' => 'Ibrahim Ali' //]); } /** diff --git a/app/tasks/Fail2TestTask.php b/App/Tasks/Fail2TestTask.php similarity index 90% rename from app/tasks/Fail2TestTask.php rename to App/Tasks/Fail2TestTask.php index c0d9dc9f1..c71ca727b 100644 --- a/app/tasks/Fail2TestTask.php +++ b/App/Tasks/Fail2TestTask.php @@ -1,8 +1,8 @@ 'Ibrahim Ali' + // 'WebFiori@example.com' => 'Ibrahim Ali' //]); } /** diff --git a/app/tasks/Fail3TestTask.php b/App/Tasks/Fail3TestTask.php similarity index 92% rename from app/tasks/Fail3TestTask.php rename to App/Tasks/Fail3TestTask.php index b4c5f0857..128dfa6fc 100644 --- a/app/tasks/Fail3TestTask.php +++ b/App/Tasks/Fail3TestTask.php @@ -1,7 +1,7 @@ 'Ibrahim Ali' + // 'WebFiori@example.com' => 'Ibrahim Ali' //]); } /** diff --git a/app/tasks/SuccessTestEveryMinute.php b/App/Tasks/SuccessTestEveryMinute.php similarity index 92% rename from app/tasks/SuccessTestEveryMinute.php rename to App/Tasks/SuccessTestEveryMinute.php index 0daf38164..2f51faa81 100644 --- a/app/tasks/SuccessTestEveryMinute.php +++ b/App/Tasks/SuccessTestEveryMinute.php @@ -1,8 +1,8 @@ 'Ibrahim Ali' + // 'WebFiori@example.com' => 'Ibrahim Ali' //]); } /** diff --git a/app/tasks/SuccessTestTask.php b/App/Tasks/SuccessTestTask.php similarity index 95% rename from app/tasks/SuccessTestTask.php rename to App/Tasks/SuccessTestTask.php index 339730e8c..96d7972a1 100644 --- a/app/tasks/SuccessTestTask.php +++ b/App/Tasks/SuccessTestTask.php @@ -1,7 +1,7 @@ 'Ibrahim Ali' + // 'WebFiori@example.com' => 'Ibrahim Ali' //]); } /** diff --git a/app/tasks/temp b/App/Tasks/temp similarity index 100% rename from app/tasks/temp rename to App/Tasks/temp diff --git a/app/themes/cool/temp b/App/Themes/cool/temp similarity index 100% rename from app/themes/cool/temp rename to App/Themes/cool/temp diff --git a/Themes/Fiori/.gitkeep b/Themes/Fiori/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/themes/fioriTheme/AsideSection.php b/Themes/FioriTheme/AsideSection.php similarity index 84% rename from themes/fioriTheme/AsideSection.php rename to Themes/FioriTheme/AsideSection.php index 7da8bbc13..971b953a3 100644 --- a/themes/fioriTheme/AsideSection.php +++ b/Themes/FioriTheme/AsideSection.php @@ -1,7 +1,7 @@ initThemesPath(); - if (!class_exists(APP_DIR.'\ini\InitPrivileges')) { + if (!class_exists(APP_DIR.'\\Init\\InitPrivileges')) { Ini::get()->createIniClass('InitPrivileges', 'Initialize user groups and privileges.'); } //Initialize privileges. //This step must be done before initializing anything. - self::call(APP_DIR.'\ini\InitPrivileges::init'); + self::call(APP_DIR.'\\Init\\InitPrivileges::init'); $this->initMiddleware(); $this->initRoutes(); @@ -168,8 +168,7 @@ private function __construct() { * Register CLI commands or background tasks. * * @param string $folder The name of the folder that contains the jobs or - * commands. It must be a folder inside 'app' folder or the folder which is defined - * by the constant 'APP_DIR'. + * commands. It must be a folder inside [APP_DIR]. * * @param callable $regCallback A callback which is used to register the * classes of the folder. @@ -274,10 +273,10 @@ public static function getConfigDriver() : string { } private static function getRoot() { //Following lines of code assumes that the class exist on the folder: - //\vendor\webfiori\framework\webfiori\framework + //\vendor\WebFiori\framework\WebFiori\Framework //Its used to construct the folder at which index file will exist at $DS = DIRECTORY_SEPARATOR; - $vendorPath = $DS.'vendor'.$DS.'webfiori'.$DS.'framework'.$DS.'webfiori'.$DS.'framework'; + $vendorPath = $DS.'vendor'.$DS.'webFiori'.$DS.'framework'.$DS.'WebFiori'.$DS.'Framework'; $rootPath = substr(__DIR__, 0, strlen(__DIR__) - strlen($vendorPath)); return $rootPath; } @@ -291,7 +290,7 @@ public static function handle() { if (self::$ClassStatus == self::STATUS_NONE) { $publicFolderName = 'public'; - self::initiate('app', $publicFolderName, self::getRoot().DIRECTORY_SEPARATOR.$publicFolderName); + self::initiate('App', $publicFolderName, self::getRoot().DIRECTORY_SEPARATOR.$publicFolderName); } if (self::$ClassStatus == self::STATUS_INITIATED) { self::start(); @@ -321,7 +320,7 @@ public static function handle() { * @param string $indexDir The directory at which index file exist at. * Usually, its the value of the constant __DIR__. */ - public static function initiate(string $appFolder = 'app', string $publicFolder = 'public', string $indexDir = __DIR__) { + public static function initiate(string $appFolder = 'App', string $publicFolder = 'public', string $indexDir = __DIR__) { /** * Change encoding of mb_ functions to UTF-8 */ @@ -368,7 +367,7 @@ public static function initiate(string $appFolder = 'app', string $publicFolder /** * Path to WebFiori's core library. */ - define('WF_CORE_PATH', ROOT_PATH.DS.'vendor'.DS.'webfiori'.DS.'framework'.DS.'webfiori'.DS.'framework'); + define('WF_CORE_PATH', ROOT_PATH.DS.'vendor'.DS.'WebFiori'.DS.'framework'.DS.'WebFiori'.DS.'framework'); } self::initAutoLoader(); self::checkStandardLibs(); @@ -384,7 +383,7 @@ public static function initiate(string $appFolder = 'app', string $publicFolder * @throws FileException */ public static function getRunner() : Runner { - if (!class_exists(APP_DIR.'\ini\InitCommands')) { + if (!class_exists(APP_DIR.'\Init\InitCommands')) { Ini::get()->createIniClass('InitCommands', 'A method that can be used to initialize CLI commands.'); } @@ -417,25 +416,25 @@ public static function getRunner() : Runner { self::$CliRunner->setBeforeStart(function (Runner $r) { $commands = [ - '\\webfiori\\framework\\cli\commands\\WHelpCommand', - '\\webfiori\\framework\\cli\\commands\\VersionCommand', - '\\webfiori\\framework\\cli\\commands\\SettingsCommand', - '\\webfiori\\framework\\cli\\commands\\SchedulerCommand', - '\\webfiori\\framework\\cli\\commands\\CreateCommand', - '\\webfiori\\framework\\cli\\commands\\AddCommand', - '\\webfiori\\framework\\cli\\commands\\ListRoutesCommand', - '\\webfiori\\framework\\cli\\commands\\ListThemesCommand', - '\\webfiori\\framework\\cli\\commands\\RunSQLQueryCommand', - '\\webfiori\\framework\\cli\\commands\\UpdateSettingsCommand', - '\\webfiori\\framework\\cli\\commands\\UpdateTableCommand', - '\\webfiori\\framework\\cli\\commands\\RunMigrationsCommand', + '\\WebFiori\\Framework\\Cli\\Commands\\WHelpCommand', + '\\WebFiori\\Framework\\Cli\\Commands\\VersionCommand', + '\\WebFiori\\Framework\\Cli\\Commands\\SettingsCommand', + '\\WebFiori\\Framework\\Cli\\Commands\\SchedulerCommand', + '\\WebFiori\\Framework\\Cli\\Commands\\CreateCommand', + '\\WebFiori\\Framework\\Cli\\Commands\\AddCommand', + '\\WebFiori\\Framework\\Cli\\Commands\\ListRoutesCommand', + '\\WebFiori\\Framework\\Cli\\Commands\\ListThemesCommand', + '\\WebFiori\\Framework\\Cli\\Commands\\RunSQLQueryCommand', + '\\WebFiori\\Framework\\Cli\\Commands\\UpdateSettingsCommand', + '\\WebFiori\\Framework\\Cli\\Commands\\UpdateTableCommand', + '\\WebFiori\\Framework\\Cli\\Commands\\RunMigrationsCommand', ]; foreach ($commands as $c) { $r->register(new $c()); } $r->setDefaultCommand('help'); - self::call(APP_DIR.'\ini\InitCommands::init'); + self::call(APP_DIR.'\Init\InitCommands::init'); }); } @@ -519,7 +518,7 @@ private function checkAppDir() { * * @since 2.2.1 */ - define('APP_DIR','app'); + define('APP_DIR','App'); } if (strpos(APP_DIR, ' ') !== false || strpos(APP_DIR, '-')) { @@ -548,16 +547,16 @@ private function checkAppDir() { */ private static function checkStandardLibs() { $standardLibsClasses = [ - 'webfiori/collections' => 'WebFiori\\Collections\\Node', - 'webfiori/ui' => 'WebFiori\\UI\\HTMLNode', - 'webfiori/jsonx' => 'WebFiori\\Json\\Json', - 'webfiori/database' => 'WebFiori\\Database\\ResultSet', - 'webfiori/http' => 'WebFiori\\Http\\Response', - 'webfiori/file' => 'WebFiori\\File\\File', - 'webfiori/mailer' => 'WebFiori\\Mail\\SMTPAccount', - 'webfiori/cli' => 'WebFiori\\Cli\\Command', - - 'webfiori/cache' => 'WebFiori\\Cache\\Cache' + 'WebFiori/collections' => 'WebFiori\\Collections\\Node', + 'WebFiori/ui' => 'WebFiori\\Ui\\HTMLNode', + 'WebFiori/jsonx' => 'WebFiori\\Json\\Json', + 'WebFiori/database' => 'WebFiori\\Database\\ResultSet', + 'WebFiori/http' => 'WebFiori\\Http\\Response', + 'WebFiori/file' => 'WebFiori\\File\\File', + 'WebFiori/mailer' => 'WebFiori\\Mail\\SMTPAccount', + 'WebFiori/cli' => 'WebFiori\\Cli\\Command', + + 'WebFiori/cache' => 'WebFiori\\Cache\\Cache' ]; foreach ($standardLibsClasses as $lib => $class) { @@ -615,17 +614,17 @@ private static function initAutoLoader() { /** * Initialize autoloader. */ - if (!class_exists('webfiori\framework\autoload\ClassLoader',false)) { - $autoloader = WF_CORE_PATH.DIRECTORY_SEPARATOR.'autoload'.DIRECTORY_SEPARATOR.'ClassLoader.php'; + if (!class_exists('WebFiori\Framework\Autoload\ClassLoader',false)) { + $autoloader = WF_CORE_PATH.DIRECTORY_SEPARATOR.'Autoload'.DIRECTORY_SEPARATOR.'ClassLoader.php'; require_once $autoloader; } self::$AU = ClassLoader::get(); - if (!class_exists(APP_DIR.'\ini\InitAutoLoad')) { + if (!class_exists(APP_DIR.'\\Init\\InitAutoLoad')) { Ini::createAppDirs(); Ini::get()->createIniClass('InitAutoLoad', 'Add user-defined directories to the set of directories at which the framework will search for classes.'); } - self::call(APP_DIR.'\ini\InitAutoLoad::init'); + self::call(APP_DIR.'\\Init\\InitAutoLoad::init'); } /** * Initialize global constants which has information about framework version. @@ -643,7 +642,7 @@ public static function initFrameworkVersionInfo() { * * @since 2.1 */ - define('WF_VERSION', '3.0.0-Beta.28'); + define('WF_VERSION', '3.0.0-Beta.29'); /** * A constant that tells the type of framework version. * @@ -659,7 +658,7 @@ public static function initFrameworkVersionInfo() { * * @since 2.1 */ - define('WF_RELEASE_DATE', '2025-08-04'); + define('WF_RELEASE_DATE', '2025-10-09'); } /** @@ -671,11 +670,11 @@ private function initMiddleware() { MiddlewareManager::register($inst); }); - if (!class_exists(APP_DIR.'\ini\InitMiddleware')) { - Ini::get()->createIniClass('InitMiddleware', 'Register middleware which are created outside the folder \'[APP_DIR]/middleware\'.'); + if (!class_exists(APP_DIR.'\Init\InitMiddleware')) { + Ini::get()->createIniClass('InitMiddleware', 'Register middleware which are created outside the folder \'[APP_DIR]/Middleware\'.'); } MiddlewareManager::register(new StartSessionMiddleware()); - self::call(APP_DIR.'\ini\InitMiddleware::init'); + self::call(APP_DIR.'\Init\InitMiddleware::init'); } /** * @throws FileException @@ -684,10 +683,10 @@ private function initRoutes() { $routesClasses = ['APIsRoutes', 'PagesRoutes', 'ClosureRoutes', 'OtherRoutes']; foreach ($routesClasses as $className) { - if (!class_exists(APP_DIR.'\\ini\\routes\\'.$className)) { + if (!class_exists(APP_DIR.'\\Init\\Routes\\'.$className)) { Ini::get()->createRoutesClass($className); } - self::call(APP_DIR.'\ini\routes\\'.$className.'::create'); + self::call(APP_DIR.'\Init\Routes\\'.$className.'::create'); } if (Router::routesCount() != 0) { @@ -706,7 +705,7 @@ private function initScheduler() { $uriObj = new RouterUri(Request::getRequestedURI(), ''); $pathArr = $uriObj->getPathArray(); - if (!class_exists(APP_DIR.'\ini\InitTasks')) { + if (!class_exists(APP_DIR.'\Init\InitTasks')) { Ini::get()->createIniClass('InitTasks', 'A method that can be used to register background tasks.'); } @@ -716,13 +715,13 @@ private function initScheduler() { } TasksManager::getPassword(self::getConfig()->getSchedulerPassword()); //initialize scheduler tasks only if in CLI or scheduler is enabled through HTTP. - self::call(APP_DIR.'\ini\InitTasks::init'); + self::call(APP_DIR.'\Init\InitTasks::init'); TasksManager::registerTasks(); } } private function initThemesPath() { if (!defined('THEMES_PATH')) { - $themesDirName = 'themes'; + $themesDirName = 'Themes'; $themesPath = ROOT_PATH.DS.$themesDirName; /** * This constant represents the directory at which themes exist. diff --git a/webfiori/framework/autoload/ClassInfo.php b/WebFiori/Framework/Autoload/ClassInfo.php similarity index 95% rename from webfiori/framework/autoload/ClassInfo.php rename to WebFiori/Framework/Autoload/ClassInfo.php index a54da9fff..b952a79ed 100644 --- a/webfiori/framework/autoload/ClassInfo.php +++ b/WebFiori/Framework/Autoload/ClassInfo.php @@ -8,7 +8,7 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\autoload; +namespace WebFiori\Framework\Autoload; /** * A class that contains the names of indices that are used by loaded class info array. diff --git a/webfiori/framework/autoload/ClassLoader.php b/WebFiori/Framework/Autoload/ClassLoader.php similarity index 98% rename from webfiori/framework/autoload/ClassLoader.php rename to WebFiori/Framework/Autoload/ClassLoader.php index 980e2f049..34715a4a3 100644 --- a/webfiori/framework/autoload/ClassLoader.php +++ b/WebFiori/Framework/Autoload/ClassLoader.php @@ -8,7 +8,7 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\autoload; +namespace WebFiori\Framework\Autoload; use Exception; /** @@ -232,23 +232,22 @@ public static function get(array $options = [ if (self::$loader === null) { if (!defined('APP_DIR')) { - define('APP_DIR', 'app'); + define('APP_DIR', 'App'); } $appFolder = APP_DIR; $frameworkSearchFolders = [ '', - $DS.'webfiori'.$DS.'framework', - $DS.'framework'.$DS.'exceptions', - $DS.'framework'.$DS.'cli', - $DS.'framework'.$DS.'ui', - $DS.'framework', - $DS.'themes', - $DS.'logic', - $DS.'apis', - $DS.'pages', - $DS.'ini', - $DS.'libs', - $DS.'config', + $DS.'WebFiori'.$DS.'Framework', + $DS.'Framework'.$DS.'Exceptions', + $DS.'Framework'.$DS.'Cli', + $DS.'Framework'.$DS.'Ui', + $DS.'Framework', + $DS.'Themes', + $DS.'Apis', + $DS.'Pages', + $DS.'Ini', + $DS.'Libs', + $DS.'Config', $DS.$appFolder ]; @@ -258,7 +257,7 @@ public static function get(array $options = [ } } $defineRoot = isset($options['define-root']) && $options['define-root'] === true; - $root = isset($options['root']) ? trim($options['root'],'\\/') : trim(substr(__DIR__, 0, strlen(__DIR__) - strlen('\entity')),'\\/'); + $root = isset($options['root']) ? trim($options['root'],'\\/') : trim(substr(__DIR__, 0, strlen(__DIR__) - strlen('\Entity')),'\\/'); if (strlen($root) != 0 && explode($DS, $root)[0] == 'home') { //linux diff --git a/webfiori/framework/autoload/ClassLoaderException.php b/WebFiori/Framework/Autoload/ClassLoaderException.php similarity index 92% rename from webfiori/framework/autoload/ClassLoaderException.php rename to WebFiori/Framework/Autoload/ClassLoaderException.php index 412f188c5..f45a27a37 100644 --- a/webfiori/framework/autoload/ClassLoaderException.php +++ b/WebFiori/Framework/Autoload/ClassLoaderException.php @@ -8,7 +8,7 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\autoload; +namespace WebFiori\Framework\Autoload; use Exception; /** diff --git a/webfiori/framework/cli/CLITestCase.php b/WebFiori/Framework/Cli/CLITestCase.php similarity index 97% rename from webfiori/framework/cli/CLITestCase.php rename to WebFiori/Framework/Cli/CLITestCase.php index 84ecf4c66..54305f9c1 100644 --- a/webfiori/framework/cli/CLITestCase.php +++ b/WebFiori/Framework/Cli/CLITestCase.php @@ -8,12 +8,12 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\cli; +namespace WebFiori\Framework\Cli; use WebFiori\Cli\Command; use WebFiori\Cli\CommandTestCase; use WebFiori\File\File; -use webfiori\framework\App; +use WebFiori\Framework\App; /** * A base test case class that can be used to write command line commands test cases. diff --git a/webfiori/framework/cli/CLIUtils.php b/WebFiori/Framework/Cli/CLIUtils.php similarity index 98% rename from webfiori/framework/cli/CLIUtils.php rename to WebFiori/Framework/Cli/CLIUtils.php index dc11d0416..31fefb8bf 100644 --- a/webfiori/framework/cli/CLIUtils.php +++ b/WebFiori/Framework/Cli/CLIUtils.php @@ -1,11 +1,11 @@ writeClass(); $this->success('Language added. Also, a class for the language ' - .'is created at "'.APP_DIR.'\langs" for that language.'); + .'is created at "'.APP_DIR.'\Langs" for that language.'); return 0; } diff --git a/webfiori/framework/cli/commands/CreateCommand.php b/WebFiori/Framework/Cli/Commands/CreateCommand.php similarity index 88% rename from webfiori/framework/cli/commands/CreateCommand.php rename to WebFiori/Framework/Cli/Commands/CreateCommand.php index ef0fc2608..bc5c2d3d6 100644 --- a/webfiori/framework/cli/commands/CreateCommand.php +++ b/WebFiori/Framework/Cli/Commands/CreateCommand.php @@ -8,22 +8,22 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\cli\commands; +namespace WebFiori\Framework\Cli\Commands; use WebFiori\Cli\Argument; use WebFiori\Cli\Command; -use webfiori\framework\cli\CLIUtils; -use webfiori\framework\cli\helpers\ClassInfoReader; -use webfiori\framework\cli\helpers\CreateAPITestCase; -use webfiori\framework\cli\helpers\CreateBackgroundTask; -use webfiori\framework\cli\helpers\CreateCLIClassHelper; -use webfiori\framework\cli\helpers\CreateDBAccessHelper; -use webfiori\framework\cli\helpers\CreateFullRESTHelper; -use webfiori\framework\cli\helpers\CreateMiddleware; -use webfiori\framework\cli\helpers\CreateMigration; -use webfiori\framework\cli\helpers\CreateTableObj; -use webfiori\framework\cli\helpers\CreateThemeHelper; -use webfiori\framework\cli\helpers\CreateWebService; +use WebFiori\Framework\Cli\CLIUtils; +use WebFiori\Framework\Cli\Helpers\ClassInfoReader; +use WebFiori\Framework\Cli\Helpers\CreateAPITestCase; +use WebFiori\Framework\Cli\Helpers\CreateBackgroundTask; +use WebFiori\Framework\Cli\Helpers\CreateCLIClassHelper; +use WebFiori\Framework\Cli\Helpers\CreateDBAccessHelper; +use WebFiori\Framework\Cli\Helpers\CreateFullRESTHelper; +use WebFiori\Framework\Cli\Helpers\CreateMiddleware; +use WebFiori\Framework\Cli\Helpers\CreateMigration; +use WebFiori\Framework\Cli\Helpers\CreateTableObj; +use WebFiori\Framework\Cli\Helpers\CreateThemeHelper; +use WebFiori\Framework\Cli\Helpers\CreateWebService; /** * A command which is used to automate some common tasks such as * creating table classes or controllers. @@ -44,7 +44,7 @@ public function __construct() { } public function createEntityFromQuery(): int { $tableObj = CLIUtils::readTable($this); - $defaultNs = APP_DIR.'\\entity'; + $defaultNs = APP_DIR.'\\Entity'; $this->println('We need from you to give us entity class information.'); $infoReader = new ClassInfoReader($this); $classInfo = $infoReader->readClassInfo($defaultNs); @@ -142,7 +142,7 @@ private function getWhat() { $answer = null; if ($what !== null) { - $answer = $options[$what] ?? null; + $answer = $options[strtolower($what)] ?? null; if ($answer === null) { $this->warning('The argument --c has invalid value.'); diff --git a/webfiori/framework/cli/commands/ListRoutesCommand.php b/WebFiori/Framework/Cli/Commands/ListRoutesCommand.php similarity index 94% rename from webfiori/framework/cli/commands/ListRoutesCommand.php rename to WebFiori/Framework/Cli/Commands/ListRoutesCommand.php index 048abb80f..7bd0db0ec 100644 --- a/webfiori/framework/cli/commands/ListRoutesCommand.php +++ b/WebFiori/Framework/Cli/Commands/ListRoutesCommand.php @@ -8,10 +8,10 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\cli\commands; +namespace WebFiori\Framework\Cli\Commands; use WebFiori\Cli\Command; -use webfiori\framework\router\Router; +use WebFiori\Framework\Router\Router; /** * A CLI command which is used to show a list of all added routes. * diff --git a/webfiori/framework/cli/commands/ListThemesCommand.php b/WebFiori/Framework/Cli/Commands/ListThemesCommand.php similarity index 97% rename from webfiori/framework/cli/commands/ListThemesCommand.php rename to WebFiori/Framework/Cli/Commands/ListThemesCommand.php index ffeb7b300..f3ad23b6a 100644 --- a/webfiori/framework/cli/commands/ListThemesCommand.php +++ b/WebFiori/Framework/Cli/Commands/ListThemesCommand.php @@ -8,11 +8,11 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\cli\commands; +namespace WebFiori\Framework\Cli\Commands; use WebFiori\Cli\Argument; use WebFiori\Cli\Command; -use webfiori\framework\ThemeManager; +use WebFiori\Framework\ThemeManager; /** * A CLI command which is used to list all registered themes. diff --git a/webfiori/framework/cli/commands/RunMigrationsCommand.php b/WebFiori/Framework/Cli/Commands/RunMigrationsCommand.php similarity index 98% rename from webfiori/framework/cli/commands/RunMigrationsCommand.php rename to WebFiori/Framework/Cli/Commands/RunMigrationsCommand.php index e7bf83f91..fb65f9de2 100644 --- a/webfiori/framework/cli/commands/RunMigrationsCommand.php +++ b/WebFiori/Framework/Cli/Commands/RunMigrationsCommand.php @@ -8,7 +8,7 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\cli\commands; +namespace WebFiori\Framework\Cli\Commands; use Throwable; use WebFiori\Cli\Argument; @@ -17,8 +17,8 @@ use WebFiori\Database\Database; use WebFiori\Database\migration\AbstractMigration; use WebFiori\Database\Schema\SchemaRunner; -use webfiori\framework\App; -use webfiori\framework\cli\CLIUtils; +use WebFiori\Framework\App; +use WebFiori\Framework\Cli\CLIUtils; /** * Command for executing database migrations. diff --git a/webfiori/framework/cli/commands/RunSQLQueryCommand.php b/WebFiori/Framework/Cli/Commands/RunSQLQueryCommand.php similarity index 97% rename from webfiori/framework/cli/commands/RunSQLQueryCommand.php rename to WebFiori/Framework/Cli/Commands/RunSQLQueryCommand.php index 427a6417d..da514fda4 100644 --- a/webfiori/framework/cli/commands/RunSQLQueryCommand.php +++ b/WebFiori/Framework/Cli/Commands/RunSQLQueryCommand.php @@ -8,7 +8,7 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\cli\commands; +namespace WebFiori\Framework\Cli\Commands; use WebFiori\Cli\Argument; use WebFiori\Cli\Command; @@ -16,9 +16,9 @@ use WebFiori\Database\DatabaseException; use WebFiori\Database\Table; use WebFiori\File\File; -use webfiori\framework\App; -use webfiori\framework\cli\CLIUtils; -use webfiori\framework\DB; +use WebFiori\Framework\App; +use WebFiori\Framework\Cli\CLIUtils; +use WebFiori\Framework\DB; /** * A command which can be used to execute SQL queries on * specific database. @@ -31,7 +31,7 @@ class RunSQLQueryCommand extends Command { public function __construct() { parent::__construct('run-query', [ new Argument('--connection', 'Database connection that the query will be executed on.', true), - new Argument('--schema', 'The namespace of a class that extends the class "webfiori\\framework\\DB" which represents database schema.', true), + new Argument('--schema', 'The namespace of a class that extends the class "WebFiori\\Framework\\DB" which represents database schema.', true), new Argument('--create', 'This option is used alongside the option --table and --schema. If it is provided, this means initiate the process of creating the database or the Table.', true), new Argument('--table', 'Table class to run query on.', true), new Argument('--file', 'The path to SQL file that holds SQL query.', true), @@ -267,7 +267,7 @@ private function schemaBased($schema) { if ($schemaInst instanceof DB) { return $this->queryOnSchema($schemaInst); } else { - $this->error('Given class is not an instance of "webfiori\\framework\\DB"!'); + $this->error('Given class is not an instance of "WebFiori\\Framework\\DB"!'); return -1; } diff --git a/webfiori/framework/cli/commands/SchedulerCommand.php b/WebFiori/Framework/Cli/Commands/SchedulerCommand.php similarity index 98% rename from webfiori/framework/cli/commands/SchedulerCommand.php rename to WebFiori/Framework/Cli/Commands/SchedulerCommand.php index b3e901ff4..ca2f80ed3 100644 --- a/webfiori/framework/cli/commands/SchedulerCommand.php +++ b/WebFiori/Framework/Cli/Commands/SchedulerCommand.php @@ -8,12 +8,12 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\cli\commands; +namespace WebFiori\Framework\Cli\Commands; use WebFiori\Cli\Argument; use WebFiori\Cli\Command; -use webfiori\framework\scheduler\AbstractTask; -use webfiori\framework\scheduler\TasksManager; +use WebFiori\Framework\Scheduler\AbstractTask; +use WebFiori\Framework\Scheduler\TasksManager; /** * A CLI command which is related to executing * background tasks or performing operations on them. diff --git a/webfiori/framework/cli/commands/SettingsCommand.php b/WebFiori/Framework/Cli/Commands/SettingsCommand.php similarity index 97% rename from webfiori/framework/cli/commands/SettingsCommand.php rename to WebFiori/Framework/Cli/Commands/SettingsCommand.php index ce9067a31..181f57a87 100644 --- a/webfiori/framework/cli/commands/SettingsCommand.php +++ b/WebFiori/Framework/Cli/Commands/SettingsCommand.php @@ -8,10 +8,10 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\cli\commands; +namespace WebFiori\Framework\Cli\Commands; use WebFiori\Cli\Command; -use webfiori\framework\App; +use WebFiori\Framework\App; /** * A CLI command which is used to show framework configuration. * diff --git a/webfiori/framework/cli/commands/UpdateSettingsCommand.php b/WebFiori/Framework/Cli/Commands/UpdateSettingsCommand.php similarity index 97% rename from webfiori/framework/cli/commands/UpdateSettingsCommand.php rename to WebFiori/Framework/Cli/Commands/UpdateSettingsCommand.php index c34763101..e18f49122 100644 --- a/webfiori/framework/cli/commands/UpdateSettingsCommand.php +++ b/WebFiori/Framework/Cli/Commands/UpdateSettingsCommand.php @@ -8,16 +8,16 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\cli\commands; +namespace WebFiori\Framework\Cli\Commands; use Throwable; use WebFiori\Cli\Argument; use WebFiori\Cli\Command; use WebFiori\Cli\InputValidator; -use webfiori\framework\App; -use webfiori\framework\config\Controller; -use webfiori\framework\router\Router; -use webfiori\framework\Theme; +use WebFiori\Framework\App; +use WebFiori\Framework\Config\Controller; +use WebFiori\Framework\Router\Router; +use WebFiori\Framework\Theme; /** * This class implements a CLI command which is used to update the settings which are * stored in the class 'AppConfing' of the application. diff --git a/webfiori/framework/cli/commands/UpdateTableCommand.php b/WebFiori/Framework/Cli/Commands/UpdateTableCommand.php similarity index 91% rename from webfiori/framework/cli/commands/UpdateTableCommand.php rename to WebFiori/Framework/Cli/Commands/UpdateTableCommand.php index a84009375..ad238f16c 100644 --- a/webfiori/framework/cli/commands/UpdateTableCommand.php +++ b/WebFiori/Framework/Cli/Commands/UpdateTableCommand.php @@ -8,13 +8,13 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\cli\commands; +namespace WebFiori\Framework\Cli\Commands; use WebFiori\Cli\Argument; use WebFiori\Cli\Command; -use webfiori\framework\cli\CLIUtils; -use webfiori\framework\cli\helpers\CreateTableObj; -use webfiori\framework\cli\helpers\TableObjHelper; +use WebFiori\Framework\Cli\CLIUtils; +use WebFiori\Framework\Cli\Helpers\CreateTableObj; +use WebFiori\Framework\Cli\Helpers\TableObjHelper; /** * A command which is used to update the properties of database table class. * diff --git a/webfiori/framework/cli/commands/VersionCommand.php b/WebFiori/Framework/Cli/Commands/VersionCommand.php similarity index 95% rename from webfiori/framework/cli/commands/VersionCommand.php rename to WebFiori/Framework/Cli/Commands/VersionCommand.php index b395cf90c..3e9934c6f 100644 --- a/webfiori/framework/cli/commands/VersionCommand.php +++ b/WebFiori/Framework/Cli/Commands/VersionCommand.php @@ -8,7 +8,7 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\cli\commands; +namespace WebFiori\Framework\Cli\Commands; use WebFiori\Cli\Command; /** diff --git a/webfiori/framework/cli/commands/WHelpCommand.php b/WebFiori/Framework/Cli/Commands/WHelpCommand.php similarity index 94% rename from webfiori/framework/cli/commands/WHelpCommand.php rename to WebFiori/Framework/Cli/Commands/WHelpCommand.php index a39a2f81b..f0ddf589f 100644 --- a/webfiori/framework/cli/commands/WHelpCommand.php +++ b/WebFiori/Framework/Cli/Commands/WHelpCommand.php @@ -8,9 +8,9 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\cli\commands; +namespace WebFiori\Framework\Cli\Commands; -use WebFiori\Cli\commands\HelpCommand; +use WebFiori\Cli\Commands\HelpCommand; /** * Description of WHelpCommand * diff --git a/webfiori/framework/cli/helpers/ClassInfoReader.php b/WebFiori/Framework/Cli/Helpers/ClassInfoReader.php similarity index 97% rename from webfiori/framework/cli/helpers/ClassInfoReader.php rename to WebFiori/Framework/Cli/Helpers/ClassInfoReader.php index e8fa230ab..a40869c7c 100644 --- a/webfiori/framework/cli/helpers/ClassInfoReader.php +++ b/WebFiori/Framework/Cli/Helpers/ClassInfoReader.php @@ -8,12 +8,12 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\cli\helpers; +namespace WebFiori\Framework\Cli\Helpers; use InvalidArgumentException; use WebFiori\Cli\Command; -use webfiori\framework\cli\CLIUtils; -use webfiori\framework\Util; +use WebFiori\Framework\Cli\CLIUtils; +use WebFiori\Framework\Util; /** * A class which is used to read class information as prompt from any input stream * which is set by the class 'Runner'. diff --git a/webfiori/framework/cli/helpers/CreateAPITestCase.php b/WebFiori/Framework/Cli/Helpers/CreateAPITestCase.php similarity index 93% rename from webfiori/framework/cli/helpers/CreateAPITestCase.php rename to WebFiori/Framework/Cli/Helpers/CreateAPITestCase.php index 56c90e156..6a8d10742 100644 --- a/webfiori/framework/cli/helpers/CreateAPITestCase.php +++ b/WebFiori/Framework/Cli/Helpers/CreateAPITestCase.php @@ -8,10 +8,10 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\cli\helpers; +namespace WebFiori\Framework\Cli\Helpers; -use webfiori\framework\cli\commands\CreateCommand; -use webfiori\framework\writers\APITestCaseWriter; +use WebFiori\Framework\Cli\Commands\CreateCommand; +use WebFiori\Framework\Writers\APITestCaseWriter; use WebFiori\Http\WebServicesManager; /** * A helper class which is used to help in creating test cases for web APIs classes using CLI. @@ -44,7 +44,7 @@ public function readClassInfo() { array_pop($nsArr); $ns = implode('\\', $nsArr); $this->setClassName($this->writer->getServiceName().'Test'); - $this->setNamespace('tests\\'.$ns); + $this->setNamespace($ns); $this->setPath(ROOT_PATH.DS.'tests'.DS.implode(DS, $nsArr)); @@ -67,7 +67,8 @@ private function checkPlace($ns) { $this->writeClass(); } else { $this->writer->setPhpUnitVersion($this->getCommand()->readInteger('PHPUnit Version:', 11)); - $this->setClassInfo('tests\\'.$ns, 'Test'); + $this->setClassInfo($ns, 'Test'); + $this->setPath(ROOT_PATH.DS.'tests'.DS.$this->writer->getNamespace()); $this->writeClass(); } } diff --git a/webfiori/framework/cli/helpers/CreateBackgroundTask.php b/WebFiori/Framework/Cli/Helpers/CreateBackgroundTask.php similarity index 89% rename from webfiori/framework/cli/helpers/CreateBackgroundTask.php rename to WebFiori/Framework/Cli/Helpers/CreateBackgroundTask.php index 1888aa0da..26d6b1cc3 100644 --- a/webfiori/framework/cli/helpers/CreateBackgroundTask.php +++ b/WebFiori/Framework/Cli/Helpers/CreateBackgroundTask.php @@ -8,14 +8,14 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\cli\helpers; +namespace WebFiori\Framework\Cli\Helpers; use InvalidArgumentException; use WebFiori\Cli\InputValidator; -use webfiori\framework\cli\commands\CreateCommand; -use webfiori\framework\scheduler\BaseTask; -use webfiori\framework\scheduler\TaskArgument; -use webfiori\framework\writers\SchedulerTaskClassWriter; +use WebFiori\Framework\Cli\Commands\CreateCommand; +use WebFiori\Framework\Scheduler\BaseTask; +use WebFiori\Framework\Scheduler\TaskArgument; +use WebFiori\Framework\Writers\SchedulerTaskClassWriter; /** * A helper class which is used to help in creating scheduler tasks classes using CLI. * @@ -38,7 +38,7 @@ public function __construct(CreateCommand $command) { $this->taskWriter = $this->getWriter(); } public function readClassInfo() { - $this->setClassInfo(APP_DIR.'\\tasks', 'Task'); + $this->setClassInfo(APP_DIR.'\\Tasks', 'Task'); $taskName = $this->getTaskName(); $taskDesc = $this->getTaskDesc(); diff --git a/webfiori/framework/cli/helpers/CreateCLIClassHelper.php b/WebFiori/Framework/Cli/Helpers/CreateCLIClassHelper.php similarity index 94% rename from webfiori/framework/cli/helpers/CreateCLIClassHelper.php rename to WebFiori/Framework/Cli/Helpers/CreateCLIClassHelper.php index 7557d1aa0..7b05ff331 100644 --- a/webfiori/framework/cli/helpers/CreateCLIClassHelper.php +++ b/WebFiori/Framework/Cli/Helpers/CreateCLIClassHelper.php @@ -8,11 +8,11 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\cli\helpers; +namespace WebFiori\Framework\Cli\Helpers; use WebFiori\Cli\InputValidator; -use webfiori\framework\cli\commands\CreateCommand; -use webfiori\framework\writers\CommandClassWriter; +use WebFiori\Framework\Cli\Commands\CreateCommand; +use WebFiori\Framework\Writers\CommandClassWriter; /** * A helper class which is used to help in creating CLI command classes using CLI. * @@ -35,7 +35,7 @@ public function __construct(CreateCommand $command) { $this->cliWriter = $this->getWriter(); } public function readClassInfo() { - $this->setClassInfo(APP_DIR.'\\commands', 'Command'); + $this->setClassInfo(APP_DIR.'\\Commands', 'Command'); $commandName = $this->getCommandName(); $commandDesc = $this->getInput('Give a short description of the command:'); diff --git a/webfiori/framework/cli/helpers/CreateClassHelper.php b/WebFiori/Framework/Cli/Helpers/CreateClassHelper.php similarity index 98% rename from webfiori/framework/cli/helpers/CreateClassHelper.php rename to WebFiori/Framework/Cli/Helpers/CreateClassHelper.php index be0024db6..46ecbeaed 100644 --- a/webfiori/framework/cli/helpers/CreateClassHelper.php +++ b/WebFiori/Framework/Cli/Helpers/CreateClassHelper.php @@ -8,12 +8,12 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\cli\helpers; +namespace WebFiori\Framework\Cli\Helpers; use WebFiori\Cli\Command; use WebFiori\Cli\InputValidator; -use webfiori\framework\cli\commands\CreateCommand; -use webfiori\framework\writers\ClassWriter; +use WebFiori\Framework\Cli\Commands\CreateCommand; +use WebFiori\Framework\Writers\ClassWriter; /** * A wrapper class which helps in creating classes using CLI. * diff --git a/webfiori/framework/cli/helpers/CreateDBAccessHelper.php b/WebFiori/Framework/Cli/Helpers/CreateDBAccessHelper.php similarity index 93% rename from webfiori/framework/cli/helpers/CreateDBAccessHelper.php rename to WebFiori/Framework/Cli/Helpers/CreateDBAccessHelper.php index 5d8770220..a7b592991 100644 --- a/webfiori/framework/cli/helpers/CreateDBAccessHelper.php +++ b/WebFiori/Framework/Cli/Helpers/CreateDBAccessHelper.php @@ -8,12 +8,12 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\cli\helpers; +namespace WebFiori\Framework\Cli\Helpers; use WebFiori\Database\Table; -use webfiori\framework\App; -use webfiori\framework\cli\commands\CreateCommand; -use webfiori\framework\writers\DBClassWriter; +use WebFiori\Framework\App; +use WebFiori\Framework\Cli\Commands\CreateCommand; +use WebFiori\Framework\Writers\DBClassWriter; /** * Description of CreateDBAccessHelper @@ -51,7 +51,7 @@ public function getTable() : Table { * the namespace at which the class will be added to. */ public function readDbClassInfo() { - $info = $this->getClassInfo(APP_DIR.'\\database', 'DB'); + $info = $this->getClassInfo(APP_DIR.'\\Database', 'DB'); $this->getWriter()->setNamespace($info['namespace']); $this->getWriter()->setPath(ROOT_PATH.DS.$info['namespace']); $this->getWriter()->setClassName($info['name']); @@ -62,7 +62,7 @@ public function readEntityInfo() { $t = $this->getTable(); $m = $t->getEntityMapper(); $m->setEntityName($this->getCommand()->readClassName('Entity class name:', null)); - $m->setNamespace($this->getCommand()->readNamespace('Entity namespace:', APP_DIR.'\\entity')); + $m->setNamespace($this->getCommand()->readNamespace('Entity namespace:', APP_DIR.'\\Entity')); } public function readTable() { $tableClassNameValidity = false; diff --git a/webfiori/framework/cli/helpers/CreateFullRESTHelper.php b/WebFiori/Framework/Cli/Helpers/CreateFullRESTHelper.php similarity index 96% rename from webfiori/framework/cli/helpers/CreateFullRESTHelper.php rename to WebFiori/Framework/Cli/Helpers/CreateFullRESTHelper.php index d9333e3b3..a15324ece 100644 --- a/webfiori/framework/cli/helpers/CreateFullRESTHelper.php +++ b/WebFiori/Framework/Cli/Helpers/CreateFullRESTHelper.php @@ -8,20 +8,20 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\cli\helpers; +namespace WebFiori\Framework\Cli\Helpers; use WebFiori\Database\ConnectionInfo; use WebFiori\Database\MsSql\MSSQLTable; use WebFiori\Database\MySql\MySQLTable; use WebFiori\Database\Table; -use webfiori\framework\cli\CLIUtils; -use webfiori\framework\writers\DBClassWriter; -use webfiori\framework\writers\ServiceHolder; -use webfiori\framework\writers\TableClassWriter; -use webfiori\framework\writers\WebServiceWriter; +use WebFiori\Framework\Cli\CLIUtils; +use WebFiori\Framework\Writers\DBClassWriter; +use WebFiori\Framework\Writers\ServiceHolder; +use WebFiori\Framework\Writers\TableClassWriter; +use WebFiori\Framework\Writers\WebServiceWriter; use WebFiori\Json\Json; /** - * A helper class for creating database tables classes. + * A helper class for creating database Tables classes. * * @author Ibrahim */ @@ -207,11 +207,11 @@ private function IncludeAPISetProps(WebServiceWriter $w, $type) { } private function readAPIInfo() { - $this->apisNs = CLIUtils::readNamespace($this->getCommand(), APP_DIR.'\\apis',"Last thing needed is to provide us with namespace for web services:"); + $this->apisNs = CLIUtils::readNamespace($this->getCommand(), APP_DIR.'\\Apis',"Last thing needed is to provide us with namespace for web services:"); } private function readEntityInfo() { $this->println("First thing, we need entity class information."); - $entityInfo = $this->getClassInfo(APP_DIR.'\\entity'); + $entityInfo = $this->getClassInfo(APP_DIR.'\\Entity'); $entityInfo['implement-jsoni'] = $this->confirm('Would you like from your entity class to implement the interface JsonI?', true); $this->tableObjWriter->setEntityInfo($entityInfo['name'], $entityInfo['namespace'], $entityInfo['path'], $entityInfo['implement-jsoni']); @@ -230,7 +230,7 @@ private function readEntityInfo() { } private function readTableInfo() { $this->println("Now, time to collect database table information."); - $ns = CLIUtils::readNamespace($this->getCommand(), APP_DIR.'\\database', 'Provide us with a namespace for table class:'); + $ns = CLIUtils::readNamespace($this->getCommand(), APP_DIR.'\\Database', 'Provide us with a namespace for table class:'); $this->tableObjWriter->setNamespace($ns); $this->tableObjWriter->setPath(ROOT_PATH.DS.$ns); diff --git a/webfiori/framework/cli/helpers/CreateMiddleware.php b/WebFiori/Framework/Cli/Helpers/CreateMiddleware.php similarity index 90% rename from webfiori/framework/cli/helpers/CreateMiddleware.php rename to WebFiori/Framework/Cli/Helpers/CreateMiddleware.php index ae3698501..32b7fbe35 100644 --- a/webfiori/framework/cli/helpers/CreateMiddleware.php +++ b/WebFiori/Framework/Cli/Helpers/CreateMiddleware.php @@ -8,11 +8,11 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\cli\helpers; +namespace WebFiori\Framework\Cli\Helpers; use WebFiori\Cli\InputValidator; -use webfiori\framework\cli\commands\CreateCommand; -use webfiori\framework\writers\MiddlewareClassWriter; +use WebFiori\Framework\Cli\Commands\CreateCommand; +use WebFiori\Framework\Writers\MiddlewareClassWriter; /** * A helper class that works with the create command to create a middleware. * @@ -35,7 +35,7 @@ public function __construct(CreateCommand $command) { $this->mdWriter = $this->getWriter(); } public function readClassInfo() { - $this->setClassInfo(APP_DIR.'\\middleware', 'Middleware'); + $this->setClassInfo(APP_DIR.'\\Middleware', 'Middleware'); $middlewareName = $this->getMiddlewareName(); $priority = $this->getCommand()->readInteger('Enter middleware priority:', 0); diff --git a/webfiori/framework/cli/helpers/CreateMigration.php b/WebFiori/Framework/Cli/Helpers/CreateMigration.php similarity index 83% rename from webfiori/framework/cli/helpers/CreateMigration.php rename to WebFiori/Framework/Cli/Helpers/CreateMigration.php index a50d8f7b8..b208ce1e8 100644 --- a/webfiori/framework/cli/helpers/CreateMigration.php +++ b/WebFiori/Framework/Cli/Helpers/CreateMigration.php @@ -8,12 +8,12 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\cli\helpers; +namespace WebFiori\Framework\Cli\Helpers; use WebFiori\Database\Schema\SchemaRunner; -use webfiori\framework\cli\CLIUtils; -use webfiori\framework\cli\commands\CreateCommand; -use webfiori\framework\writers\DatabaseMigrationWriter; +use WebFiori\Framework\Cli\CLIUtils; +use WebFiori\Framework\Cli\Commands\CreateCommand; +use WebFiori\Framework\Writers\DatabaseMigrationWriter; /** * A helper class which is used to help in creating scheduler tasks classes using CLI. * @@ -29,7 +29,7 @@ class CreateMigration extends CreateClassHelper { * @param CreateCommand $command A command that is used to call the class. */ public function __construct(CreateCommand $command) { - $ns = APP_DIR.'\\database\\migrations'; + $ns = APP_DIR.'\\Database\\migrations'; if (!$command->isArgProvided('--defaults')) { $ns = CLIUtils::readNamespace($command, $ns , 'Migration namespace:'); } diff --git a/webfiori/framework/cli/helpers/CreateTableObj.php b/WebFiori/Framework/Cli/Helpers/CreateTableObj.php similarity index 88% rename from webfiori/framework/cli/helpers/CreateTableObj.php rename to WebFiori/Framework/Cli/Helpers/CreateTableObj.php index a0df9f673..2d0111eee 100644 --- a/webfiori/framework/cli/helpers/CreateTableObj.php +++ b/WebFiori/Framework/Cli/Helpers/CreateTableObj.php @@ -8,17 +8,17 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\cli\helpers; +namespace WebFiori\Framework\Cli\Helpers; use WebFiori\Cli\Command; use WebFiori\Database\ConnectionInfo; use WebFiori\Database\MsSql\MSSQLTable; use WebFiori\Database\MySql\MySQLTable; -use webfiori\framework\cli\commands\CreateCommand; -use webfiori\framework\writers\TableClassWriter; +use WebFiori\Framework\Cli\Commands\CreateCommand; +use WebFiori\Framework\Writers\TableClassWriter; use WebFiori\Json\CaseConverter; /** - * A helper class for creating database tables classes. + * A helper class for creating database Tables classes. * * @author Ibrahim */ @@ -43,7 +43,7 @@ public function readClassInfo() { $tempTable = new MSSQLTable(); } $this->getWriter()->setTable($tempTable); - $this->setClassInfo(APP_DIR.'\\database', 'Table'); + $this->setClassInfo(APP_DIR.'\\Database', 'Table'); $tableHelper = new TableObjHelper($this, $tempTable); $tableHelper->setTableName(CaseConverter::toSnakeCase($this->getWriter()->getName())); diff --git a/webfiori/framework/cli/helpers/CreateThemeHelper.php b/WebFiori/Framework/Cli/Helpers/CreateThemeHelper.php similarity index 80% rename from webfiori/framework/cli/helpers/CreateThemeHelper.php rename to WebFiori/Framework/Cli/Helpers/CreateThemeHelper.php index be3663dae..5a487d7cf 100644 --- a/webfiori/framework/cli/helpers/CreateThemeHelper.php +++ b/WebFiori/Framework/Cli/Helpers/CreateThemeHelper.php @@ -8,10 +8,10 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\cli\helpers; +namespace WebFiori\Framework\Cli\Helpers; -use webfiori\framework\cli\commands\CreateCommand; -use webfiori\framework\writers\ThemeClassWriter; +use WebFiori\Framework\Cli\Commands\CreateCommand; +use WebFiori\Framework\Writers\ThemeClassWriter; /** * Description of CreateTheme * @@ -27,7 +27,7 @@ public function __construct(CreateCommand $command) { parent::__construct($command, new ThemeClassWriter('New Theme')); } public function readClassInfo() { - $this->setClassInfo('themes', 'Theme'); + $this->setClassInfo('Themes', 'Theme'); $this->println('Creating theme at "'.$this->getWriter()->getPath().'"...'); $this->writeClass(); diff --git a/webfiori/framework/cli/helpers/CreateWebService.php b/WebFiori/Framework/Cli/Helpers/CreateWebService.php similarity index 95% rename from webfiori/framework/cli/helpers/CreateWebService.php rename to WebFiori/Framework/Cli/Helpers/CreateWebService.php index 1fcb6e992..6792c0e72 100644 --- a/webfiori/framework/cli/helpers/CreateWebService.php +++ b/WebFiori/Framework/Cli/Helpers/CreateWebService.php @@ -8,11 +8,11 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\cli\helpers; +namespace WebFiori\Framework\Cli\Helpers; -use webfiori\framework\cli\commands\CreateCommand; -use webfiori\framework\writers\ServiceHolder; -use webfiori\framework\writers\WebServiceWriter; +use WebFiori\Framework\Cli\Commands\CreateCommand; +use WebFiori\Framework\Writers\ServiceHolder; +use WebFiori\Framework\Writers\WebServiceWriter; use WebFiori\Http\ParamType; use WebFiori\Http\RequestMethod; use WebFiori\Http\RequestParameter; @@ -49,7 +49,7 @@ public function addRequestMethods() { } } public function readClassInfo() { - $this->setClassInfo(APP_DIR.'\\apis', 'Service'); + $this->setClassInfo(APP_DIR.'\\Apis', 'Service'); $this->setServiceName(); $this->serviceObj->setDescription($this->getInput('Description:')); diff --git a/webfiori/framework/cli/helpers/TableObjHelper.php b/WebFiori/Framework/Cli/Helpers/TableObjHelper.php similarity index 98% rename from webfiori/framework/cli/helpers/TableObjHelper.php rename to WebFiori/Framework/Cli/Helpers/TableObjHelper.php index 5cd70a1e9..fbff68dc6 100644 --- a/webfiori/framework/cli/helpers/TableObjHelper.php +++ b/WebFiori/Framework/Cli/Helpers/TableObjHelper.php @@ -8,7 +8,7 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\cli\helpers; +namespace WebFiori\Framework\Cli\Helpers; use Throwable; use WebFiori\Cli\Command; @@ -18,9 +18,9 @@ use WebFiori\Database\MySql\MySQLColumn; use WebFiori\Database\MySql\MySQLTable; use WebFiori\Database\Table; -use webfiori\framework\App; -use webfiori\framework\cli\commands\UpdateTableCommand; -use webfiori\framework\DB; +use WebFiori\Framework\App; +use WebFiori\Framework\Cli\Commands\UpdateTableCommand; +use WebFiori\Framework\DB; /** * A CLI class helper which has methods to help in creating and @@ -189,7 +189,7 @@ public function copyCheck() { $helper = $this->getCreateHelper(); if ($helper->confirm('Would you like to update same class or create a copy with the update?', false)) { - $info = $helper->getClassInfo(APP_DIR.'\\database', 'Table'); + $info = $helper->getClassInfo(APP_DIR.'\\Database', 'Table'); $helper->setClassName($info['name']); $helper->setNamespace($info['namespace']); $helper->setPath($info['path']); @@ -203,7 +203,7 @@ public function copyCheck() { */ public function createEntity() { $helper = $this->getCreateHelper(); - $entityInfo = $helper->getClassInfo(APP_DIR.'\\entity'); + $entityInfo = $helper->getClassInfo(APP_DIR.'\\Entity'); $entityInfo['implement-jsoni'] = $helper->confirm('Would you like from your entity class to implement the interface JsonI?', true); $helper->getWriter()->setEntityInfo($entityInfo['name'], $entityInfo['namespace'], $entityInfo['path'], $entityInfo['implement-jsoni']); diff --git a/webfiori/framework/config/ClassDriver.php b/WebFiori/Framework/Config/ClassDriver.php similarity index 99% rename from webfiori/framework/config/ClassDriver.php rename to WebFiori/Framework/Config/ClassDriver.php index 7d63becfa..3c4647836 100644 --- a/webfiori/framework/config/ClassDriver.php +++ b/WebFiori/Framework/Config/ClassDriver.php @@ -1,25 +1,25 @@ '$title',"); - if (!class_exists(APP_DIR.'\\langs\\Lang'.$langCode)) { + if (!class_exists(APP_DIR.'\\Langs\\Lang'.$langCode)) { //This requires a fix in the future $dir = $langCode == 'AR' ? 'rtl' : 'ltr'; diff --git a/webfiori/framework/config/ConfigurationDriver.php b/WebFiori/Framework/Config/ConfigurationDriver.php similarity index 99% rename from webfiori/framework/config/ConfigurationDriver.php rename to WebFiori/Framework/Config/ConfigurationDriver.php index 9c29a0b21..93382a08b 100644 --- a/webfiori/framework/config/ConfigurationDriver.php +++ b/WebFiori/Framework/Config/ConfigurationDriver.php @@ -1,5 +1,5 @@ translation; } /** - * Auto-register services tables which exist on a specific directory. + * Auto-register services Tables which exist on a specific directory. * * The classes which represents web services must be suffixed * with the word 'Service' in order to register them (e.g. RegisterUserService). diff --git a/webfiori/framework/handlers/APICallErrHandler.php b/WebFiori/Framework/Handlers/APICallErrHandler.php similarity index 96% rename from webfiori/framework/handlers/APICallErrHandler.php rename to WebFiori/Framework/Handlers/APICallErrHandler.php index b32bed9ee..50db4ba3a 100644 --- a/webfiori/framework/handlers/APICallErrHandler.php +++ b/WebFiori/Framework/Handlers/APICallErrHandler.php @@ -8,11 +8,11 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\handlers; +namespace WebFiori\Framework\Handlers; use WebFiori\Error\AbstractHandler; -use webfiori\framework\App; -use webfiori\framework\router\Router; +use WebFiori\Framework\App; +use WebFiori\Framework\Router\Router; use WebFiori\Http\Request; use WebFiori\Http\Response; use WebFiori\Json\Json; diff --git a/webfiori/framework/handlers/CLIErrHandler.php b/WebFiori/Framework/Handlers/CLIErrHandler.php similarity index 96% rename from webfiori/framework/handlers/CLIErrHandler.php rename to WebFiori/Framework/Handlers/CLIErrHandler.php index d3ec23de3..8014afbe6 100644 --- a/webfiori/framework/handlers/CLIErrHandler.php +++ b/WebFiori/Framework/Handlers/CLIErrHandler.php @@ -8,13 +8,13 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\handlers; +namespace WebFiori\Framework\Handlers; use WebFiori\Cli\Formatter; use WebFiori\Cli\Runner; use WebFiori\Error\AbstractHandler; -use webfiori\framework\App; -use webfiori\framework\scheduler\TasksManager; +use WebFiori\Framework\App; +use WebFiori\Framework\Scheduler\TasksManager; /** * Exceptions handler which is used to handle exceptions in case of running * CLI applications. diff --git a/webfiori/framework/handlers/HTTPErrHandler.php b/WebFiori/Framework/Handlers/HTTPErrHandler.php similarity index 93% rename from webfiori/framework/handlers/HTTPErrHandler.php rename to WebFiori/Framework/Handlers/HTTPErrHandler.php index 49834d1fc..bd8de0c38 100644 --- a/webfiori/framework/handlers/HTTPErrHandler.php +++ b/WebFiori/Framework/Handlers/HTTPErrHandler.php @@ -8,12 +8,12 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\handlers; +namespace WebFiori\Framework\Handlers; use WebFiori\Error\AbstractHandler; -use webfiori\framework\App; -use webfiori\framework\router\Router; -use webfiori\framework\ui\serverErrPage\ServerErrPage; +use WebFiori\Framework\App; +use WebFiori\Framework\Router\Router; +use WebFiori\Framework\Ui\ServerErrPage\ServerErrPage; use WebFiori\Http\Request; use WebFiori\Http\Response; /** diff --git a/webfiori/framework/Ini.php b/WebFiori/Framework/Ini.php similarity index 82% rename from webfiori/framework/Ini.php rename to WebFiori/Framework/Ini.php index c5b7e20a8..053c8b96c 100644 --- a/webfiori/framework/Ini.php +++ b/WebFiori/Framework/Ini.php @@ -8,11 +8,11 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework; +namespace WebFiori\Framework; use WebFiori\File\exceptions\FileException; use WebFiori\File\File; -use webfiori\framework\config\ClassDriver; +use WebFiori\Framework\Config\ClassDriver; use WebFiori\Json\Json; /** * A class which is used to create application initialization classes. @@ -48,15 +48,15 @@ private function __construct() { public static function createAppDirs() { $DS = DIRECTORY_SEPARATOR; self::mkdir(ROOT_PATH.$DS.APP_DIR); - self::mkdir(ROOT_PATH.$DS.APP_DIR.$DS.'ini'); - self::mkdir(ROOT_PATH.$DS.APP_DIR.$DS.'ini'.$DS.'routes'); - self::mkdir(ROOT_PATH.$DS.APP_DIR.$DS.'pages'); - self::mkdir(ROOT_PATH.$DS.APP_DIR.$DS.'commands'); - self::mkdir(ROOT_PATH.$DS.APP_DIR.$DS.'tasks'); - self::mkdir(ROOT_PATH.$DS.APP_DIR.$DS.'middleware'); - self::mkdir(ROOT_PATH.$DS.APP_DIR.$DS.'langs'); - self::mkdir(ROOT_PATH.$DS.APP_DIR.$DS.'apis'); - self::mkdir(ROOT_PATH.$DS.APP_DIR.$DS.'config'); + self::mkdir(ROOT_PATH.$DS.APP_DIR.$DS.'Init'); + self::mkdir(ROOT_PATH.$DS.APP_DIR.$DS.'Init'.$DS.'Routes'); + self::mkdir(ROOT_PATH.$DS.APP_DIR.$DS.'Pages'); + self::mkdir(ROOT_PATH.$DS.APP_DIR.$DS.'Commands'); + self::mkdir(ROOT_PATH.$DS.APP_DIR.$DS.'Tasks'); + self::mkdir(ROOT_PATH.$DS.APP_DIR.$DS.'Middleware'); + self::mkdir(ROOT_PATH.$DS.APP_DIR.$DS.'Langs'); + self::mkdir(ROOT_PATH.$DS.APP_DIR.$DS.'Apis'); + self::mkdir(ROOT_PATH.$DS.APP_DIR.$DS.'Config'); self::mkdir(ROOT_PATH.$DS.APP_DIR.$DS.'sto'); self::mkdir(ROOT_PATH.$DS.APP_DIR.$DS.'sto'.$DS.'uploads'); self::mkdir(ROOT_PATH.$DS.APP_DIR.$DS.'sto'.$DS.'logs'); @@ -79,13 +79,13 @@ public static function createAppDirs() { * @throws FileException */ public function createIniClass(string $className, string $comment) { - $cFile = new File("$className.php", APP_PATH.'ini'); + $cFile = new File("$className.php", APP_PATH.'Init'); $cFile->remove(); $cFile->create(); ClassDriver::a($cFile, [ "create(true); $cFile->write(); - require_once APP_PATH.'ini'.DS."$className.php"; + require_once APP_PATH.'Init'.DS."$className.php"; } /** @@ -117,13 +117,13 @@ public function createIniClass(string $className, string $comment) { * @throws FileException */ public function createRoutesClass(string $className) { - $cFile = new File("$className.php", APP_PATH.'ini'.DS.'routes'); + $cFile = new File("$className.php", APP_PATH.'Init'.DS.'Routes'); $cFile->remove(); ClassDriver::a($cFile, "docStart, 1); diff --git a/webfiori/framework/Lang.php b/WebFiori/Framework/Lang.php similarity index 98% rename from webfiori/framework/Lang.php rename to WebFiori/Framework/Lang.php index aa4ed3576..54113e361 100644 --- a/webfiori/framework/Lang.php +++ b/WebFiori/Framework/Lang.php @@ -8,10 +8,10 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework; +namespace WebFiori\Framework; -use webfiori\framework\exceptions\MissingLangException; -use webfiori\framework\session\SessionsManager; +use WebFiori\Framework\Exceptions\MissingLangException; +use WebFiori\Framework\Session\SessionsManager; use WebFiori\Http\Request; /** @@ -310,7 +310,7 @@ public static function loadTranslation(string $langCode) { return self::getActive(); } - $langClassName = APP_DIR.'\\langs\\Lang'.$uLangCode; + $langClassName = APP_DIR.'\\Langs\\Lang'.$uLangCode; if (!class_exists($langClassName)) { throw new MissingLangException('No language class was found for the language \''.$uLangCode.'\'.'); diff --git a/webfiori/framework/middleware/AbstractMiddleware.php b/WebFiori/Framework/Middleware/AbstractMiddleware.php similarity index 98% rename from webfiori/framework/middleware/AbstractMiddleware.php rename to WebFiori/Framework/Middleware/AbstractMiddleware.php index 8f26b6be8..ef034b0cd 100644 --- a/webfiori/framework/middleware/AbstractMiddleware.php +++ b/WebFiori/Framework/Middleware/AbstractMiddleware.php @@ -8,7 +8,7 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\middleware; +namespace WebFiori\Framework\Middleware; use WebFiori\Collections\Comparable; use WebFiori\Http\Request; @@ -17,7 +17,7 @@ /** * An abstract class that can be used to implement custom middleware. * - * Every middleware the developer write must be placed in the folder 'app/middleware' + * Every middleware the developer write must be placed in the folder '[APP_DIR]/Middleware' * of the framework in order for the framework to auto-register the middleware. * If the middleware is placed in another place, then the developer must register * it manually using the method MiddlewareManager::register() before adding diff --git a/webfiori/framework/middleware/CacheMiddleware.php b/WebFiori/Framework/Middleware/CacheMiddleware.php similarity index 96% rename from webfiori/framework/middleware/CacheMiddleware.php rename to WebFiori/Framework/Middleware/CacheMiddleware.php index 4dc4572de..696a6592c 100644 --- a/webfiori/framework/middleware/CacheMiddleware.php +++ b/WebFiori/Framework/Middleware/CacheMiddleware.php @@ -1,10 +1,10 @@ * * * * * /usr/bin/php path/to/webfiori --scheduler check p=<password>

+ *

* * * * * /usr/bin/php path/to/WebFiori --scheduler check p=<password>

* Where <password> is the password * that was set by the developer to protect the tasks from unauthorized access. * If no password is set, then it can be removed from the command. @@ -586,7 +586,7 @@ public static function monthlyTask(int $dayNumber, string $time, string $name, c */ public static function registerTasks() { if (Runner::isCLI() || (defined('SCHEDULER_THROUGH_HTTP') && SCHEDULER_THROUGH_HTTP === true)) { - App::autoRegister('tasks', function (AbstractTask $task) + App::autoRegister('Tasks', function (AbstractTask $task) { TasksManager::scheduleTask($task); }); diff --git a/webfiori/framework/scheduler/webServices/ForceTaskExecutionService.php b/WebFiori/Framework/Scheduler/WebServices/ForceTaskExecutionService.php similarity index 94% rename from webfiori/framework/scheduler/webServices/ForceTaskExecutionService.php rename to WebFiori/Framework/Scheduler/WebServices/ForceTaskExecutionService.php index 55614882f..97484a268 100644 --- a/webfiori/framework/scheduler/webServices/ForceTaskExecutionService.php +++ b/WebFiori/Framework/Scheduler/WebServices/ForceTaskExecutionService.php @@ -8,9 +8,9 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\scheduler\webServices; +namespace WebFiori\Framework\Scheduler\WebServices; -use webfiori\framework\scheduler\TasksManager; +use WebFiori\Framework\Scheduler\TasksManager; use WebFiori\Http\RequestParameter; use WebFiori\Http\WebServicesManager; use WebFiori\Json\Json; diff --git a/webfiori/framework/scheduler/webServices/GetTasksService.php b/WebFiori/Framework/Scheduler/WebServices/GetTasksService.php similarity index 88% rename from webfiori/framework/scheduler/webServices/GetTasksService.php rename to WebFiori/Framework/Scheduler/WebServices/GetTasksService.php index e8f7b5e52..a338cda21 100644 --- a/webfiori/framework/scheduler/webServices/GetTasksService.php +++ b/WebFiori/Framework/Scheduler/WebServices/GetTasksService.php @@ -8,9 +8,9 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\scheduler\webServices; +namespace WebFiori\Framework\Scheduler\WebServices; -use webfiori\framework\scheduler\TasksManager; +use WebFiori\Framework\Scheduler\TasksManager; use WebFiori\Json\Json; /** * A web service which is used to fetch a list of all scheduled tasks. diff --git a/webfiori/framework/scheduler/webServices/PrivateSchedulerService.php b/WebFiori/Framework/Scheduler/WebServices/PrivateSchedulerService.php similarity index 86% rename from webfiori/framework/scheduler/webServices/PrivateSchedulerService.php rename to WebFiori/Framework/Scheduler/WebServices/PrivateSchedulerService.php index d9e2b3f37..09ebe6eb5 100644 --- a/webfiori/framework/scheduler/webServices/PrivateSchedulerService.php +++ b/WebFiori/Framework/Scheduler/WebServices/PrivateSchedulerService.php @@ -1,7 +1,7 @@ getDocument()->getBody()->addChild('script', [ 'type' => 'text/javascript', - 'src' => 'https://cdn.jsdelivr.net/gh/webfiori/framework@'.WF_VERSION.'/assets/js/scheduler-logic.js', + 'src' => 'https://cdn.jsdelivr.net/gh/WebFiori/framework@'.WF_VERSION.'/assets/js/scheduler-logic.js', ]); }); } diff --git a/webfiori/framework/scheduler/webUI/ListTasksPage.php b/WebFiori/Framework/Scheduler/WebUI/ListTasksPage.php similarity index 98% rename from webfiori/framework/scheduler/webUI/ListTasksPage.php rename to WebFiori/Framework/Scheduler/WebUI/ListTasksPage.php index 6a326834d..5117fdcf3 100644 --- a/webfiori/framework/scheduler/webUI/ListTasksPage.php +++ b/WebFiori/Framework/Scheduler/WebUI/ListTasksPage.php @@ -8,7 +8,7 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\scheduler\webUI; +namespace WebFiori\Framework\Scheduler\WebUI; use WebFiori\File\File; use WebFiori\Http\Response; diff --git a/webfiori/framework/scheduler/webUI/SetPasswordPage.php b/WebFiori/Framework/Scheduler/WebUI/SetPasswordPage.php similarity index 84% rename from webfiori/framework/scheduler/webUI/SetPasswordPage.php rename to WebFiori/Framework/Scheduler/WebUI/SetPasswordPage.php index 8fe6dcf5e..8b8741119 100644 --- a/webfiori/framework/scheduler/webUI/SetPasswordPage.php +++ b/WebFiori/Framework/Scheduler/WebUI/SetPasswordPage.php @@ -1,7 +1,7 @@ diff --git a/webfiori/framework/scheduler/webUI/templates/set-password-form.html b/WebFiori/Framework/Scheduler/WebUI/templates/set-password-form.html similarity index 100% rename from webfiori/framework/scheduler/webUI/templates/set-password-form.html rename to WebFiori/Framework/Scheduler/WebUI/templates/set-password-form.html diff --git a/webfiori/framework/scheduler/webUI/templates/tasks-table.html b/WebFiori/Framework/Scheduler/WebUI/templates/tasks-table.html similarity index 100% rename from webfiori/framework/scheduler/webUI/templates/tasks-table.html rename to WebFiori/Framework/Scheduler/WebUI/templates/tasks-table.html diff --git a/webfiori/framework/session/DatabaseSessionStorage.php b/WebFiori/Framework/Session/DatabaseSessionStorage.php similarity index 93% rename from webfiori/framework/session/DatabaseSessionStorage.php rename to WebFiori/Framework/Session/DatabaseSessionStorage.php index eec797eb6..daf0a1f43 100644 --- a/webfiori/framework/session/DatabaseSessionStorage.php +++ b/WebFiori/Framework/Session/DatabaseSessionStorage.php @@ -8,10 +8,10 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\session; +namespace WebFiori\Framework\Session; use WebFiori\Database\DatabaseException; -use webfiori\framework\exceptions\SessionException; +use WebFiori\Framework\Exceptions\SessionException; /** * A session storage engine which uses database to store session state. @@ -47,9 +47,9 @@ public function __construct() { } } /** - * Drop the tables which are used to store session information. + * Drop the Tables which are used to store session information. * - * The method will drop two tables, the table 'session_data' and the + * The method will drop two Tables, the table 'session_data' and the * table 'sessions'. */ public function dropTables() { diff --git a/webfiori/framework/session/DefaultSessionStorage.php b/WebFiori/Framework/Session/DefaultSessionStorage.php similarity index 98% rename from webfiori/framework/session/DefaultSessionStorage.php rename to WebFiori/Framework/Session/DefaultSessionStorage.php index d379e44e5..496116b25 100644 --- a/webfiori/framework/session/DefaultSessionStorage.php +++ b/WebFiori/Framework/Session/DefaultSessionStorage.php @@ -8,12 +8,12 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\session; +namespace WebFiori\Framework\Session; use WebFiori\Cli\Runner; use WebFiori\File\exceptions\FileException; use WebFiori\File\File; -use webfiori\framework\exceptions\SessionException; +use WebFiori\Framework\Exceptions\SessionException; /** * The default sessions storage engine. * diff --git a/webfiori/framework/session/MSSQLSessionDataTable.php b/WebFiori/Framework/Session/MSSQLSessionDataTable.php similarity index 97% rename from webfiori/framework/session/MSSQLSessionDataTable.php rename to WebFiori/Framework/Session/MSSQLSessionDataTable.php index 73d4d01fc..6d6d322a5 100644 --- a/webfiori/framework/session/MSSQLSessionDataTable.php +++ b/WebFiori/Framework/Session/MSSQLSessionDataTable.php @@ -8,7 +8,7 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\session; +namespace WebFiori\Framework\Session; use WebFiori\Database\MsSql\MSSQLTable; diff --git a/webfiori/framework/session/MSSQLSessionsTable.php b/WebFiori/Framework/Session/MSSQLSessionsTable.php similarity index 97% rename from webfiori/framework/session/MSSQLSessionsTable.php rename to WebFiori/Framework/Session/MSSQLSessionsTable.php index 6e6fcee3c..db7504239 100644 --- a/webfiori/framework/session/MSSQLSessionsTable.php +++ b/WebFiori/Framework/Session/MSSQLSessionsTable.php @@ -8,7 +8,7 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\session; +namespace WebFiori\Framework\Session; use WebFiori\Database\MsSql\MSSQLTable; /** diff --git a/webfiori/framework/session/MySQLSessionDataTable.php b/WebFiori/Framework/Session/MySQLSessionDataTable.php similarity index 97% rename from webfiori/framework/session/MySQLSessionDataTable.php rename to WebFiori/Framework/Session/MySQLSessionDataTable.php index 2413bc4a1..7ca18429f 100644 --- a/webfiori/framework/session/MySQLSessionDataTable.php +++ b/WebFiori/Framework/Session/MySQLSessionDataTable.php @@ -8,7 +8,7 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\session; +namespace WebFiori\Framework\Session; use WebFiori\Database\MySql\MySQLTable; diff --git a/webfiori/framework/session/MySQLSessionsTable.php b/WebFiori/Framework/Session/MySQLSessionsTable.php similarity index 97% rename from webfiori/framework/session/MySQLSessionsTable.php rename to WebFiori/Framework/Session/MySQLSessionsTable.php index a7ab4f303..0d36515c8 100644 --- a/webfiori/framework/session/MySQLSessionsTable.php +++ b/WebFiori/Framework/Session/MySQLSessionsTable.php @@ -8,7 +8,7 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\session; +namespace WebFiori\Framework\Session; use WebFiori\Database\MySql\MySQLTable; diff --git a/webfiori/framework/session/Session.php b/WebFiori/Framework/Session/Session.php similarity index 99% rename from webfiori/framework/session/Session.php rename to WebFiori/Framework/Session/Session.php index adae7c5b1..6aac552c3 100644 --- a/webfiori/framework/session/Session.php +++ b/WebFiori/Framework/Session/Session.php @@ -8,10 +8,10 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\session; +namespace WebFiori\Framework\Session; -use webfiori\framework\App; -use webfiori\framework\exceptions\SessionException; +use WebFiori\Framework\App; +use WebFiori\Framework\Exceptions\SessionException; use WebFiori\Http\HttpCookie; use WebFiori\Http\Request; use WebFiori\Json\Json; diff --git a/webfiori/framework/session/SessionDB.php b/WebFiori/Framework/Session/SessionDB.php similarity index 98% rename from webfiori/framework/session/SessionDB.php rename to WebFiori/Framework/Session/SessionDB.php index f3bcd5948..792ddd75c 100644 --- a/webfiori/framework/session/SessionDB.php +++ b/WebFiori/Framework/Session/SessionDB.php @@ -8,10 +8,10 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\session; +namespace WebFiori\Framework\Session; use WebFiori\Database\DatabaseException; -use webfiori\framework\DB; +use WebFiori\Framework\DB; /** * A class which includes all database related operations to add, update, * and delete sessions from a database. @@ -155,7 +155,7 @@ public function removeSession(string $sId) { $this->table('sessions')->delete()->where('s-id', $sId)->execute(); } /** - * Removes database tables which are used to store session information. + * Removes database Tables which are used to store session information. */ public function removeTables() { $this->transaction(function (DB $db) diff --git a/webfiori/framework/session/SessionOption.php b/WebFiori/Framework/Session/SessionOption.php similarity index 96% rename from webfiori/framework/session/SessionOption.php rename to WebFiori/Framework/Session/SessionOption.php index a78065346..a7953a634 100644 --- a/webfiori/framework/session/SessionOption.php +++ b/WebFiori/Framework/Session/SessionOption.php @@ -8,7 +8,7 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\session; +namespace WebFiori\Framework\Session; /** * A class which is used to hold the options names that are supported during diff --git a/webfiori/framework/session/SessionStatus.php b/WebFiori/Framework/Session/SessionStatus.php similarity index 96% rename from webfiori/framework/session/SessionStatus.php rename to WebFiori/Framework/Session/SessionStatus.php index 460037183..bb4a840f4 100644 --- a/webfiori/framework/session/SessionStatus.php +++ b/WebFiori/Framework/Session/SessionStatus.php @@ -8,7 +8,7 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\session; +namespace WebFiori\Framework\Session; /** * A class which is used to hold constants which represents different statuses diff --git a/webfiori/framework/session/SessionStorage.php b/WebFiori/Framework/Session/SessionStorage.php similarity index 97% rename from webfiori/framework/session/SessionStorage.php rename to WebFiori/Framework/Session/SessionStorage.php index 3ce1085ca..9a106d4da 100644 --- a/webfiori/framework/session/SessionStorage.php +++ b/WebFiori/Framework/Session/SessionStorage.php @@ -8,7 +8,7 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\session; +namespace WebFiori\Framework\Session; /** * An interface which can be used to implement different types of sessions storage. diff --git a/webfiori/framework/session/SessionUser.php b/WebFiori/Framework/Session/SessionUser.php similarity index 97% rename from webfiori/framework/session/SessionUser.php rename to WebFiori/Framework/Session/SessionUser.php index 45759f167..198a95665 100644 --- a/webfiori/framework/session/SessionUser.php +++ b/WebFiori/Framework/Session/SessionUser.php @@ -8,7 +8,7 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\session; +namespace WebFiori\Framework\Session; /** * An interface which is used to tell if an entity can represents session diff --git a/webfiori/framework/session/SessionsManager.php b/WebFiori/Framework/Session/SessionsManager.php similarity index 98% rename from webfiori/framework/session/SessionsManager.php rename to WebFiori/Framework/Session/SessionsManager.php index 929843086..6d9905559 100644 --- a/webfiori/framework/session/SessionsManager.php +++ b/WebFiori/Framework/Session/SessionsManager.php @@ -8,9 +8,9 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\session; +namespace WebFiori\Framework\Session; -use webfiori\framework\exceptions\SessionException; +use WebFiori\Framework\Exceptions\SessionException; use WebFiori\Http\Request; /** * A class which is used to manage user sessions. @@ -65,10 +65,10 @@ private function __construct() { $constructor = WF_SESSION_STORAGE.''; $classObj = new $constructor(); - if (is_subclass_of($classObj, '\webfiori\framework\session\SessionStorage')) { + if (is_subclass_of($classObj, '\WebFiori\Framework\Session\SessionStorage')) { $this->sessionStorage = $classObj; } else { - throw new SessionException('The class "'.WF_SESSION_STORAGE.'" does not implement "\webfiori\framework\session\SessionStorage".'); + throw new SessionException('The class "'.WF_SESSION_STORAGE.'" does not implement "\WebFiori\Framework\Session\SessionStorage".'); } } diff --git a/webfiori/framework/Theme.php b/WebFiori/Framework/Theme.php similarity index 99% rename from webfiori/framework/Theme.php rename to WebFiori/Framework/Theme.php index 930c13e4a..a5dafc576 100644 --- a/webfiori/framework/Theme.php +++ b/WebFiori/Framework/Theme.php @@ -8,15 +8,15 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework; +namespace WebFiori\Framework; use ReflectionClass; -use webfiori\framework\ui\WebPage; +use WebFiori\Framework\Ui\WebPage; use WebFiori\Json\Json; use WebFiori\Json\JsonI; -use WebFiori\UI\exceptions\InvalidNodeNameException; -use WebFiori\UI\HeadNode; -use WebFiori\UI\HTMLNode; +use WebFiori\Ui\exceptions\InvalidNodeNameException; +use WebFiori\Ui\HeadNode; +use WebFiori\Ui\HTMLNode; /** * A base class that is used to construct website UI. * diff --git a/webfiori/framework/ThemeManager.php b/WebFiori/Framework/ThemeManager.php similarity index 97% rename from webfiori/framework/ThemeManager.php rename to WebFiori/Framework/ThemeManager.php index 05758292d..527208bd8 100644 --- a/webfiori/framework/ThemeManager.php +++ b/WebFiori/Framework/ThemeManager.php @@ -8,15 +8,15 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework; +namespace WebFiori\Framework; use Error; use Exception; -use webfiori\file\File; -use webfiori\framework\exceptions\NoSuchThemeException; -use webfiori\framework\router\RouteOption; -use webfiori\framework\router\Router; -use webfiori\http\Response; +use WebFiori\file\File; +use WebFiori\Framework\Exceptions\NoSuchThemeException; +use WebFiori\Framework\Router\RouteOption; +use WebFiori\Framework\Router\Router; +use WebFiori\http\Response; /** * A class which manages theme registration and loading. diff --git a/webfiori/framework/ui/BeforeRenderCallback.php b/WebFiori/Framework/Ui/BeforeRenderCallback.php similarity index 99% rename from webfiori/framework/ui/BeforeRenderCallback.php rename to WebFiori/Framework/Ui/BeforeRenderCallback.php index f381feaed..059c34066 100644 --- a/webfiori/framework/ui/BeforeRenderCallback.php +++ b/WebFiori/Framework/Ui/BeforeRenderCallback.php @@ -8,7 +8,7 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\ui; +namespace WebFiori\Framework\Ui; use WebFiori\Collections\Comparable; /** diff --git a/webfiori/framework/ui/HTTPCodeView.php b/WebFiori/Framework/Ui/HTTPCodeView.php similarity index 92% rename from webfiori/framework/ui/HTTPCodeView.php rename to WebFiori/Framework/Ui/HTTPCodeView.php index 316251778..6c3e8c989 100644 --- a/webfiori/framework/ui/HTTPCodeView.php +++ b/WebFiori/Framework/Ui/HTTPCodeView.php @@ -8,10 +8,10 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\ui; +namespace WebFiori\Framework\Ui; -use webfiori\framework\App; -use WebFiori\UI\HTMLNode; +use WebFiori\Framework\App; +use WebFiori\Ui\HTMLNode; /** * A basic view which is used to display HTTP error codes taken from * language file. diff --git a/webfiori/framework/ui/MessageBox.php b/WebFiori/Framework/Ui/MessageBox.php similarity index 96% rename from webfiori/framework/ui/MessageBox.php rename to WebFiori/Framework/Ui/MessageBox.php index af849fae2..6b562711c 100644 --- a/webfiori/framework/ui/MessageBox.php +++ b/WebFiori/Framework/Ui/MessageBox.php @@ -8,9 +8,9 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\ui; +namespace WebFiori\Framework\Ui; -use WebFiori\UI\HTMLNode; +use WebFiori\Ui\HTMLNode; /** * A generic class for showing a floating box in web pages that can have any content * in its body. @@ -138,13 +138,13 @@ private function _init() { $css = new HTMLNode('link'); $css->setAttributes([ 'rel' => 'stylesheet', - 'href' => 'https://cdn.jsdelivr.net/gh/webfiori/app@'.WF_VERSION.'/public/assets/css/message-box.css' + 'href' => 'https://cdn.jsdelivr.net/gh/WebFiori/app@'.WF_VERSION.'/public/assets/css/message-box.css' ]); $this->addChild($css); $js = new HTMLNode('script'); $js->setAttributes([ 'type' => 'text/javascript', - 'src' => 'https://cdn.jsdelivr.net/gh/webfiori/app@'.WF_VERSION.'/public/assets/js/message-box.js' + 'src' => 'https://cdn.jsdelivr.net/gh/WebFiori/app@'.WF_VERSION.'/public/assets/js/message-box.js' ]); $this->addChild($js); } diff --git a/webfiori/framework/ui/serverErrPage/ServerErrPage.php b/WebFiori/Framework/Ui/ServerErrPage/ServerErrPage.php similarity index 93% rename from webfiori/framework/ui/serverErrPage/ServerErrPage.php rename to WebFiori/Framework/Ui/ServerErrPage/ServerErrPage.php index 1120e1360..3f4525e25 100644 --- a/webfiori/framework/ui/serverErrPage/ServerErrPage.php +++ b/WebFiori/Framework/Ui/ServerErrPage/ServerErrPage.php @@ -8,11 +8,11 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\ui\serverErrPage; +namespace WebFiori\Framework\Ui\ServerErrPage; use WebFiori\Error\AbstractHandler; -use webfiori\framework\ui\WebPage; -use WebFiori\UI\HTMLNode; +use WebFiori\Framework\Ui\WebPage; +use WebFiori\Ui\HTMLNode; /** * A page which is used to display exception information when it is thrown or * any other errors. @@ -41,7 +41,7 @@ public function __construct(AbstractHandler $throwableOrErr) { $this->addBeforeRender(function (WebPage $p) { $p->getDocument()->getBody()->addChild('script', [ - 'src' => 'https://cdn.jsdelivr.net/gh/webfiori/framework@'.WF_VERSION.'/assets/js/server-err.js', + 'src' => 'https://cdn.jsdelivr.net/gh/WebFiori/framework@'.WF_VERSION.'/assets/js/server-err.js', 'type' => 'text/javascript' ]); }); diff --git a/webfiori/framework/ui/serverErrPage/error-details.php b/WebFiori/Framework/Ui/ServerErrPage/error-details.php similarity index 97% rename from webfiori/framework/ui/serverErrPage/error-details.php rename to WebFiori/Framework/Ui/ServerErrPage/error-details.php index 1a3a2a3d1..3cd680f8a 100644 --- a/webfiori/framework/ui/serverErrPage/error-details.php +++ b/WebFiori/Framework/Ui/ServerErrPage/error-details.php @@ -1,5 +1,5 @@ diff --git a/webfiori/framework/ui/serverErrPage/server-err-header.php b/WebFiori/Framework/Ui/ServerErrPage/server-err-header.php similarity index 92% rename from webfiori/framework/ui/serverErrPage/server-err-header.php rename to WebFiori/Framework/Ui/ServerErrPage/server-err-header.php index 79603599f..ef7813919 100644 --- a/webfiori/framework/ui/serverErrPage/server-err-header.php +++ b/WebFiori/Framework/Ui/ServerErrPage/server-err-header.php @@ -1,5 +1,5 @@ diff --git a/webfiori/framework/ui/serverErrPage/server-err-stack-trace.php b/WebFiori/Framework/Ui/ServerErrPage/server-err-stack-trace.php similarity index 93% rename from webfiori/framework/ui/serverErrPage/server-err-stack-trace.php rename to WebFiori/Framework/Ui/ServerErrPage/server-err-stack-trace.php index fd7c16234..2b871f1b8 100644 --- a/webfiori/framework/ui/serverErrPage/server-err-stack-trace.php +++ b/WebFiori/Framework/Ui/ServerErrPage/server-err-stack-trace.php @@ -1,5 +1,5 @@ setTitle('Welcome to WebFiori'); $div = $this->insert('div'); $div->addChild('img', [ - 'src' => 'https://webfiori.com/assets/images/WFLogo512.png', + 'src' => 'https://WebFiori.com/assets/images/WFLogo512.png', 'style' => 'width:250px;height:250px;border-radius:250px;background-color:black' ]); $div->setStyle([ @@ -56,7 +56,7 @@ public function __construct() { $cardsRow = $row->addChild('v-col', [ 'cols' => 12, ])->addChild('v-row'); - $this->createCard('https://webfiori.com/learn', + $this->createCard('https://WebFiori.com/learn', 'mdi-book-open-variant', 'Learn', 'Documentation is always the first place where developers can find what they need.' @@ -66,7 +66,7 @@ public function __construct() { .'experience with it, we recommend the ' .'documentation as they will help in a way or another.', $cardsRow->addChild('v-col', ['cols' => 12, 'md' => 6, 'sm' => 12])); - $this->createCard('https://webfiori.com/docs/webfiori', + $this->createCard('https://WebFiori.com/docs/WebFiori', 'mdi-book-check-outline', 'API Reference', 'This reference has all information about core framework classes that a developer ' @@ -74,14 +74,14 @@ public function __construct() { .'uses of every public class attribute and method. It can be handy when developers starts ' .'using advanced features of the framework.', $cardsRow->addChild('v-col', ['cols' => 12, 'md' => 6, 'sm' => 12])); - $this->createCard('https://webfiori.com/contribute', + $this->createCard('https://WebFiori.com/contribute', 'mdi-comment-plus-outline', 'Support The Project', 'Want to help in development of the framework or contribute? This place is for you. It holds ' .'basic instructions on how you may help in supporting the framework in many ways.', $cardsRow->addChild('v-col', ['cols' => 12, 'md' => 6, 'sm' => 12])); } - private function createCard($link, $icon, $cardTitle, $paragraph, \WebFiori\UI\HTMLNode $el) { + private function createCard($link, $icon, $cardTitle, $paragraph, \WebFiori\Ui\HTMLNode $el) { $card = $el->addChild('v-card', [ 'hover', 'height' => '220px', diff --git a/webfiori/framework/ui/WebPage.php b/WebFiori/Framework/Ui/WebPage.php similarity index 98% rename from webfiori/framework/ui/WebPage.php rename to WebFiori/Framework/Ui/WebPage.php index 58d0efb15..20283c9b7 100644 --- a/webfiori/framework/ui/WebPage.php +++ b/WebFiori/Framework/Ui/WebPage.php @@ -8,30 +8,30 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\ui; +namespace WebFiori\Framework\Ui; use Error; use Exception; use TypeError; use WebFiori\Collections\LinkedList; -use webfiori\framework\App; -use webfiori\framework\exceptions\InitializationException; -use webfiori\framework\exceptions\MissingLangException; -use webfiori\framework\exceptions\SessionException; -use webfiori\framework\exceptions\UIException; -use webfiori\framework\Lang; -use webfiori\framework\router\Router; -use webfiori\framework\session\Session; -use webfiori\framework\session\SessionsManager; -use webfiori\framework\Theme; -use webfiori\framework\ThemeManager; -use webfiori\framework\Util; +use WebFiori\Framework\App; +use WebFiori\Framework\Exceptions\InitializationException; +use WebFiori\Framework\Exceptions\MissingLangException; +use WebFiori\Framework\Exceptions\SessionException; +use WebFiori\Framework\Exceptions\UIException; +use WebFiori\Framework\Lang; +use WebFiori\Framework\Router\Router; +use WebFiori\Framework\Session\Session; +use WebFiori\Framework\Session\SessionsManager; +use WebFiori\Framework\Theme; +use WebFiori\Framework\ThemeManager; +use WebFiori\Framework\Util; use WebFiori\Http\Request; use WebFiori\Http\Response; use WebFiori\Json\Json; -use WebFiori\UI\HeadNode; -use WebFiori\UI\HTMLDoc; -use WebFiori\UI\HTMLNode; +use WebFiori\Ui\HeadNode; +use WebFiori\Ui\HTMLDoc; +use WebFiori\Ui\HTMLNode; require_once 'ui-functions.php'; /** * A base class that can be used to implement web pages. @@ -1174,7 +1174,7 @@ private function _getComponent($methToCall, $nodeId) { } throw new UIException('The the method "'.get_class($loadedTheme).'::'.$methToCall.'()" did not return ' - .'an instance of the class "webfiori\\ui\\HTMLNode".'); + .'an instance of the class "WebFiori\\ui\\HTMLNode".'); } /** * Sets the language of the page based on session language or @@ -1235,7 +1235,7 @@ private function getHead() { if (!($headNode instanceof HeadNode)) { throw new UIException('The method "'.get_class($loadedTheme).'::getHeadNode()" did not return ' - .'an instance of the class "webfiori\\ui\\HeadNode".'); + .'an instance of the class "WebFiori\\ui\\HeadNode".'); } } $headNode->addMeta('charset','UTF-8',true); diff --git a/webfiori/framework/ui/ui-functions.php b/WebFiori/Framework/Ui/ui-functions.php similarity index 95% rename from webfiori/framework/ui/ui-functions.php rename to WebFiori/Framework/Ui/ui-functions.php index b0aa17fe1..f284a8d36 100644 --- a/webfiori/framework/ui/ui-functions.php +++ b/WebFiori/Framework/Ui/ui-functions.php @@ -9,12 +9,12 @@ * */ -use webfiori\framework\exceptions\MissingLangException; -use webfiori\framework\Lang; -use webfiori\framework\ui\WebPage; +use WebFiori\Framework\Exceptions\MissingLangException; +use WebFiori\Framework\Lang; +use WebFiori\Framework\Ui\WebPage; use WebFiori\Http\Response; use WebFiori\Json\JsonI; -use WebFiori\UI\HTMLNode; +use WebFiori\Ui\HTMLNode; /** * This file contains functions that can be used inside PHP templates. The diff --git a/webfiori/framework/User.php b/WebFiori/Framework/User.php similarity index 99% rename from webfiori/framework/User.php rename to WebFiori/Framework/User.php index 7772c24b8..ca3f579fd 100644 --- a/webfiori/framework/User.php +++ b/WebFiori/Framework/User.php @@ -8,9 +8,9 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework; +namespace WebFiori\Framework; -use webfiori\framework\session\SessionUser; +use WebFiori\Framework\Session\SessionUser; use WebFiori\Json\Json; use WebFiori\Json\JsonI; /** diff --git a/webfiori/framework/Util.php b/WebFiori/Framework/Util.php similarity index 99% rename from webfiori/framework/Util.php rename to WebFiori/Framework/Util.php index cf3fc9d56..99928cc13 100644 --- a/webfiori/framework/Util.php +++ b/WebFiori/Framework/Util.php @@ -8,10 +8,10 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework; +namespace WebFiori\Framework; -use webfiori\framework\cli\Runner; -use webfiori\framework\ui\MessageBox; +use WebFiori\Framework\Cli\Runner; +use WebFiori\Framework\Ui\MessageBox; use WebFiori\Http\Response; /** * Framework utility class. diff --git a/webfiori/framework/writers/APITestCaseWriter.php b/WebFiori/Framework/Writers/APITestCaseWriter.php similarity index 99% rename from webfiori/framework/writers/APITestCaseWriter.php rename to WebFiori/Framework/Writers/APITestCaseWriter.php index e1972c1fa..770b7c2a2 100644 --- a/webfiori/framework/writers/APITestCaseWriter.php +++ b/WebFiori/Framework/Writers/APITestCaseWriter.php @@ -1,5 +1,5 @@ setSuffix('Test'); if ($manager !== null) { diff --git a/webfiori/framework/writers/ClassWriter.php b/WebFiori/Framework/Writers/ClassWriter.php similarity index 99% rename from webfiori/framework/writers/ClassWriter.php rename to WebFiori/Framework/Writers/ClassWriter.php index 32c5e53fd..ed7675442 100644 --- a/webfiori/framework/writers/ClassWriter.php +++ b/WebFiori/Framework/Writers/ClassWriter.php @@ -8,7 +8,7 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\writers; +namespace WebFiori\Framework\Writers; use WebFiori\File\File; /** diff --git a/webfiori/framework/writers/CommandClassWriter.php b/WebFiori/Framework/Writers/CommandClassWriter.php similarity index 96% rename from webfiori/framework/writers/CommandClassWriter.php rename to WebFiori/Framework/Writers/CommandClassWriter.php index 52ac159f5..cbbb39649 100644 --- a/webfiori/framework/writers/CommandClassWriter.php +++ b/WebFiori/Framework/Writers/CommandClassWriter.php @@ -8,7 +8,7 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\writers; +namespace WebFiori\Framework\Writers; /** * A class which is used to write CLI Commands classes. @@ -28,7 +28,7 @@ class CommandClassWriter extends ClassWriter { *
  • name: The name of the class that will be created. If not provided, the * string 'NewClass' is used.
  • *
  • namespace: The namespace that the class will belong to. If not provided, - * the namespace 'webfiori' is used.
  • + * the namespace 'WebFiori' is used. *
  • path: The location at which the class will be created on. If not * provided, the constant ROOT_PATH is used.
  • * @@ -41,12 +41,12 @@ class CommandClassWriter extends ClassWriter { * the command will have. */ public function __construct() { - parent::__construct('NewCommand', APP_PATH.'commands', APP_DIR.'\\commands'); + parent::__construct('NewCommand', APP_PATH.'Commands', APP_DIR.'\\Commands'); $this->name = 'new-command'; $this->args = []; $this->desc = ''; $this->setSuffix('Command'); - $this->setNamespace(APP_DIR.'\\commands'); + $this->setNamespace(APP_DIR.'\\Commands'); $this->addUseStatement([ 'WebFiori\\Cli\\Command' ]); diff --git a/webfiori/framework/writers/DBClassWriter.php b/WebFiori/Framework/Writers/DBClassWriter.php similarity index 99% rename from webfiori/framework/writers/DBClassWriter.php rename to WebFiori/Framework/Writers/DBClassWriter.php index 3113d9787..8ab043da5 100644 --- a/webfiori/framework/writers/DBClassWriter.php +++ b/WebFiori/Framework/Writers/DBClassWriter.php @@ -8,14 +8,14 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\writers; +namespace WebFiori\Framework\Writers; use WebFiori\Database\Column; use WebFiori\Database\EntityMapper; use WebFiori\Database\MsSql\MSSQLColumn; use WebFiori\Database\MsSql\MSSQLTable; use WebFiori\Database\Table; -use webfiori\framework\DB; +use WebFiori\Framework\DB; /** * A class which is used to create a database access controller. * diff --git a/webfiori/framework/writers/DatabaseMigrationWriter.php b/WebFiori/Framework/Writers/DatabaseMigrationWriter.php similarity index 97% rename from webfiori/framework/writers/DatabaseMigrationWriter.php rename to WebFiori/Framework/Writers/DatabaseMigrationWriter.php index ed807c230..355952ee8 100644 --- a/webfiori/framework/writers/DatabaseMigrationWriter.php +++ b/WebFiori/Framework/Writers/DatabaseMigrationWriter.php @@ -8,7 +8,7 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\writers; +namespace WebFiori\Framework\Writers; use WebFiori\Database\Database; use WebFiori\Database\Schema\AbstractMigration; @@ -35,7 +35,7 @@ public function __construct(?SchemaRunner $runner) { $this->setClassName($name); - parent::__construct($name, APP_PATH.'database'.DS.'migrations', APP_DIR.'\\database\\migrations'); + parent::__construct($name, APP_PATH.'Database'.DS.'Migrations', APP_DIR.'\\Database\\Migrations'); $this->addUseStatement([ Database::class, AbstractMigration::class, diff --git a/webfiori/framework/writers/LangClassWriter.php b/WebFiori/Framework/Writers/LangClassWriter.php similarity index 91% rename from webfiori/framework/writers/LangClassWriter.php rename to WebFiori/Framework/Writers/LangClassWriter.php index 35fa00312..9b9514ffa 100644 --- a/webfiori/framework/writers/LangClassWriter.php +++ b/WebFiori/Framework/Writers/LangClassWriter.php @@ -8,9 +8,9 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\writers; +namespace WebFiori\Framework\Writers; -use webfiori\framework\Lang; +use WebFiori\Framework\Lang; /** * A writer which is used to write any class that represents a language class. * @@ -34,7 +34,7 @@ class LangClassWriter extends ClassWriter { * @since 1.0 */ public function __construct($langCode, $writingDir) { - parent::__construct('Lang'.$langCode, APP_PATH.'langs', APP_DIR."\\langs"); + parent::__construct('Lang'.$langCode, APP_PATH.'Langs', APP_DIR."\\Langs"); $this->code = $langCode; $this->dir = $writingDir; $this->addUseStatement(Lang::class); diff --git a/webfiori/framework/writers/MiddlewareClassWriter.php b/WebFiori/Framework/Writers/MiddlewareClassWriter.php similarity index 95% rename from webfiori/framework/writers/MiddlewareClassWriter.php rename to WebFiori/Framework/Writers/MiddlewareClassWriter.php index 1fd6867a3..3eb89a583 100644 --- a/webfiori/framework/writers/MiddlewareClassWriter.php +++ b/WebFiori/Framework/Writers/MiddlewareClassWriter.php @@ -8,10 +8,10 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\writers; +namespace WebFiori\Framework\Writers; -use webfiori\framework\middleware\AbstractMiddleware; -use webfiori\framework\session\SessionsManager; +use WebFiori\Framework\Middleware\AbstractMiddleware; +use WebFiori\Framework\Session\SessionsManager; use WebFiori\Http\Request; use WebFiori\Http\Response; /** @@ -32,7 +32,7 @@ class MiddlewareClassWriter extends ClassWriter { *
  • name: The name of the class that will be created. If not provided, the * string 'NewClass' is used.
  • *
  • namespace: The namespace that the class will belong to. If not provided, - * the namespace 'webfiori' is used.
  • + * the namespace 'WebFiori' is used. *
  • path: The location at which the class will be created on. If not * provided, the constant ROOT_PATH is used.
  • * @@ -47,7 +47,7 @@ class MiddlewareClassWriter extends ClassWriter { * will be added to. */ public function __construct($middlewareName = '', $priority = 0, array $groupsArr = []) { - parent::__construct('NewMiddleware', APP_PATH.'middleware', APP_DIR.'\\middleware'); + parent::__construct('NewMiddleware', APP_PATH.'Middleware', APP_DIR.'\\Middleware'); $this->setSuffix('Middleware'); $this->addUseStatement([ AbstractMiddleware::class, diff --git a/webfiori/framework/writers/SchedulerTaskClassWriter.php b/WebFiori/Framework/Writers/SchedulerTaskClassWriter.php similarity index 94% rename from webfiori/framework/writers/SchedulerTaskClassWriter.php rename to WebFiori/Framework/Writers/SchedulerTaskClassWriter.php index acc015798..e4438c8b3 100644 --- a/webfiori/framework/writers/SchedulerTaskClassWriter.php +++ b/WebFiori/Framework/Writers/SchedulerTaskClassWriter.php @@ -8,13 +8,13 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\writers; +namespace WebFiori\Framework\Writers; -use webfiori\framework\scheduler\AbstractTask; -use webfiori\framework\scheduler\BaseTask; -use webfiori\framework\scheduler\TaskArgument; -use webfiori\framework\scheduler\TasksManager; -use webfiori\framework\scheduler\TaskStatusEmail; +use WebFiori\Framework\Scheduler\AbstractTask; +use WebFiori\Framework\Scheduler\BaseTask; +use WebFiori\Framework\Scheduler\TaskArgument; +use WebFiori\Framework\Scheduler\TasksManager; +use WebFiori\Framework\Scheduler\TaskStatusEmail; /** * A class which is used to write scheduler tasks classes. * @@ -37,7 +37,7 @@ class SchedulerTaskClassWriter extends ClassWriter { * the task needs. */ public function __construct(string $className = 'NewTask', $taskName = '', $taskDesc = '', array $argsArr = []) { - parent::__construct($className, APP_PATH.'tasks', APP_DIR.'\\tasks'); + parent::__construct($className, APP_PATH.'Tasks', APP_DIR.'\\Tasks'); $this->task = new BaseTask(); if (!$this->setTaskName($taskName)) { @@ -158,7 +158,7 @@ public function writeClassBody() { $this->append('//TODO: Implement the action to perform when the task finishes to execute.', 2); $this->append("//\$email = new TaskStatusEmail('no-reply', [", 2); - $this->append("// 'webfiori@example.com' => 'Ibrahim Ali'", 2); + $this->append("// 'WebFiori@example.com' => 'Ibrahim Ali'", 2); $this->append('//]);', 2); $this->append('}', 1); diff --git a/webfiori/framework/writers/ServiceHolder.php b/WebFiori/Framework/Writers/ServiceHolder.php similarity index 96% rename from webfiori/framework/writers/ServiceHolder.php rename to WebFiori/Framework/Writers/ServiceHolder.php index 1154b281f..4b9ca3510 100644 --- a/webfiori/framework/writers/ServiceHolder.php +++ b/WebFiori/Framework/Writers/ServiceHolder.php @@ -8,7 +8,7 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\writers; +namespace WebFiori\Framework\Writers; use WebFiori\Http\AbstractWebService; /** diff --git a/webfiori/framework/writers/TableClassWriter.php b/WebFiori/Framework/Writers/TableClassWriter.php similarity index 99% rename from webfiori/framework/writers/TableClassWriter.php rename to WebFiori/Framework/Writers/TableClassWriter.php index 92d739e62..13aec8e6b 100644 --- a/webfiori/framework/writers/TableClassWriter.php +++ b/WebFiori/Framework/Writers/TableClassWriter.php @@ -8,7 +8,7 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\writers; +namespace WebFiori\Framework\Writers; use const APP_DIR; use const APP_PATH; @@ -57,7 +57,7 @@ class TableClassWriter extends ClassWriter { *
  • name: The name of the class that will be created. If not provided, the * string 'NewClass' is used.
  • *
  • namespace: The namespace that the class will belong to. If not provided, - * the namespace 'webfiori' is used.
  • + * the namespace 'WebFiori' is used. *
  • path: The location at which the query will be created on. If not * provided, the constant ROOT_PATH is used.
  • *
  • entity-info: A sub associative array that contains information about the entity @@ -76,7 +76,7 @@ class TableClassWriter extends ClassWriter { * @since 1.0 */ public function __construct(?Table $tableObj = null) { - parent::__construct('NewTable', APP_PATH.'database', APP_DIR.'\\database'); + parent::__construct('NewTable', APP_PATH.'Database', APP_DIR.'\\Database'); $this->setSuffix('Table'); if ($tableObj === null) { diff --git a/webfiori/framework/writers/ThemeClassWriter.php b/WebFiori/Framework/Writers/ThemeClassWriter.php similarity index 97% rename from webfiori/framework/writers/ThemeClassWriter.php rename to WebFiori/Framework/Writers/ThemeClassWriter.php index 8072c7f5a..959c33bf4 100644 --- a/webfiori/framework/writers/ThemeClassWriter.php +++ b/WebFiori/Framework/Writers/ThemeClassWriter.php @@ -8,12 +8,12 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\writers; +namespace WebFiori\Framework\Writers; use WebFiori\File\File; -use webfiori\framework\Theme; -use WebFiori\UI\HeadNode; -use WebFiori\UI\HTMLNode; +use WebFiori\Framework\Theme; +use WebFiori\Ui\HeadNode; +use WebFiori\Ui\HTMLNode; /** * A class which is used to create basic theme skeleton. @@ -34,7 +34,7 @@ class ThemeClassWriter extends ClassWriter { * */ public function __construct(string $themeName = '') { - parent::__construct('NewTheme', APP_PATH.'themes', APP_DIR.'\\themes\\new'); + parent::__construct('NewTheme', APP_PATH.'Themes', APP_DIR.'\\Themes\\new'); if (!$this->setThemeName($themeName)) { $this->setThemeName('New Theme'); diff --git a/webfiori/framework/writers/ThemeComponentWriter.php b/WebFiori/Framework/Writers/ThemeComponentWriter.php similarity index 98% rename from webfiori/framework/writers/ThemeComponentWriter.php rename to WebFiori/Framework/Writers/ThemeComponentWriter.php index a14e96f3b..7588d1bc0 100644 --- a/webfiori/framework/writers/ThemeComponentWriter.php +++ b/WebFiori/Framework/Writers/ThemeComponentWriter.php @@ -8,7 +8,7 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\writers; +namespace WebFiori\Framework\Writers; /** * A helper class which is used in generating theme template. diff --git a/webfiori/framework/writers/WebServiceWriter.php b/WebFiori/Framework/Writers/WebServiceWriter.php similarity index 98% rename from webfiori/framework/writers/WebServiceWriter.php rename to WebFiori/Framework/Writers/WebServiceWriter.php index 59129c6ad..ff34e67a5 100644 --- a/webfiori/framework/writers/WebServiceWriter.php +++ b/WebFiori/Framework/Writers/WebServiceWriter.php @@ -8,7 +8,7 @@ * https://github.com/WebFiori/.github/blob/main/LICENSE * */ -namespace webfiori\framework\writers; +namespace WebFiori\Framework\Writers; use WebFiori\Http\AbstractWebService; use WebFiori\Http\ParamOption; @@ -41,13 +41,13 @@ class WebServiceWriter extends ClassWriter { *
  • name: The name of the class that will be created. If not provided, the * string 'NewClass' is used.
  • *
  • namespace: The namespace that the class will belong to. If not provided, - * the namespace 'webfiori' is used.
  • + * the namespace 'WebFiori' is used. *
  • path: The location at which the query will be created on. If not * provided, the constant ROOT_PATH is used.
  • * */ public function __construct(?AbstractWebService $webServicesObj = null) { - parent::__construct('NewWebService', APP_PATH.'apis', APP_DIR.'\\apis'); + parent::__construct('NewWebService', APP_PATH.'Apis', APP_DIR.'\\Apis'); $this->setSuffix('Service'); $this->addUseStatement(AbstractWebService::class); diff --git a/app/langs/LangGB.php b/app/langs/LangGB.php deleted file mode 100644 index 45c0d2dd0..000000000 --- a/app/langs/LangGB.php +++ /dev/null @@ -1,2 +0,0 @@ -getCol('contact-type')->setIsUnique(false); $this->getCol('contact-type')->setIsPrimary(true); $this->table->addColumn('contact-info', new MySQLColumn('contact_info', 'varchar',320)); - $this->table->addReference('webfiori\tests\database\UsersQuery', [ + $this->table->addReference('WebFiori\Tests\Database\UsersQuery', [ 'user-id' => 'user-id' ], 'user_contact_info_fk', 'cadcade', 'cascade'); $this->setTable($this->table); diff --git a/tests/test-entities/UserWithContact.php b/tests/TestEntities/UserWithContact.php similarity index 87% rename from tests/test-entities/UserWithContact.php rename to tests/TestEntities/UserWithContact.php index ce225b968..cccaf6426 100644 --- a/tests/test-entities/UserWithContact.php +++ b/tests/TestEntities/UserWithContact.php @@ -1,7 +1,7 @@ 'hello', diff --git a/tests/webfiori/framework/test/AccessTest.php b/tests/WebFiori/Framework/Tests/AccessTest.php similarity index 98% rename from tests/webfiori/framework/test/AccessTest.php rename to tests/WebFiori/Framework/Tests/AccessTest.php index cbfd4d3a9..1cd487788 100644 --- a/tests/webfiori/framework/test/AccessTest.php +++ b/tests/WebFiori/Framework/Tests/AccessTest.php @@ -1,11 +1,11 @@ getDBConnections()) + 1); $output = $this->executeSingleCommand(new AddCommand(), [ - 'webfiori', + 'WebFiori', 'add' ], [ '0', @@ -121,7 +121,7 @@ public function testAddDBConnection02() { $connName = 'db-connection-'.($count + 1); $output = $this->executeSingleCommand(new AddCommand(), [ - 'webfiori', + 'WebFiori', 'add' ], [ '0', @@ -169,8 +169,8 @@ public function testAddLang00() { $langCode = chr(65 + ($langCode[0] % 26)) . chr(65 + ($langCode[1] % 26)); // Clean up if it exists from previous runs - if (class_exists('\\app\\langs\\Lang' . $langCode)) { - $this->removeClass('\\app\\langs\\Lang' . $langCode); + if (class_exists('\\App\\Langs\\Lang' . $langCode)) { + $this->removeClass('\\App\\Langs\\Lang' . $langCode); } $output = $this->executeSingleCommand(new AddCommand(), [], [ @@ -196,10 +196,10 @@ public function testAddLang00() { "Select writing direction:\n", "0: ltr\n", "1: rtl\n", - "Success: Language added. Also, a class for the language is created at \"".APP_DIR."\langs\" for that language.\n" + "Success: Language added. Also, a class for the language is created at \"".APP_DIR."\Langs\" for that language.\n" ], $output); - $this->assertTrue(class_exists('\\app\\langs\\Lang' . $langCode)); - $this->removeClass('\\app\\langs\\Lang' . $langCode); + $this->assertTrue(class_exists('\\App\\Langs\\Lang' . $langCode)); + $this->removeClass('\\App\\Langs\\Lang' . $langCode); Controller::getDriver()->initialize(); } /** @@ -242,7 +242,7 @@ public function testAddLang02() { "Language code:\n", "Error: Invalid language code.\n", ], $output); - $this->removeClass('\\app\\langs\\LanguageFK'); + $this->removeClass('\\App\\Langs\\LanguageFK'); } /** * @test @@ -251,7 +251,7 @@ public function testAddSMTPConnection00() { $connName = 'smtp-connection-'.count(App::getConfig()->getSMTPConnections()); $output = $this->executeSingleCommand(new AddCommand(), [ - 'webfiori', + 'WebFiori', 'add' ], [ '1', diff --git a/tests/webfiori/framework/test/cli/CreateAPITestCaseTest.php b/tests/WebFiori/Framework/Tests/Cli/CreateAPITestCaseTest.php similarity index 70% rename from tests/webfiori/framework/test/cli/CreateAPITestCaseTest.php rename to tests/WebFiori/Framework/Tests/Cli/CreateAPITestCaseTest.php index ee53c02d1..cae0f8241 100644 --- a/tests/webfiori/framework/test/cli/CreateAPITestCaseTest.php +++ b/tests/WebFiori/Framework/Tests/Cli/CreateAPITestCaseTest.php @@ -1,9 +1,9 @@ assertEquals([ "Info: Selected services manager has no service with name 'c'.\n", "Which service you would like to have a test case for?\n", @@ -38,7 +38,7 @@ public function testCreateAPITestCase01() { "4: set-password\n", "Test case will be created with following parameters:\n", "PHPUnit Version: 9\n", - 'Name: tests\webfiori\\framework\scheduler\webServices\\TasksLoginServiceTest'."\n", + 'Name: WebFiori\\Framework\Scheduler\WebServices\\TasksLoginServiceTest'."\n", "Path: ".$path."\n", "Would you like to use default parameters?(Y/n)\n", "Info: New class was created at \"".$path."\".\n" @@ -53,17 +53,17 @@ public function testCreateAPITestCase01() { ])); $this->assertEquals(0, $this->getExitCode()); - $clazz = '\\tests\webfiori\\framework\scheduler\webServices\\TasksLoginServiceTest'; + $clazz = '\\WebFiori\\Framework\Scheduler\WebServices\\TasksLoginServiceTest'; $this->assertTrue(file_exists($path.DS.'TasksLoginServiceTest.php')); require_once $path.DS.'TasksLoginServiceTest.php'; $this->assertTrue(class_exists($clazz)); - $this->removeClass($clazz); + $this->removeClass('tests\\WebFiori\\Framework\\Scheduler\\WebServices\\TasksLoginServiceTest'); } /** * @test */ public function testCreateAPITestCase02() { - $path = ROOT_PATH.DS."tests".DS."webfiori".DS."framework".DS."scheduler".DS."webServices"; + $path = ROOT_PATH.DS."tests".DS."WebFiori".DS."Framework".DS."Scheduler".DS."WebServices"; $this->assertEquals([ "Info: New class was created at \"".$path."\".\n" ], $this->executeMultiCommand([ @@ -74,34 +74,35 @@ public function testCreateAPITestCase02() { '--defaults' ])); $this->assertEquals(0, $this->getExitCode()); - $clazz = '\\tests\webfiori\\framework\scheduler\webServices\\GetTasksServiceTest'; + $clazz = '\\WebFiori\\Framework\Scheduler\WebServices\\GetTasksServiceTest'; $this->assertTrue(file_exists($path.DS.'GetTasksServiceTest.php')); require_once $path.DS.'GetTasksServiceTest.php'; $this->assertTrue(class_exists($clazz)); - $this->removeClass($clazz); + $this->removeClass('tests\\WebFiori\\Framework\\Scheduler\\WebServices\\GetTasksServiceTest'); } /** * @test */ public function testCreateAPITestCase03() { - $path = ROOT_PATH.DS."tests".DS."webfiori".DS."framework".DS."scheduler".DS."webServices"; + $path = ROOT_PATH.DS."tests".DS."WebFiori".DS."Framework".DS."Scheduler".DS."WebServices"; + $name = 'GetTasksServiceTest'; $this->assertEquals([ "Please enter services manager information:\n", "Test case will be created with following parameters:\n", "PHPUnit Version: 9\n", - 'Name: tests\webfiori\\framework\scheduler\webServices\\GetTasksServiceTest'."\n", + 'Name: WebFiori\\Framework\Scheduler\WebServices\\'.$name."\n", "Path: ".$path."\n", "Would you like to use default parameters?(Y/n)\n", "PHPUnit Version: Enter = '11'\n", "Enter a name for the new class:\n", - "Enter an optional namespace for the class: Enter = 'tests\webfiori\\framework\scheduler\webServices'\n", + "Enter an optional namespace for the class: Enter = 'WebFiori\\Framework\Scheduler\WebServices'\n", "Info: New class was created at \"".$path."\".\n" ], $this->executeMultiCommand([ CreateCommand::class, '--c' => 'api-test', '--service' => 'get-tasks', ], [ - '\webfiori\\framework\scheduler\webServices\\TasksServicesManager', + '\WebFiori\\Framework\Scheduler\WebServices\\TasksServicesManager', 'n', '10', '', @@ -109,34 +110,35 @@ public function testCreateAPITestCase03() { ])); $this->assertEquals(0, $this->getExitCode()); - $clazz = '\\tests\webfiori\\framework\scheduler\webServices\\GetTasksServiceTest'; + $clazz = '\\WebFiori\\Framework\Scheduler\WebServices\\GetTasksServiceTest'; $this->assertTrue(file_exists($path.DS.'GetTasksServiceTest.php')); require_once $path.DS.'GetTasksServiceTest.php'; $this->assertTrue(class_exists($clazz)); - $this->removeClass($clazz); + $this->removeClass('tests\\WebFiori\\Framework\\Scheduler\\WebServices\\GetTasksServiceTest'); } /** * @test */ public function testCreateAPITestCase04() { - $path = ROOT_PATH.DS."tests".DS."tests".DS."apis".DS."multiple"; + $path = ROOT_PATH.DS."tests".DS."Apis".DS."Multiple"; + $name = 'WebService00Test'; $this->assertEquals([ "Please enter services manager information:\n", "Test case will be created with following parameters:\n", "PHPUnit Version: 9\n", - 'Name: tests\tests\apis\multiple\WebService00Test'."\n", + 'Name: Apis\Multiple\\'.$name."\n", "Path: ".$path."\n", "Would you like to use default parameters?(Y/n)\n", "PHPUnit Version: Enter = '11'\n", "Enter a name for the new class:\n", - "Enter an optional namespace for the class: Enter = 'tests\\tests\apis\multiple'\n", + "Enter an optional namespace for the class: Enter = 'Apis\Multiple'\n", "Info: New class was created at \"".$path."\".\n" ], $this->executeMultiCommand([ CreateCommand::class, '--c' => 'api-test', '--service' => 'say-hi-service', ], [ - '\\tests\\apis\\multiple\\ServicesManager00', + '\\Apis\\Multiple\\ServicesManager00', 'n', '10', '', @@ -144,11 +146,11 @@ public function testCreateAPITestCase04() { ])); $this->assertEquals(0, $this->getExitCode()); - $clazz = '\\tests\\tests\\apis\\multiple\\WebService00Test'; - $this->assertTrue(file_exists($path.DS.'WebService00Test.php')); - require_once $path.DS.'WebService00Test.php'; + $clazz = '\\Apis\\Multiple\\'.$name; + $this->assertTrue(file_exists($path.DS.$name.'.php')); + require_once $path.DS.$name.'.php'; $this->assertTrue(class_exists($clazz)); - $this->removeClass($clazz); + $this->removeClass('tests\\Apis\\Multiple\\'.$name); } /** @@ -160,7 +162,7 @@ public function testCreateAPITestCase05() { ], $this->executeMultiCommand([ CreateCommand::class, '--c' => 'api-test', - '--manager' => '\\tests\\apis\\emptyService\\EmptyServicesManager', + '--manager' => '\\Apis\\EmptyService\\EmptyServicesManager', ])); $this->assertEquals(-1, $this->getExitCode()); } @@ -168,49 +170,50 @@ public function testCreateAPITestCase05() { * @test */ public function testCreateAPITestCase06() { - $path = ROOT_PATH.DS."tests".DS."tests".DS."apis".DS."multiple"; + $path = ROOT_PATH.DS."tests".DS."Apis".DS."Multiple"; + $name = 'WebService00Test'; $this->assertEquals([ "Please enter services manager information:\n", "Error: Provided class is not an instance of ".WebServicesManager::class."\n", "Please enter services manager information:\n", "Test case will be created with following parameters:\n", "PHPUnit Version: 9\n", - 'Name: tests\tests\apis\multiple\WebService00Test'."\n", + 'Name: Apis\Multiple\\'.$name."\n", "Path: ".$path."\n", "Would you like to use default parameters?(Y/n)\n", "PHPUnit Version: Enter = '11'\n", "Enter a name for the new class:\n", - "Enter an optional namespace for the class: Enter = 'tests\\tests\apis\multiple'\n", + "Enter an optional namespace for the class: Enter = 'Apis\Multiple'\n", "Info: New class was created at \"".$path."\".\n" ], $this->executeMultiCommand([ CreateCommand::class, '--c' => 'api-test', '--service' => 'say-hi-service', ], [ - '\\tests\\apis\\multiple\\WebService00', - '\\tests\\apis\\multiple\\ServicesManager00', + '\\Apis\\Multiple\\WebService00', + '\\Apis\\Multiple\\ServicesManager00', 'n', '10', '', '', ])); $this->assertEquals(0, $this->getExitCode()); - $clazz = '\\tests\\tests\\apis\\multiple\\WebService00Test'; + $clazz = '\\Apis\\Multiple\\'.$name; $this->assertTrue(file_exists($path.DS.'WebService00Test.php')); - require_once $path.DS.'WebService00Test.php'; + require_once $path.DS.$name.'.php'; $this->assertTrue(class_exists($clazz)); - $this->removeClass($clazz); + $this->removeClass('tests\\Apis\\Multiple\\'.$name); } /** * @test */ public function testCreateAPITestCase07() { $this->assertEquals([ - "Error: The argument --manager has invalid value: Not a class: \\tests\\apis\\emptyService\\Xyz\n", + "Error: The argument --manager has invalid value: Not a class: \\tests\\Apis\\EmptyService\\Xyz\n", ], $this->executeMultiCommand([ CreateCommand::class, '--c' => 'api-test', - '--manager' => '\\tests\\apis\\emptyService\\Xyz', + '--manager' => '\\tests\\Apis\\EmptyService\\Xyz', ])); $this->assertEquals(-1, $this->getExitCode()); } @@ -218,21 +221,22 @@ public function testCreateAPITestCase07() { * @test */ public function testCreateAPITestCase08() { - $path = ROOT_PATH.DS."tests".DS."tests".DS."apis".DS."multiple"; + $path = ROOT_PATH.DS."tests".DS."Apis".DS."Multiple"; $this->assertEquals([ "Info: New class was created at \"".$path."\".\n" ], $this->executeMultiCommand([ CreateCommand::class, '--c' => 'api-test', '--service' => 'say-hi-service-2', - '--manager' => '\\tests\\apis\\multiple\\ServicesManager00', + '--manager' => '\\Apis\\Multiple\\ServicesManager00', '--defaults' ])); $this->assertEquals(0, $this->getExitCode()); - $clazz = '\\tests\\tests\\apis\\multiple\\WebService01Test'; - $this->assertTrue(file_exists($path.DS.'WebService01Test.php')); - require_once $path.DS.'WebService01Test.php'; + $name = 'WebService01Test'; + $clazz = '\\Apis\\Multiple\\'.$name; + $this->assertTrue(file_exists($path.DS.$name.'.php')); + require_once $path.DS.$name.'.php'; $this->assertTrue(class_exists($clazz)); - $this->removeClass($clazz); + $this->removeClass('tests\\Apis\\Multiple\\'.$name); } } diff --git a/tests/webfiori/framework/test/cli/CreateCLICommandTest.php b/tests/WebFiori/Framework/Tests/Cli/CreateCLICommandTest.php similarity index 86% rename from tests/webfiori/framework/test/cli/CreateCLICommandTest.php rename to tests/WebFiori/Framework/Tests/Cli/CreateCLICommandTest.php index 4f27c91d5..8257947b3 100644 --- a/tests/webfiori/framework/test/cli/CreateCLICommandTest.php +++ b/tests/WebFiori/Framework/Tests/Cli/CreateCLICommandTest.php @@ -1,9 +1,9 @@ executeSingleCommand(new CreateCommand(), [ - 'webfiori', + 'WebFiori', 'create' ], [ '5', 'NewCLI', - 'app\commands', + 'App\Commands', 'print-hello', 'Prints \'Hello World\' in the console.', 'N', @@ -42,32 +42,32 @@ public function testCreateCommand00() { "10: Database migration.\n", "11: Quit. <--\n", "Enter a name for the new class:\n", - "Enter an optional namespace for the class: Enter = 'app\commands'\n", + "Enter an optional namespace for the class: Enter = 'App\Commands'\n", "Enter a name for the command:\n", "Give a short description of the command:\n", "Would you like to add arguments to the command?(y/N)\n", - 'Info: New class was created at "'.ROOT_PATH.DS.'app'.DS."commands\".\n", + 'Info: New class was created at "'.ROOT_PATH.DS.'App'.DS."Commands\".\n", ], $output); - $this->assertTrue(class_exists('\\app\\commands\\NewCLICommand')); - $this->removeClass('\\app\\commands\\NewCLICommand'); + $this->assertTrue(class_exists('\\App\\Commands\\NewCLICommand')); + $this->removeClass('\\App\\Commands\\NewCLICommand'); } /** * @test */ public function testCreateCommand01() { - $clazz = '\\app\\commands\\DoItCommand'; + $clazz = '\\App\\Commands\\DoItCommand'; if (class_exists($clazz)) { $this->removeClass($clazz); } $output = $this->executeSingleCommand(new CreateCommand(), [ - 'webfiori', + 'WebFiori', 'create', '--c' => 'command' ], [ 'DoIt', - 'app\commands', + 'App\Commands', 'do-it', 'Do something amazing.', 'y', @@ -88,7 +88,7 @@ public function testCreateCommand01() { $this->assertEquals(0, $this->getExitCode()); $this->assertEquals([ "Enter a name for the new class:\n", - "Enter an optional namespace for the class: Enter = 'app\commands'\n", + "Enter an optional namespace for the class: Enter = 'App\Commands'\n", "Enter a name for the command:\n", "Give a short description of the command:\n", "Would you like to add arguments to the command?(y/N)\n", @@ -105,7 +105,7 @@ public function testCreateCommand01() { "Is this argument optional or not?(Y/n)\n", "Enter default value:\n", "Would you like to add more arguments?(y/N)\n", - 'Info: New class was created at "'.ROOT_PATH.DS.'app'.DS."commands\".\n", + 'Info: New class was created at "'.ROOT_PATH.DS.'App'.DS."Commands\".\n", ], $output); $this->assertTrue(class_exists($clazz)); diff --git a/tests/webfiori/framework/test/cli/CreateCommandTest.php b/tests/WebFiori/Framework/Tests/Cli/CreateCommandTest.php similarity index 91% rename from tests/webfiori/framework/test/cli/CreateCommandTest.php rename to tests/WebFiori/Framework/Tests/Cli/CreateCommandTest.php index b60a4b452..eacb03f84 100644 --- a/tests/webfiori/framework/test/cli/CreateCommandTest.php +++ b/tests/WebFiori/Framework/Tests/Cli/CreateCommandTest.php @@ -1,8 +1,8 @@ executeSingleCommand(new CreateCommand(), [ - 'webfiori', + 'WebFiori', 'create' ], [ '11', @@ -44,7 +44,7 @@ public function testCreate00() { */ public function testCreate01() { $output = $this->executeSingleCommand(new CreateCommand(), [ - 'webfiori', + 'WebFiori', 'create' ], [ "\n", // Hit Enter to pick default value (quit) diff --git a/tests/webfiori/framework/test/cli/CreateDBAccessTest.php b/tests/WebFiori/Framework/Tests/Cli/CreateDBAccessTest.php similarity index 73% rename from tests/webfiori/framework/test/cli/CreateDBAccessTest.php rename to tests/WebFiori/Framework/Tests/Cli/CreateDBAccessTest.php index 13664f854..65a4d38e2 100644 --- a/tests/webfiori/framework/test/cli/CreateDBAccessTest.php +++ b/tests/WebFiori/Framework/Tests/Cli/CreateDBAccessTest.php @@ -1,10 +1,10 @@ removeAllDBConnections(); $output = $this->executeSingleCommand(new CreateCommand(), [ - 'webfiori', + 'WebFiori', 'create', '--c' => 'db' ], [ - 'tables\\EmployeeInfoTable', + 'Tables\\EmployeeInfoTable', 'EmployeeOperations', - "\n", // Hit Enter to pick default value (app\database) + "\n", // Hit Enter to pick default value (App\Database) 'SuperUser', - "\n", // Hit Enter to pick default value (app\entity) + "\n", // Hit Enter to pick default value (App\Entity) 'n' ]); @@ -36,15 +36,15 @@ public function test00() { "Enter database table class name (include namespace):\n", "We need from you to give us class information.\n", "Enter a name for the new class:\n", - "Enter an optional namespace for the class: Enter = 'app\database'\n", + "Enter an optional namespace for the class: Enter = 'App\Database'\n", "Warning: No database connections were found. Make sure to specify connection later inside the class.\n", "We need from you to give us entity class information.\n", "Entity class name:\n", - "Entity namespace: Enter = 'app\\entity'\n", + "Entity namespace: Enter = 'App\\Entity'\n", "Would you like to have update methods for every single column?(y/N)\n", - "Info: New class was created at \"". ROOT_PATH.DS."app".DS."database\".\n" + "Info: New class was created at \"". ROOT_PATH.DS."App".DS."Database\".\n" ], $output); - $clazz = '\\app\\database\\EmployeeOperationsDB'; + $clazz = '\\App\\Database\\EmployeeOperationsDB'; $this->assertTrue(class_exists($clazz)); $this->removeClass($clazz); } @@ -54,15 +54,15 @@ public function test00() { */ public function test01() { $output = $this->executeSingleCommand(new CreateCommand(), [ - 'webfiori', + 'WebFiori', 'create', '--c' => 'db' ], [ - 'tables\\EmployeeInfoTable', + 'Tables\\EmployeeInfoTable', 'EmployeeS', - 'app\\database\\empl', + "\n", 'SuperHero', - 'app\\entity\\subs', + "\n", 'y' ]); @@ -71,15 +71,15 @@ public function test01() { "Enter database table class name (include namespace):\n", "We need from you to give us class information.\n", "Enter a name for the new class:\n", - "Enter an optional namespace for the class: Enter = 'app\database'\n", + "Enter an optional namespace for the class: Enter = 'App\Database'\n", "Warning: No database connections were found. Make sure to specify connection later inside the class.\n", "We need from you to give us entity class information.\n", "Entity class name:\n", - "Entity namespace: Enter = 'app\\entity'\n", + "Entity namespace: Enter = 'App\\Entity'\n", "Would you like to have update methods for every single column?(y/N)\n", - "Info: New class was created at \"". ROOT_PATH.DS."app".DS."database".DS."empl\".\n" + "Info: New class was created at \"". ROOT_PATH.DS."App".DS."Database\".\n" ], $output); - $clazz = '\\app\\database\\empl\\EmployeeSDB'; + $clazz = '\\App\\Database\\EmployeeSDB'; $this->assertTrue(class_exists($clazz)); $this->removeClass($clazz); } @@ -94,16 +94,16 @@ public function test02() { App::getConfig()->addOrUpdateDBConnection($conn); $output = $this->executeSingleCommand(new CreateCommand(), [ - 'webfiori', + 'WebFiori', 'create', '--c' => 'db' ], [ - 'tables\\PositionInfoTable', + 'Tables\\PositionInfoTable', 'Position2x', - 'app\\database', + 'App\\Database', '0', 'SuperPosition', - 'app\\entity\\subs', + 'App\\Entity\\subs', 'y' ]); @@ -112,17 +112,17 @@ public function test02() { "Enter database table class name (include namespace):\n", "We need from you to give us class information.\n", "Enter a name for the new class:\n", - "Enter an optional namespace for the class: Enter = 'app\database'\n", + "Enter an optional namespace for the class: Enter = 'App\Database'\n", "Select database connecion to use with the class:\n", "0: Test Connection\n", "1: None <--\n", "We need from you to give us entity class information.\n", "Entity class name:\n", - "Entity namespace: Enter = 'app\\entity'\n", + "Entity namespace: Enter = 'App\\Entity'\n", "Would you like to have update methods for every single column?(y/N)\n", - "Info: New class was created at \"". ROOT_PATH.DS."app".DS."database\".\n" + "Info: New class was created at \"". ROOT_PATH.DS."App".DS."Database\".\n" ], $output); - $clazz = '\\app\\database\\Position2xDB'; + $clazz = '\\App\\Database\\Position2xDB'; $this->assertTrue(class_exists($clazz)); $this->removeClass($clazz); } diff --git a/tests/webfiori/framework/test/cli/CreateEntityTest.php b/tests/WebFiori/Framework/Tests/Cli/CreateEntityTest.php similarity index 86% rename from tests/webfiori/framework/test/cli/CreateEntityTest.php rename to tests/WebFiori/Framework/Tests/Cli/CreateEntityTest.php index f0d107ffa..625099f03 100644 --- a/tests/webfiori/framework/test/cli/CreateEntityTest.php +++ b/tests/WebFiori/Framework/Tests/Cli/CreateEntityTest.php @@ -1,9 +1,9 @@ executeSingleCommand(new CreateCommand(), [ - 'webfiori', + 'WebFiori', 'create', - '--c' => 'entity', + '--c' => 'Entity', '--table' => TestTable::class ], [ 'NeEntity', - "\n", // Hit Enter to pick default value (app\entity) + "\n", // Hit Enter to pick default value (App\Entity) 'y', 'y', 'superNewAttr', @@ -32,7 +32,7 @@ public function testCreateEntity00() { $this->assertEquals([ "We need from you to give us entity class information.\n", "Enter a name for the new class:\n", - "Enter an optional namespace for the class: Enter = 'app\\entity'\n", + "Enter an optional namespace for the class: Enter = 'App\\Entity'\n", "Would you like from your class to implement the interface JsonI?(Y/n)\n", "Would you like to add extra attributes to the entity?(y/N)\n", "Enter attribute name:\n", @@ -48,8 +48,8 @@ public function testCreateEntity00() { "Generating your entity...\n", "Success: Entity class created.\n" ], $output); - $this->assertTrue(class_exists('\\app\\entity\\NeEntity')); - $this->removeClass('\\app\\entity\\NeEntity'); + $this->assertTrue(class_exists('\\App\\Entity\\NeEntity')); + $this->removeClass('\\App\\Entity\\NeEntity'); } /** @@ -57,7 +57,7 @@ public function testCreateEntity00() { */ public function testCreateEntity01() { $output = $this->executeSingleCommand(new CreateCommand(), [ - 'webfiori', + 'WebFiori', 'create', '--c' => 'entiy', // Invalid command value '--table' => TestTable::class @@ -93,7 +93,7 @@ public function testCreateEntity01() { "11: Quit. <--\n", "We need from you to give us entity class information.\n", "Enter a name for the new class:\n", - "Enter an optional namespace for the class: Enter = 'app\\entity'\n", + "Enter an optional namespace for the class: Enter = 'App\\Entity'\n", "Would you like from your class to implement the interface JsonI?(Y/n)\n", "Would you like to add extra attributes to the entity?(y/N)\n", "Enter attribute name:\n", @@ -109,7 +109,7 @@ public function testCreateEntity01() { "Generating your entity...\n", "Success: Entity class created.\n" ], $output); - $this->assertTrue(class_exists('\\app\\entity\\NewEntity')); - $this->removeClass('\\app\\entity\\NewEntity'); + $this->assertTrue(class_exists('\\App\\Entity\\NewEntity')); + $this->removeClass('\\App\\Entity\\NewEntity'); } } diff --git a/tests/webfiori/framework/test/cli/CreateMiddlewareTest.php b/tests/WebFiori/Framework/Tests/Cli/CreateMiddlewareTest.php similarity index 79% rename from tests/webfiori/framework/test/cli/CreateMiddlewareTest.php rename to tests/WebFiori/Framework/Tests/Cli/CreateMiddlewareTest.php index 68c2b3d71..cde392827 100644 --- a/tests/webfiori/framework/test/cli/CreateMiddlewareTest.php +++ b/tests/WebFiori/Framework/Tests/Cli/CreateMiddlewareTest.php @@ -1,10 +1,10 @@ executeSingleCommand(new CreateCommand(), [ - 'webfiori', + 'WebFiori', 'create' ], [ '4', 'NewCoolMd', - 'app\middleware', + 'App\Middleware', 'Check is authorized', '22', "\n", // Hit Enter to pick default value (no group) @@ -44,14 +44,14 @@ public function testCreateMiddleware00() { "10: Database migration.\n", "11: Quit. <--\n", "Enter a name for the new class:\n", - "Enter an optional namespace for the class: Enter = 'app\middleware'\n", + "Enter an optional namespace for the class: Enter = 'App\Middleware'\n", "Enter a name for the middleware:\n", "Enter middleware priority: Enter = '0'\n", "Would you like to add the middleware to a group?(y/N)\n", - 'Info: New class was created at "'.ROOT_PATH.DS.'app'.DS."middleware\".\n", + 'Info: New class was created at "'.ROOT_PATH.DS.'App'.DS."Middleware\".\n", ], $output); - $this->assertTrue(class_exists('\\app\\middleware\\NewCoolMdMiddleware')); - $this->removeClass('\\app\\middleware\\NewCoolMdMiddleware'); + $this->assertTrue(class_exists('\\App\\Middleware\\NewCoolMdMiddleware')); + $this->removeClass('\\App\\Middleware\\NewCoolMdMiddleware'); } /** @@ -59,12 +59,12 @@ public function testCreateMiddleware00() { */ public function testCreateMiddleware01() { $output = $this->executeSingleCommand(new CreateCommand(), [ - 'webfiori', + 'WebFiori', 'create', - '--c' => 'middleware' + '--c' => 'Middleware' ], [ 'NewCool', - 'app\middleware', + 'App\Middleware', ' ', // Invalid input (spaces only) 'Check is cool', '22', @@ -76,7 +76,7 @@ public function testCreateMiddleware01() { $this->assertEquals(0, $this->getExitCode()); $this->assertEquals([ "Enter a name for the new class:\n", - "Enter an optional namespace for the class: Enter = 'app\middleware'\n", + "Enter an optional namespace for the class: Enter = 'App\Middleware'\n", "Enter a name for the middleware:\n", "Error: Invalid input is given. Try again.\n", "Enter a name for the middleware:\n", @@ -84,10 +84,10 @@ public function testCreateMiddleware01() { "Would you like to add the middleware to a group?(y/N)\n", "Enter group name:\n", "Would you like to add the middleware to another group?(y/N)\n", - 'Info: New class was created at "'.ROOT_PATH.DS.'app'.DS."middleware\".\n", + 'Info: New class was created at "'.ROOT_PATH.DS.'App'.DS."Middleware\".\n", ], $output); - $clazz = '\\app\\middleware\\NewCoolMiddleware'; + $clazz = '\\App\\Middleware\\NewCoolMiddleware'; $this->assertTrue(class_exists($clazz)); $clazzObj = new $clazz(); $this->assertTrue($clazzObj instanceof AbstractMiddleware); diff --git a/tests/webfiori/framework/test/cli/CreateMigrationTest.php b/tests/WebFiori/Framework/Tests/Cli/CreateMigrationTest.php similarity index 65% rename from tests/webfiori/framework/test/cli/CreateMigrationTest.php rename to tests/WebFiori/Framework/Tests/Cli/CreateMigrationTest.php index 0ef67a48e..7dff77f2d 100644 --- a/tests/webfiori/framework/test/cli/CreateMigrationTest.php +++ b/tests/WebFiori/Framework/Tests/Cli/CreateMigrationTest.php @@ -1,17 +1,26 @@ assertEquals([ - "Migration namespace: Enter = 'app\database\migrations'\n", + "Migration namespace: Enter = 'App\Database\migrations'\n", "Provide a name for the class that will have migration logic:\n", - 'Info: New class was created at "'. APP_PATH .'database'.DS.'migrations".'."\n", + 'Info: New class was created at "'. APP_PATH .'Database'.DS.'Migrations".'."\n", ], $this->executeMultiCommand([ CreateCommand::class, '--c' => 'migration', @@ -52,6 +61,11 @@ public function testCreateMigration01() { "11" ])); $this->assertEquals(0, $this->getExitCode()); + + // Check if file was written and require it + $filePath = APP_PATH . 'Database' . DS . 'Migrations' . DS . $name . '.php'; + $this->assertTrue(file_exists($filePath), "Class file was not created: $filePath"); + require_once $filePath; $this->assertTrue(class_exists($clazz)); $this->removeClass($clazz); } diff --git a/tests/webfiori/framework/test/cli/CreateRESTTest.php b/tests/WebFiori/Framework/Tests/Cli/CreateRESTTest.php similarity index 83% rename from tests/webfiori/framework/test/cli/CreateRESTTest.php rename to tests/WebFiori/Framework/Tests/Cli/CreateRESTTest.php index 7c7273492..dbcad0935 100644 --- a/tests/webfiori/framework/test/cli/CreateRESTTest.php +++ b/tests/WebFiori/Framework/Tests/Cli/CreateRESTTest.php @@ -1,11 +1,11 @@ removeAllDBConnections(); $output = $this->executeSingleCommand(new CreateCommand(), [ - 'webfiori', + 'WebFiori', 'create', '--c' => 'rest' ], [ '0', 'SuperUser', - 'app\\entity\\super', + 'App\\Entity\\super', 'y', 'n', - "app\\database\\super", + "App\\Database\\super", "super_users", "A table to hold super users information.", "id", @@ -57,7 +57,7 @@ public function test00() { "n", 'n', "y", - "app\\apis\\super" + "App\\Apis\\super" ]); $this->assertEquals(0, $this->getExitCode()); @@ -69,11 +69,11 @@ public function test00() { "1: mssql\n", "First thing, we need entity class information.\n", "Enter a name for the new class:\n", - "Enter an optional namespace for the class: Enter = 'app\\entity'\n", + "Enter an optional namespace for the class: Enter = 'App\\Entity'\n", "Would you like from your entity class to implement the interface JsonI?(Y/n)\n", "Would you like to add extra attributes to the entity?(y/N)\n", "Now, time to collect database table information.\n", - "Provide us with a namespace for table class: Enter = 'app\database'\n", + "Provide us with a namespace for table class: Enter = 'App\Database'\n", "Enter database table name:\n", "Enter your optional comment about the table:\n", "Now you have to add columns to the table.\n", @@ -108,7 +108,7 @@ public function test00() { "Would you like to add another column?(y/N)\n", "Would you like to add foreign keys to the table?(y/N)\n", "Would you like to have update methods for every single column?(y/N)\n", - "Last thing needed is to provide us with namespace for web services: Enter = 'app\\apis'\n", + "Last thing needed is to provide us with namespace for web services: Enter = 'App\\Apis'\n", "Creating entity class...\n", "Creating database table class...\n", "Creating database access class...\n", @@ -116,17 +116,17 @@ public function test00() { "Done.\n" ]), $output); - $tableClazz = '\\app\\database\\super\\SuperUserTable'; - $entityClazz = '\\app\\entity\\super\\SuperUser'; - $dbClazz = "\\app\\database\\super\\SuperUserDB"; + $tableClazz = '\\App\\Database\\super\\SuperUserTable'; + $entityClazz = '\\App\\Entity\\super\\SuperUser'; + $dbClazz = "\\App\\Database\\super\\SuperUserDB"; $apiClazzes = [ - '\\app\\apis\\super\\AddSuperUserService', - '\\app\\apis\\super\\DeleteSuperUserService', - '\\app\\apis\\super\\GetAllSuperUsersService', - '\\app\\apis\\super\\GetSuperUserService', - '\\app\\apis\\super\\UpdateSuperUserService', - '\\app\\apis\\super\\UpdateFirstNameOfSuperUserService', - '\\app\\apis\\super\\UpdateIsHappyOfSuperUserService' + '\\App\\Apis\\super\\AddSuperUserService', + '\\App\\Apis\\super\\DeleteSuperUserService', + '\\App\\Apis\\super\\GetAllSuperUsersService', + '\\App\\Apis\\super\\GetSuperUserService', + '\\App\\Apis\\super\\UpdateSuperUserService', + '\\App\\Apis\\super\\UpdateFirstNameOfSuperUserService', + '\\App\\Apis\\super\\UpdateIsHappyOfSuperUserService' ]; foreach ($apiClazzes as $clazz) { @@ -152,16 +152,16 @@ public function test01() { App::getConfig()->removeAllDBConnections(); $output = $this->executeSingleCommand(new CreateCommand(), [ - 'webfiori', + 'WebFiori', 'create', '--c' => 'rest' ], [ '0', 'SuperUserX', - 'app\\entity\\super', + 'App\\Entity\\super', 'y', 'n', - "app\\database\\super", + "App\\Database\\super", "super_users", "A table to hold super users information.", "id", @@ -191,7 +191,7 @@ public function test01() { "n", 'n', "y", - "app\\apis\\super" + "App\\Apis\\super" ]); $this->assertEquals(0, $this->getExitCode()); @@ -202,11 +202,11 @@ public function test01() { "1: mssql\n", "First thing, we need entity class information.\n", "Enter a name for the new class:\n", - "Enter an optional namespace for the class: Enter = 'app\\entity'\n", + "Enter an optional namespace for the class: Enter = 'App\\Entity'\n", "Would you like from your entity class to implement the interface JsonI?(Y/n)\n", "Would you like to add extra attributes to the entity?(y/N)\n", "Now, time to collect database table information.\n", - "Provide us with a namespace for table class: Enter = 'app\database'\n", + "Provide us with a namespace for table class: Enter = 'App\Database'\n", "Enter database table name:\n", "Enter your optional comment about the table:\n", "Now you have to add columns to the table.\n", @@ -243,7 +243,7 @@ public function test01() { "Would you like to add another column?(y/N)\n", "Would you like to add foreign keys to the table?(y/N)\n", "Would you like to have update methods for every single column?(y/N)\n", - "Last thing needed is to provide us with namespace for web services: Enter = 'app\\apis'\n", + "Last thing needed is to provide us with namespace for web services: Enter = 'App\\Apis'\n", "Creating entity class...\n", "Creating database table class...\n", "Creating database access class...\n", @@ -251,18 +251,18 @@ public function test01() { "Done.\n" ]), $output); - $tableClazz = '\\app\\database\\super\\SuperUserXTable'; - $entityClazz = '\\app\\entity\\super\\SuperUserX'; - $dbClazz = "\\app\\database\\super\\SuperUserXDB"; + $tableClazz = '\\App\\Database\\super\\SuperUserXTable'; + $entityClazz = '\\App\\Entity\\super\\SuperUserX'; + $dbClazz = "\\App\\Database\\super\\SuperUserXDB"; $apiClazzes = [ - '\\app\\apis\\super\\AddSuperUserXService', - '\\app\\apis\\super\\DeleteSuperUserXService', - '\\app\\apis\\super\\GetAllSuperUserXsService', - '\\app\\apis\\super\\GetSuperUserXService', - '\\app\\apis\\super\\UpdateSuperUserXService', - '\\app\\apis\\super\\UpdateFirstNameOfSuperUserXService', - '\\app\\apis\\super\\UpdateIsHappyOfSuperUserXService', - '\\app\\apis\\super\\UpdateIdOfSuperUserXService' + '\\App\\Apis\\super\\AddSuperUserXService', + '\\App\\Apis\\super\\DeleteSuperUserXService', + '\\App\\Apis\\super\\GetAllSuperUserXsService', + '\\App\\Apis\\super\\GetSuperUserXService', + '\\App\\Apis\\super\\UpdateSuperUserXService', + '\\App\\Apis\\super\\UpdateFirstNameOfSuperUserXService', + '\\App\\Apis\\super\\UpdateIsHappyOfSuperUserXService', + '\\App\\Apis\\super\\UpdateIdOfSuperUserXService' ]; foreach ($apiClazzes as $clazz) { @@ -291,16 +291,16 @@ public function test02() { App::getConfig()->addOrUpdateDBConnection($conn); $output = $this->executeSingleCommand(new CreateCommand(), [ - 'webfiori', + 'WebFiori', 'create', '--c' => 'rest', ], [ 'Super Connection', 'SuperUserX9', - 'app\\entity\\super', + 'App\\Entity\\super', 'y', 'n', - "app\\database\\super", + "App\\Database\\super", "super_users", "A table to hold super users information.", "id", @@ -330,7 +330,7 @@ public function test02() { "n", 'n', "y", - "app\\apis\\super" + "App\\Apis\\super" ]); $this->assertEquals(0, $this->getExitCode()); @@ -339,11 +339,11 @@ public function test02() { "0: Super Connection <--\n", "First thing, we need entity class information.\n", "Enter a name for the new class:\n", - "Enter an optional namespace for the class: Enter = 'app\\entity'\n", + "Enter an optional namespace for the class: Enter = 'App\\Entity'\n", "Would you like from your entity class to implement the interface JsonI?(Y/n)\n", "Would you like to add extra attributes to the entity?(y/N)\n", "Now, time to collect database table information.\n", - "Provide us with a namespace for table class: Enter = 'app\database'\n", + "Provide us with a namespace for table class: Enter = 'App\Database'\n", "Enter database table name:\n", "Enter your optional comment about the table:\n", "Now you have to add columns to the table.\n", @@ -378,7 +378,7 @@ public function test02() { "Would you like to add another column?(y/N)\n", "Would you like to add foreign keys to the table?(y/N)\n", "Would you like to have update methods for every single column?(y/N)\n", - "Last thing needed is to provide us with namespace for web services: Enter = 'app\\apis'\n", + "Last thing needed is to provide us with namespace for web services: Enter = 'App\\Apis'\n", "Creating entity class...\n", "Creating database table class...\n", "Creating database access class...\n", @@ -386,19 +386,19 @@ public function test02() { "Done.\n" ]), $output); - $tableClazz = '\\app\\database\\super\\SuperUserX9Table'; - $entityClazz = '\\app\\entity\\super\\SuperUserX9'; - $dbClazz = "\\app\\database\\super\\SuperUserX9DB"; + $tableClazz = '\\App\\Database\\super\\SuperUserX9Table'; + $entityClazz = '\\App\\Entity\\super\\SuperUserX9'; + $dbClazz = "\\App\\Database\\super\\SuperUserX9DB"; $apiClazzes = [ - '\\app\\apis\\super\\AddSuperUserX9Service', - '\\app\\apis\\super\\DeleteSuperUserX9Service', - '\\app\\apis\\super\\GetAllSuperUserX9sService', - '\\app\\apis\\super\\GetSuperUserX9Service', - '\\app\\apis\\super\\UpdateSuperUserX9Service', - '\\app\\apis\\super\\UpdateFirstNameOfSuperUserX9Service', - '\\app\\apis\\super\\UpdateIsHappyOfSuperUserX9Service', - '\\app\\apis\\super\\UpdateIdOfSuperUserX9Service', - '\\app\\apis\\super\\UpdateIsHappyOfSuperUserX9Service' + '\\App\\Apis\\super\\AddSuperUserX9Service', + '\\App\\Apis\\super\\DeleteSuperUserX9Service', + '\\App\\Apis\\super\\GetAllSuperUserX9sService', + '\\App\\Apis\\super\\GetSuperUserX9Service', + '\\App\\Apis\\super\\UpdateSuperUserX9Service', + '\\App\\Apis\\super\\UpdateFirstNameOfSuperUserX9Service', + '\\App\\Apis\\super\\UpdateIsHappyOfSuperUserX9Service', + '\\App\\Apis\\super\\UpdateIdOfSuperUserX9Service', + '\\App\\Apis\\super\\UpdateIsHappyOfSuperUserX9Service' ]; foreach ($apiClazzes as $clazz) { diff --git a/tests/webfiori/framework/test/cli/CreateTableTest.php b/tests/WebFiori/Framework/Tests/Cli/CreateTableTest.php similarity index 89% rename from tests/webfiori/framework/test/cli/CreateTableTest.php rename to tests/WebFiori/Framework/Tests/Cli/CreateTableTest.php index e94674e7b..0f7d4a28d 100644 --- a/tests/webfiori/framework/test/cli/CreateTableTest.php +++ b/tests/WebFiori/Framework/Tests/Cli/CreateTableTest.php @@ -1,13 +1,13 @@ executeSingleCommand(new CreateCommand(), [ - 'webfiori', + 'WebFiori', 'create', '--c' => 'table' ], [ 'mysql', 'Cool00Table', - "\n", // Hit Enter to pick default value (app\database) + "\n", // Hit Enter to pick default value (App\database) 'cool_table_00', 'This is the first cool table that was created using CLI.', 'id', @@ -87,8 +87,8 @@ public function testCreateTable00() { ]); $this->assertEquals(0, $this->getExitCode()); - $this->assertTrue(class_exists('\\app\\database\\Cool00Table')); - $clazz = '\\app\\database\\Cool00Table'; + $this->assertTrue(class_exists('\\App\\Database\\Cool00Table')); + $clazz = '\\App\\Database\\Cool00Table'; $this->removeClass($clazz); $testObj = new $clazz(); $this->assertTrue($testObj instanceof MySQLTable); @@ -107,7 +107,7 @@ public function testCreateTable00() { "0: mysql\n", "1: mssql\n", "Enter a name for the new class:\n", - "Enter an optional namespace for the class: Enter = 'app\database'\n", + "Enter an optional namespace for the class: Enter = 'App\Database'\n", "Enter database table name: Enter = 'cool_00_table'\n", "Enter your optional comment about the table:\n", "Now you have to add columns to the table.\n", @@ -120,7 +120,7 @@ public function testCreateTable00() { "Would you like to add another column?(y/N)\n", "Would you like to add foreign keys to the table?(y/N)\n", "Would you like to create an entity class that maps to the database table?(y/N)\n", - 'Info: New class was created at "'.ROOT_PATH.DS.'app'.DS."database\".\n", + 'Info: New class was created at "'.ROOT_PATH.DS.'App'.DS."Database\".\n", ]), $output); } @@ -129,13 +129,13 @@ public function testCreateTable00() { */ public function testCreateTable01() { $output = $this->executeSingleCommand(new CreateCommand(), [ - 'webfiori', + 'WebFiori', 'create', '--c' => 'table' ], [ 'mssql', 'Cool01Table', - "\n", // Hit Enter to pick default value (app\database) + "\n", // Hit Enter to pick default value (App\database) 'cool_table_01', 'This is the first cool table that was created using CLI.', 'id', @@ -149,7 +149,7 @@ public function testCreateTable01() { ]); $this->assertEquals(0, $this->getExitCode()); - $clazz = '\\app\\database\\Cool01Table'; + $clazz = '\\App\\Database\\Cool01Table'; $this->assertTrue(class_exists($clazz)); $this->removeClass($clazz); $testObj = new $clazz(); @@ -172,7 +172,7 @@ public function testCreateTable01() { "0: mysql\n", "1: mssql\n", "Enter a name for the new class:\n", - "Enter an optional namespace for the class: Enter = 'app\database'\n", + "Enter an optional namespace for the class: Enter = 'App\Database'\n", "Enter database table name: Enter = 'cool_01_table'\n", "Enter your optional comment about the table:\n", "Now you have to add columns to the table.\n", @@ -184,7 +184,7 @@ public function testCreateTable01() { "Would you like to add another column?(y/N)\n", "Would you like to add foreign keys to the table?(y/N)\n", "Would you like to create an entity class that maps to the database table?(y/N)\n", - 'Info: New class was created at "'.ROOT_PATH.DS.'app'.DS."database\".\n", + 'Info: New class was created at "'.ROOT_PATH.DS.'App'.DS."Database\".\n", ]), $output); } @@ -193,13 +193,13 @@ public function testCreateTable01() { */ public function testCreateTable02() { $output = $this->executeSingleCommand(new CreateCommand(), [ - 'webfiori', + 'WebFiori', 'create', '--c' => 'table' ], [ 'mysql', 'Cool02Table', - "\n", // Hit Enter to pick default value (app\database) + "\n", // Hit Enter to pick default value (App\database) 'cool_table_02', "\n", // Hit Enter to pick default value (empty comment) 'id', @@ -225,8 +225,8 @@ public function testCreateTable02() { ]); $this->assertEquals(0, $this->getExitCode()); - $this->assertTrue(class_exists('\\app\\database\\Cool02Table')); - $clazz = '\\app\\database\\Cool02Table'; + $this->assertTrue(class_exists('\\App\\Database\\Cool02Table')); + $clazz = '\\App\\Database\\Cool02Table'; $this->removeClass($clazz); $testObj = new $clazz(); $this->assertTrue($testObj instanceof MySQLTable); @@ -247,7 +247,7 @@ public function testCreateTable02() { "0: mysql\n", "1: mssql\n", "Enter a name for the new class:\n", - "Enter an optional namespace for the class: Enter = 'app\database'\n", + "Enter an optional namespace for the class: Enter = 'App\Database'\n", "Enter database table name: Enter = 'cool_02_table'\n", "Enter your optional comment about the table:\n", "Now you have to add columns to the table.\n", @@ -272,7 +272,7 @@ public function testCreateTable02() { "Would you like to add another column?(y/N)\n", "Would you like to add foreign keys to the table?(y/N)\n", "Would you like to create an entity class that maps to the database table?(y/N)\n", - 'Info: New class was created at "'.ROOT_PATH.DS.'app'.DS."database\".\n", + 'Info: New class was created at "'.ROOT_PATH.DS.'App'.DS."Database\".\n", ]), $output); } diff --git a/tests/webfiori/framework/test/cli/CreateTaskTest.php b/tests/WebFiori/Framework/Tests/Cli/CreateTaskTest.php similarity index 87% rename from tests/webfiori/framework/test/cli/CreateTaskTest.php rename to tests/WebFiori/Framework/Tests/Cli/CreateTaskTest.php index 17acb7f10..d09f79541 100644 --- a/tests/webfiori/framework/test/cli/CreateTaskTest.php +++ b/tests/WebFiori/Framework/Tests/Cli/CreateTaskTest.php @@ -1,10 +1,10 @@ executeSingleCommand(new CreateCommand(), [ - 'webfiori', + 'WebFiori', 'create' ], [ '3', 'SuperCoolTask', - 'app\tasks', + 'App\Tasks', 'The Greatest task', 'The task will do nothing.', 'N', @@ -45,13 +45,13 @@ public function test00() { "10: Database migration.\n", "11: Quit. <--\n", "Enter a name for the new class:\n", - "Enter an optional namespace for the class: Enter = 'app\\tasks'\n", + "Enter an optional namespace for the class: Enter = 'App\\Tasks'\n", "Enter a name for the task:\n", "Provide short description of what does the task will do:\n", "Would you like to add arguments to the task?(y/N)\n", - "Info: New class was created at \"".ROOT_PATH.DS.'app'.DS."tasks\".\n", + "Info: New class was created at \"".ROOT_PATH.DS.'App'.DS."Tasks\".\n", ], $output); - $clazz = '\\app\\tasks\\SuperCoolTask'; + $clazz = '\\App\\Tasks\\SuperCoolTask'; $this->assertTrue(class_exists($clazz)); $this->removeClass($clazz); } @@ -61,14 +61,14 @@ public function test00() { */ public function test01() { $output = $this->executeSingleCommand(new CreateCommand(), [ - 'webfiori', + 'WebFiori', 'create' ], [ '3', 'SuperCoolTask', - 'app\tasks', + 'App\Tasks', 'SuperCool2', - 'app\tasks', + 'App\Tasks', 'The Greatest task', 'The task will do nothing.', 'N', @@ -91,18 +91,18 @@ public function test01() { "10: Database migration.\n", "11: Quit. <--\n", "Enter a name for the new class:\n", - "Enter an optional namespace for the class: Enter = 'app\\tasks'\n", + "Enter an optional namespace for the class: Enter = 'App\\Tasks'\n", "Error: A class in the given namespace which has the given name was found.\n", "Enter a name for the new class:\n", - "Enter an optional namespace for the class: Enter = 'app\\tasks'\n", + "Enter an optional namespace for the class: Enter = 'App\\Tasks'\n", "Enter a name for the task:\n", "Provide short description of what does the task will do:\n", "Would you like to add arguments to the task?(y/N)\n", - "Info: New class was created at \"".ROOT_PATH.DS.'app'.DS."tasks\".\n", + "Info: New class was created at \"".ROOT_PATH.DS.'App'.DS."Tasks\".\n", ], $output); - $clazz = '\\app\\tasks\\SuperCool2Task'; + $clazz = '\\App\\Tasks\\SuperCool2Task'; $this->assertTrue(class_exists($clazz)); - $this->removeClass('\\app\\tasks\\SuperCoolTask'); + $this->removeClass('\\App\\Tasks\\SuperCoolTask'); $this->removeClass($clazz); } @@ -111,12 +111,12 @@ public function test01() { */ public function test02() { $output = $this->executeSingleCommand(new CreateCommand(), [ - 'webfiori', + 'WebFiori', 'create' ], [ '3', 'NewRound', - 'app\tasks', + 'App\Tasks', '', // Invalid empty name 'Invalid#', // Invalid name with special character 'Create Round task', @@ -142,7 +142,7 @@ public function test02() { "10: Database migration.\n", "11: Quit. <--\n", "Enter a name for the new class:\n", - "Enter an optional namespace for the class: Enter = 'app\\tasks'\n", + "Enter an optional namespace for the class: Enter = 'App\\Tasks'\n", "Enter a name for the task:\n", "Error: Provided name is invalid!\n", "Enter a name for the task:\n", @@ -152,9 +152,9 @@ public function test02() { "Error: Invalid input is given. Try again.\n", "Provide short description of what does the task will do:\n", "Would you like to add arguments to the task?(y/N)\n", - "Info: New class was created at \"".ROOT_PATH.DS.'app'.DS."tasks\".\n", + "Info: New class was created at \"".ROOT_PATH.DS.'App'.DS."Tasks\".\n", ], $output); - $clazz = '\\app\\tasks\\NewRoundTask'; + $clazz = '\\App\\Tasks\\NewRoundTask'; $this->assertTrue(class_exists($clazz)); $this->removeClass($clazz); } @@ -164,12 +164,12 @@ public function test02() { */ public function test03() { $output = $this->executeSingleCommand(new CreateCommand(), [ - 'webfiori', + 'WebFiori', 'create', '--c' => 'task' ], [ 'SendDailyReport', - 'app\tasks', + 'App\Tasks', 'Send Sales Report', 'The task will execute every day to send sales report to management.', 'y', @@ -190,7 +190,7 @@ public function test03() { $this->assertEquals(0, $this->getExitCode()); $this->assertEquals([ "Enter a name for the new class:\n", - "Enter an optional namespace for the class: Enter = 'app\\tasks'\n", + "Enter an optional namespace for the class: Enter = 'App\\Tasks'\n", "Enter a name for the task:\n", "Provide short description of what does the task will do:\n", "Would you like to add arguments to the task?(y/N)\n", @@ -208,9 +208,9 @@ public function test03() { "Enter argument name:\n", "Error: Invalid argument name: \n", "Would you like to add more arguments?(y/N)\n", - "Info: New class was created at \"".ROOT_PATH.DS.'app'.DS."tasks\".\n", + "Info: New class was created at \"".ROOT_PATH.DS.'App'.DS."Tasks\".\n", ], $output); - $clazz = '\\app\\tasks\\SendDailyReportTask'; + $clazz = '\\App\\Tasks\\SendDailyReportTask'; $this->assertTrue(class_exists($clazz)); $this->removeClass($clazz); $task = new $clazz(); diff --git a/tests/webfiori/framework/test/cli/CreateThemeTest.php b/tests/WebFiori/Framework/Tests/Cli/CreateThemeTest.php similarity index 60% rename from tests/webfiori/framework/test/cli/CreateThemeTest.php rename to tests/WebFiori/Framework/Tests/Cli/CreateThemeTest.php index dc8bf311b..30c682b1e 100644 --- a/tests/webfiori/framework/test/cli/CreateThemeTest.php +++ b/tests/WebFiori/Framework/Tests/Cli/CreateThemeTest.php @@ -1,10 +1,10 @@ removeDirectory($themePath); + } + } + } + parent::tearDown(); + } + + private function removeDirectory($dir) { + if (!is_dir($dir)) { + return; + } + $files = array_diff(scandir($dir), ['.', '..']); + foreach ($files as $file) { + $path = $dir . DS . $file; + is_dir($path) ? $this->removeDirectory($path) : unlink($path); + } + rmdir($dir); + } /** * @test */ public function testCreateTheme00() { $output = $this->executeSingleCommand(new CreateCommand(), [ - 'webfiori', + 'WebFiori', 'create' ], [ '6', 'NewTest', - 'themes\\fiori', + 'Themes\\Fiori', "\n", // Hit Enter to pick default value ]); $this->assertEquals(0, $this->getExitCode()); @@ -41,18 +67,18 @@ public function testCreateTheme00() { "10: Database migration.\n", "11: Quit. <--\n", "Enter a name for the new class:\n", - "Enter an optional namespace for the class: Enter = 'themes'\n", - 'Creating theme at "'.ROOT_PATH.DS.'themes'.DS."fiori\"...\n", - 'Info: New class was created at "'.ROOT_PATH.DS.'themes'.DS."fiori\".\n", + "Enter an optional namespace for the class: Enter = 'Themes'\n", + 'Creating theme at "'.ROOT_PATH.DS.'Themes'.DS."Fiori\"...\n", + 'Info: New class was created at "'.ROOT_PATH.DS.'Themes'.DS."Fiori\".\n", ], $output); - $this->assertTrue(class_exists('\\themes\\fiori\\NewTestTheme')); + $this->assertTrue(class_exists('\\Themes\\Fiori\\NewTestTheme')); - $this->removeClass('\\themes\\fiori\\NewTestTheme'); - $this->removeClass('\\themes\\fiori\\AsideSection'); - $this->removeClass('\\themes\\fiori\\FooterSection'); - $this->removeClass('\\themes\\fiori\\HeadSection'); - $this->removeClass('\\themes\\fiori\\HeaderSection'); + $this->removeClass('\\Themes\\Fiori\\NewTestTheme'); + $this->removeClass('\\Themes\\Fiori\\AsideSection'); + $this->removeClass('\\Themes\\Fiori\\FooterSection'); + $this->removeClass('\\Themes\\Fiori\\HeadSection'); + $this->removeClass('\\Themes\\Fiori\\HeaderSection'); } /** @@ -60,14 +86,14 @@ public function testCreateTheme00() { */ public function testCreateThemeWithExistingName() { $runner = App::getRunner(); - $ns = '\\themes\\fioriTheme'; + $ns = '\\Themes\\FioriTheme'; $name = 'NewFTestTheme'; - $ns2 = '\\themes\\cool'; + $ns2 = '\\Themes\\Cool'; $name2 = 'NewFTestTheme'; $output = $this->executeSingleCommand(new CreateCommand(), [ - 'webfiori', + 'WebFiori', 'create' ], [ '6', @@ -94,12 +120,12 @@ public function testCreateThemeWithExistingName() { "10: Database migration.\n", "11: Quit. <--\n", "Enter a name for the new class:\n", - "Enter an optional namespace for the class: Enter = 'themes'\n", + "Enter an optional namespace for the class: Enter = 'Themes'\n", "Error: A class in the given namespace which has the given name was found.\n", "Enter a name for the new class:\n", - "Enter an optional namespace for the class: Enter = 'themes'\n", - 'Creating theme at "'.ROOT_PATH.DS.'themes'.DS."cool\"...\n", - 'Info: New class was created at "'.ROOT_PATH.DS.'themes'.DS."cool\".\n", + "Enter an optional namespace for the class: Enter = 'Themes'\n", + 'Creating theme at "'.ROOT_PATH.DS.'Themes'.DS."Cool\"...\n", + 'Info: New class was created at "'.ROOT_PATH.DS.'Themes'.DS."Cool\".\n", ], $output); $this->assertEquals(0, $this->getExitCode()); $this->removeClass($ns2.'\\'.$name2); diff --git a/tests/webfiori/framework/test/cli/CreateWebServiceTest.php b/tests/WebFiori/Framework/Tests/Cli/CreateWebServiceTest.php similarity index 92% rename from tests/webfiori/framework/test/cli/CreateWebServiceTest.php rename to tests/WebFiori/Framework/Tests/Cli/CreateWebServiceTest.php index 092738710..8c7f5d941 100644 --- a/tests/webfiori/framework/test/cli/CreateWebServiceTest.php +++ b/tests/WebFiori/Framework/Tests/Cli/CreateWebServiceTest.php @@ -1,8 +1,8 @@ executeSingleCommand(new CreateCommand(), [ - 'webfiori', + 'WebFiori', 'create' ], [ '2', 'NewWeb', - "\n", // Hit Enter to pick default value (app\apis) + "\n", // Hit Enter to pick default value (App\Apis) 'get-hello', 'Service Desc', "\n", // Hit Enter to pick default value (GET method) @@ -55,7 +55,7 @@ public function test00() { "10: Database migration.\n", "11: Quit. <--\n", "Enter a name for the new class:\n", - "Enter an optional namespace for the class: Enter = 'app\apis'\n", + "Enter an optional namespace for the class: Enter = 'App\Apis'\n", "Enter a name for the new web service:\n", "Description:\n", "Request method:\n", @@ -87,13 +87,13 @@ public function test00() { "Success: New parameter added.\n", "Would you like to add another parameter?(y/N)\n", "Creating the class...\n", - 'Info: New class was created at "'.ROOT_PATH.DS.'app'.DS."apis\".\n", + 'Info: New class was created at "'.ROOT_PATH.DS.'App'.DS."Apis\".\n", "Info: Don't forget to add the service to a services manager.\n", ], $output); - $clazz = '\\app\\apis\\NewWebService'; + $clazz = '\\App\\Apis\\NewWebService'; $this->assertTrue(class_exists($clazz)); - $this->removeClass('\\app\\apis\\NewWebService'); + $this->removeClass('\\App\\Apis\\NewWebService'); $instance = new $clazz(); $instance instanceof AbstractWebService; $this->assertEquals('get-hello', $instance->getName()); @@ -120,12 +120,12 @@ public function test00() { */ public function test01() { $output = $this->executeSingleCommand(new CreateCommand(), [ - 'webfiori', + 'WebFiori', 'create', '--c' => 'web-service' ], [ 'NewWeb2', - "\n", // Hit Enter to pick default value (app\apis) + "\n", // Hit Enter to pick default value (App\Apis) 'get-hello-2', 'Service\'s Desc', "\n", // Hit Enter to pick default value (GET method) @@ -144,7 +144,7 @@ public function test01() { $this->assertEquals(0, $this->getExitCode()); $this->assertEquals([ "Enter a name for the new class:\n", - "Enter an optional namespace for the class: Enter = 'app\apis'\n", + "Enter an optional namespace for the class: Enter = 'App\Apis'\n", "Enter a name for the new web service:\n", "Description:\n", "Request method:\n", @@ -186,13 +186,13 @@ public function test01() { "Success: New parameter added.\n", "Would you like to add another parameter?(y/N)\n", "Creating the class...\n", - 'Info: New class was created at "'.ROOT_PATH.DS.'app'.DS."apis\".\n", + 'Info: New class was created at "'.ROOT_PATH.DS.'App'.DS."Apis\".\n", "Info: Don't forget to add the service to a services manager.\n", ], $output); - $clazz = '\\app\\apis\\NewWeb2Service'; + $clazz = '\\App\\Apis\\NewWeb2Service'; $this->assertTrue(class_exists($clazz)); - $this->removeClass('\\app\\apis\\NewWeb2Service'); + $this->removeClass('\\App\\Apis\\NewWeb2Service'); $instance = new $clazz(); $instance instanceof AbstractWebService; $this->assertEquals('get-hello-2', $instance->getName()); @@ -219,12 +219,12 @@ public function test01() { */ public function test02() { $output = $this->executeSingleCommand(new CreateCommand(), [ - 'webfiori', + 'WebFiori', 'create', '--c' => 'web-service' ], [ 'NewWeb3', - "\n", // Hit Enter to pick default value (app\apis) + "\n", // Hit Enter to pick default value (App\Apis) 'get-hello-3', 'Service\'s Desc', "\n", // Hit Enter to pick default value (GET method) @@ -243,7 +243,7 @@ public function test02() { $this->assertEquals(0, $this->getExitCode()); $this->assertEquals([ "Enter a name for the new class:\n", - "Enter an optional namespace for the class: Enter = 'app\apis'\n", + "Enter an optional namespace for the class: Enter = 'App\Apis'\n", "Enter a name for the new web service:\n", "Description:\n", "Request method:\n", @@ -285,11 +285,11 @@ public function test02() { "Success: New parameter added.\n", "Would you like to add another parameter?(y/N)\n", "Creating the class...\n", - 'Info: New class was created at "'.ROOT_PATH.DS.'app'.DS."apis\".\n", + 'Info: New class was created at "'.ROOT_PATH.DS.'App'.DS."Apis\".\n", "Info: Don't forget to add the service to a services manager.\n", ], $output); - $clazz = '\\app\\apis\\NewWeb3Service'; + $clazz = '\\App\\Apis\\NewWeb3Service'; $this->assertTrue(class_exists($clazz)); $this->removeClass($clazz); $instance = new $clazz(); diff --git a/tests/WebFiori/Framework/Tests/Cli/DBClassWritterTest.php b/tests/WebFiori/Framework/Tests/Cli/DBClassWritterTest.php new file mode 100644 index 000000000..f34ade04b --- /dev/null +++ b/tests/WebFiori/Framework/Tests/Cli/DBClassWritterTest.php @@ -0,0 +1,107 @@ +getEntityMapper(); + $mapper->setEntityName('CoolUser'); + $mapper->setNamespace('WebFiori\\Entity'); + $writter = new DBClassWriter('UserDBClass', 'WebFiori\\Db', $table); + $writter->writeClass(); + + // Check if file was written and require it + $filePath = $writter->getPath() . DS . $writter->getName() . '.php'; + $this->assertTrue(file_exists($filePath), "Class file was not created: $filePath"); + require_once $filePath; + $this->assertTrue(class_exists($writter->getName(true))); + $this->removeClass($writter->getName(true)); + } + + /** + * @test + */ + public function test01() { + $table = new EmployeeInfoTable(); + $mapper = $table->getEntityMapper(); + $mapper->setEntityName('Employee'); + $mapper->setNamespace('WebFiori\\Entity'); + $writter = new DBClassWriter('EmployeeDB', 'WebFiori\\Db', $table); + $writter->writeClass(); + + // Check if file was written and require it + $filePath = $writter->getPath() . DS . $writter->getName() . '.php'; + $this->assertTrue(file_exists($filePath), "Class file was not created: $filePath"); + require_once $filePath; + $this->assertTrue(class_exists($writter->getName(true))); + $this->removeClass($writter->getName(true)); + } + + /** + * @test + */ + public function test02() { + $table = new PositionInfoTable(); + $mapper = $table->getEntityMapper(); + $mapper->setEntityName('Position'); + $mapper->setNamespace('WebFiori\\Entity'); + $writter = new DBClassWriter('PositionDB', 'WebFiori\\Db', $table); + $writter->writeClass(); + + // Check if file was written and require it + $filePath = $writter->getPath() . DS . $writter->getName() . '.php'; + $this->assertTrue(file_exists($filePath), "Class file was not created: $filePath"); + require_once $filePath; + $this->assertTrue(class_exists($writter->getName(true))); + $this->removeClass($writter->getName(true)); + } + + /** + * @test + */ + public function test03() { + $table = new PositionInfoTable(); + $writter = new DBClassWriter('PositionDB2', 'WebFiori\\Db', $table); + $writter->setConnection(' '); + $this->assertNull($writter->getConnectionName()); + $writter->setConnection('ok-connection'); + $this->assertEquals('ok-connection', $writter->getConnectionName()); + $writter->includeColumnsUpdate(); + $writter->writeClass(); + + // Check if file was written and require it + $filePath = $writter->getPath() . DS . $writter->getName() . '.php'; + $this->assertTrue(file_exists($filePath), "Class file was not created: $filePath"); + require_once $filePath; + $this->assertTrue(class_exists($writter->getName(true))); + $this->removeClass($writter->getName(true)); + } +} diff --git a/tests/webfiori/framework/test/cli/HelpCommandTest.php b/tests/WebFiori/Framework/Tests/Cli/HelpCommandTest.php similarity index 95% rename from tests/webfiori/framework/test/cli/HelpCommandTest.php rename to tests/WebFiori/Framework/Tests/Cli/HelpCommandTest.php index 299ee050e..917064faf 100644 --- a/tests/webfiori/framework/test/cli/HelpCommandTest.php +++ b/tests/WebFiori/Framework/Tests/Cli/HelpCommandTest.php @@ -1,7 +1,7 @@ setInputs(); $runner->setArgsVector([ - 'webfiori', + 'WebFiori', 'list-routes' ]); $runner->start(); @@ -34,7 +34,7 @@ public function test01() { $runner = App::getRunner(); $runner->setInputs(); $runner->setArgsVector([ - 'webfiori', + 'WebFiori', 'list-routes' ]); Router::addRoute([ diff --git a/tests/webfiori/framework/test/cli/ListThemesCommandTest.php b/tests/WebFiori/Framework/Tests/Cli/ListThemesCommandTest.php similarity index 92% rename from tests/webfiori/framework/test/cli/ListThemesCommandTest.php rename to tests/WebFiori/Framework/Tests/Cli/ListThemesCommandTest.php index 32f1c0657..53357ae3b 100644 --- a/tests/webfiori/framework/test/cli/ListThemesCommandTest.php +++ b/tests/WebFiori/Framework/Tests/Cli/ListThemesCommandTest.php @@ -1,8 +1,8 @@ setInputs(); $runner->setArgsVector([ - 'webfiori', + 'WebFiori', 'list-themes' ]); $runner->start(); @@ -33,7 +33,7 @@ public function test01() { $runner = App::getRunner(); $runner->setInputs(); $runner->setArgsVector([ - 'webfiori', + 'WebFiori', 'list-themes', '--theme-name' => "New Super Theme" ]); @@ -54,7 +54,7 @@ public function test02() { $runner = App::getRunner(); $runner->setInputs(); $runner->setArgsVector([ - 'webfiori', + 'WebFiori', 'list-themes', '--theme-name="Not Exist"' ]); diff --git a/tests/webfiori/framework/test/cli/RunMigrationsCommandTest.php b/tests/WebFiori/Framework/Tests/Cli/RunMigrationsCommandTest.php similarity index 97% rename from tests/webfiori/framework/test/cli/RunMigrationsCommandTest.php rename to tests/WebFiori/Framework/Tests/Cli/RunMigrationsCommandTest.php index bdb059c82..0a8adc45b 100644 --- a/tests/webfiori/framework/test/cli/RunMigrationsCommandTest.php +++ b/tests/WebFiori/Framework/Tests/Cli/RunMigrationsCommandTest.php @@ -1,11 +1,11 @@ removeAllDBConnections(); $output = $this->executeSingleCommand(new RunSQLQueryCommand(), [ - 'webfiori', + 'WebFiori', 'run-query', '--connection' => 'testing-connection', '--no-confirm', @@ -105,7 +105,7 @@ public function testQueryFromFile01() { App::getConfig()->addOrUpdateDBConnection($conn); $output = $this->executeSingleCommand(new RunSQLQueryCommand(), [ - 'webfiori', + 'WebFiori', 'run-query', '--connection' => 'testing-connection', '--no-confirm', @@ -130,7 +130,7 @@ public function testQueryFromFile02() { 'run-query', '--connection' => 'testing-connection', '--no-confirm', - '--file' => 'app\\database\\Test2Table.php' + '--file' => 'App\\Database\\Test2Table.php' ], []); $this->assertEquals(-1, $this->getExitCode()); @@ -151,7 +151,7 @@ public function testQueryFromFile03() { 'run-query', '--connection' => 'testing-connection', '--no-confirm', - '--file' => 'app\\database\\sql-file.sql' + '--file' => 'App\\Database\\sql-file.sql' ], []); $this->assertEquals(0, $this->getExitCode()); diff --git a/tests/webfiori/framework/test/cli/SchedulerCommandTest.php b/tests/WebFiori/Framework/Tests/Cli/SchedulerCommandTest.php similarity index 87% rename from tests/webfiori/framework/test/cli/SchedulerCommandTest.php rename to tests/WebFiori/Framework/Tests/Cli/SchedulerCommandTest.php index 223cfd540..9bb2d5fdb 100644 --- a/tests/webfiori/framework/test/cli/SchedulerCommandTest.php +++ b/tests/WebFiori/Framework/Tests/Cli/SchedulerCommandTest.php @@ -1,9 +1,9 @@ executeSingleCommand(new SchedulerCommand(), [ - 'webfiori', + 'WebFiori', 'scheduler', ], []); @@ -39,7 +39,7 @@ public function testCheckScheduledTasks() { TasksManager::setPassword('123456'); $output = $this->executeSingleCommand(new SchedulerCommand(), [ - 'webfiori', + 'WebFiori', 'scheduler', '--check', 'p' => '123456' @@ -63,7 +63,7 @@ public function testCheckScheduledTasks() { */ public function testCheckWithoutPassword() { $output = $this->executeSingleCommand(new SchedulerCommand(), [ - 'webfiori', + 'WebFiori', 'scheduler', '--check', ], []); @@ -80,7 +80,7 @@ public function testCheckWithoutPassword() { public function testForceTaskExecution() { $output = $this->executeSingleCommand(new SchedulerCommand(), [ - 'webfiori', + 'WebFiori', 'scheduler', '--force', 'p' => '123456' @@ -111,7 +111,7 @@ public function testForceTaskExecution() { */ public function testForceTaskWithLogging() { $output = $this->executeSingleCommand(new SchedulerCommand(), [ - 'webfiori', + 'WebFiori', 'scheduler', '--force', '--show-log', @@ -132,11 +132,11 @@ public function testForceTaskWithLogging() { "Running task(s) check...\n", "Forcing task 'Fail 1' to execute...\n", "Active task: \"Fail 1\" ...\n", - "Calling the method app\\tasks\Fail1TestTask::execute()\n", + "Calling the method App\\Tasks\Fail1TestTask::execute()\n", "Info: Task Fail 1 Is executing...\n", - "Calling the method app\\tasks\Fail1TestTask::onFail()\n", + "Calling the method App\\Tasks\Fail1TestTask::onFail()\n", "Error: Task Fail 1 Failed.\n", - "Calling the method app\\tasks\Fail1TestTask::afterExec()\n", + "Calling the method App\\Tasks\Fail1TestTask::afterExec()\n", "Check finished.\n", "Total number of tasks: 5\n", "Executed Tasks: 1\n", @@ -152,7 +152,7 @@ public function testForceTaskWithLogging() { */ public function testForceTaskWithExceptionLogging() { $output = $this->executeSingleCommand(new SchedulerCommand(), [ - 'webfiori', + 'WebFiori', 'scheduler', '--force', '--show-log', @@ -173,20 +173,20 @@ public function testForceTaskWithExceptionLogging() { "Running task(s) check...\n", "Forcing task 'Fail 2' to execute...\n", "Active task: \"Fail 2\" ...\n", - "Calling the method app\\tasks\Fail2TestTask::execute()\n", - "WARNING: An exception was thrown while performing the operation app\\tasks\Fail2TestTask::execute. The output of the task might be not as expected.\n", + "Calling the method App\\Tasks\Fail2TestTask::execute()\n", + "WARNING: An exception was thrown while performing the operation App\\Tasks\Fail2TestTask::execute. The output of the task might be not as expected.\n", "Exception class: Error\n", - "Exception message: Call to undefined method app\\tasks\Fail2TestTask::undefined()\n", + "Exception message: Call to undefined method App\\Tasks\Fail2TestTask::undefined()\n", "Thrown in: Fail2TestTask", "Line: 44", "Stack Trace:", - "#0 At class webfiori\\framework\\scheduler\\AbstractTask Line:", - "#1 At class webfiori\\framework\\scheduler\\AbstractTask Line:", - "#2 At class webfiori\\framework\\scheduler\\AbstractTask Line:", - "#3 At class webfiori\\framework\\scheduler\\TasksManager Line:", - "#4 At class webfiori\\framework\\scheduler\\TasksManager Line:", - "#5 At class webfiori\\framework\\cli\\commands\\SchedulerCommand Line:", - "#6 At class webfiori\\framework\\cli\\commands\\SchedulerCommand Line:", + "#0 At class WebFiori\\Framework\\Scheduler\\AbstractTask Line:", + "#1 At class WebFiori\\Framework\\Scheduler\\AbstractTask Line:", + "#2 At class WebFiori\\Framework\\Scheduler\\AbstractTask Line:", + "#3 At class WebFiori\\Framework\\Scheduler\\TasksManager Line:", + "#4 At class WebFiori\\Framework\\Scheduler\\TasksManager Line:", + "#5 At class WebFiori\\Framework\\Cli\\Commands\\SchedulerCommand Line:", + "#6 At class WebFiori\\Framework\\Cli\\Commands\\SchedulerCommand Line:", "#7 At class WebFiori\\Cli\\Command Line:", "#8 At class WebFiori\\Cli\\Runner Line:", "#9 At class WebFiori\\Cli\\Runner Line:", @@ -210,7 +210,7 @@ public function testForceTaskWithExceptionLogging() { public function testForceSpecificTaskByName() { $this->getRunner(true); $output = $this->executeSingleCommand(new SchedulerCommand(), [ - 'webfiori', + 'WebFiori', 'scheduler', '--force', '--show-log', @@ -226,12 +226,12 @@ public function testForceSpecificTaskByName() { "Running task(s) check...\n", "Forcing task 'Success 1' to execute...\n", "Active task: \"Success 1\" ...\n", - "Calling the method app\\tasks\SuccessTestTask::execute()\n", + "Calling the method App\\Tasks\SuccessTestTask::execute()\n", "Start: 2021-07-08\n", "End: \n", "The task was forced.\n", - "Calling the method app\\tasks\SuccessTestTask::onSuccess()\n", - "Calling the method app\\tasks\SuccessTestTask::afterExec()\n", + "Calling the method App\\Tasks\SuccessTestTask::onSuccess()\n", + "Calling the method App\\Tasks\SuccessTestTask::afterExec()\n", "Check finished.\n", "Total number of tasks: 5\n", "Executed Tasks: 1\n", @@ -249,7 +249,7 @@ public function testForceTaskWithCustomArguments() { TasksManager::execLog(true); $this->getRunner(true); $output = $this->executeSingleCommand(new SchedulerCommand(), [ - 'webfiori', + 'WebFiori', 'scheduler', '--force', '--show-log', @@ -267,12 +267,12 @@ public function testForceTaskWithCustomArguments() { "Running task(s) check...\n", "Forcing task 'Success 1' to execute...\n", "Active task: \"Success 1\" ...\n", - "Calling the method app\\tasks\SuccessTestTask::execute()\n", + "Calling the method App\\Tasks\SuccessTestTask::execute()\n", "Start: 2021\n", "End: 2022\n", "The task was forced.\n", - "Calling the method app\\tasks\SuccessTestTask::onSuccess()\n", - "Calling the method app\\tasks\SuccessTestTask::afterExec()\n", + "Calling the method App\\Tasks\SuccessTestTask::onSuccess()\n", + "Calling the method App\\Tasks\SuccessTestTask::afterExec()\n", "Check finished.\n", "Total number of tasks: 5\n", "Executed Tasks: 1\n", @@ -293,7 +293,7 @@ public function testForceTaskWithIncorrectPassword() { TasksManager::registerTasks(); $output = $this->executeSingleCommand(new SchedulerCommand(), [ - 'webfiori', + 'WebFiori', 'scheduler', '--force', '--task-name' => 'Success 1', @@ -318,7 +318,7 @@ public function testForceTaskWithIncorrectPassword() { */ public function testShowTaskArguments() { $output = $this->executeSingleCommand(new SchedulerCommand(), [ - 'webfiori', + 'WebFiori', 'scheduler', '--task-name' => 'Success 1', '--show-task-args', @@ -338,7 +338,7 @@ public function testShowTaskArguments() { */ public function testShowTaskArgumentsWithSelection() { $output = $this->executeSingleCommand(new SchedulerCommand(), [ - 'webfiori', + 'WebFiori', 'scheduler', '--show-task-args', 'p' => '123456' @@ -364,7 +364,7 @@ public function testShowTaskArgumentsWithSelection() { */ public function testListAllScheduledTasks() { $output = $this->executeSingleCommand(new SchedulerCommand(), [ - 'webfiori', + 'WebFiori', 'scheduler', '--list' ], []); @@ -396,7 +396,7 @@ public function testListAllScheduledTasks() { public function testCheckWithValidPassword() { TasksManager::setPassword('123456'); $output = $this->executeSingleCommand(new SchedulerCommand(), [ - 'webfiori', + 'WebFiori', 'scheduler', '--check', 'p' => '123456' @@ -425,7 +425,7 @@ public function testForceTaskWithInteractiveArguments() { TasksManager::registerTasks(); $output = $this->executeSingleCommand(new SchedulerCommand(), [ - 'webfiori', + 'WebFiori', 'scheduler', '--force', '--task-name' => 'Success 1', @@ -454,9 +454,9 @@ public function testForceTaskWithInteractiveArguments() { 'Running task(s) check...', "Forcing task 'Success 1' to execute...", "Active task: \"Success 1\" ...", - "Calling the method app\\tasks\SuccessTestTask::execute()", - "Calling the method app\\tasks\SuccessTestTask::onSuccess()", - "Calling the method app\\tasks\SuccessTestTask::afterExec()", + "Calling the method App\\Tasks\SuccessTestTask::execute()", + "Calling the method App\\Tasks\SuccessTestTask::onSuccess()", + "Calling the method App\\Tasks\SuccessTestTask::afterExec()", "Check finished.", ], TasksManager::getLogArray()); } @@ -466,7 +466,7 @@ public function testForceTaskWithInteractiveArguments() { */ public function testCancelTaskSelection() { $output = $this->executeSingleCommand(new SchedulerCommand(), [ - 'webfiori', + 'WebFiori', 'scheduler', '--force', 'p' => '123456' @@ -491,7 +491,7 @@ public function testCancelTaskSelection() { */ public function testForceNonExistentTask() { $output = $this->executeSingleCommand(new SchedulerCommand(), [ - 'webfiori', + 'WebFiori', 'scheduler', '--force', '--task-name="Rand"', diff --git a/tests/webfiori/framework/test/cli/SettingsCommandTest.php b/tests/WebFiori/Framework/Tests/Cli/SettingsCommandTest.php similarity index 93% rename from tests/webfiori/framework/test/cli/SettingsCommandTest.php rename to tests/WebFiori/Framework/Tests/Cli/SettingsCommandTest.php index 3f8344780..1ffe500b8 100644 --- a/tests/webfiori/framework/test/cli/SettingsCommandTest.php +++ b/tests/WebFiori/Framework/Tests/Cli/SettingsCommandTest.php @@ -1,9 +1,9 @@ setInputs(); $runner->setArgsVector([ - 'webfiori', + 'WebFiori', 'show-settings' ]); $runner->start(); diff --git a/tests/webfiori/framework/test/cli/UpdateSettingsCommandTest.php b/tests/WebFiori/Framework/Tests/Cli/UpdateSettingsCommandTest.php similarity index 92% rename from tests/webfiori/framework/test/cli/UpdateSettingsCommandTest.php rename to tests/WebFiori/Framework/Tests/Cli/UpdateSettingsCommandTest.php index 83b866786..43538d969 100644 --- a/tests/webfiori/framework/test/cli/UpdateSettingsCommandTest.php +++ b/tests/WebFiori/Framework/Tests/Cli/UpdateSettingsCommandTest.php @@ -1,11 +1,11 @@ initialize(true); $runner = App::getRunner(); $runner->setArgsVector([ - 'webfiori', + 'WebFiori', 'update-settings', '--w' => 'q' ]); @@ -44,7 +44,7 @@ public function testUpdateAppName00() { 'Super App', ]); $runner->setArgsVector([ - 'webfiori', + 'WebFiori', 'update-settings', '--w' => 'app-name' ]); @@ -73,7 +73,7 @@ public function testUpdateAppName01() { ]); $runner->setArgsVector([ - 'webfiori', + 'WebFiori', 'update-settings', '--w' => 'app-name' ]); @@ -109,7 +109,7 @@ public function testUpdateAppName02() { ]); $runner->setArgsVector([ - 'webfiori', + 'WebFiori', 'update-settings', '--w' => 'app-name' ]); @@ -137,7 +137,7 @@ public function testUpdateHomePage00() { $runner->setInputs(); $runner->setArgsVector([ - 'webfiori', + 'WebFiori', 'update-settings', '--w' => 'home-page' ]); @@ -161,7 +161,7 @@ public function testUpdateHomePage01() { ]); $runner->setArgsVector([ - 'webfiori', + 'WebFiori', 'update-settings', '--w' => 'home-page' ]); @@ -185,7 +185,7 @@ public function testUpdatePageDescription00() { ]); $runner->setArgsVector([ - 'webfiori', + 'WebFiori', 'update-settings', '--w' => 'page-description' ]); @@ -211,7 +211,7 @@ public function testUpdatePageTitle00() { ]); $runner->setArgsVector([ - 'webfiori', + 'WebFiori', 'update-settings', '--w' => 'page-title' ]); @@ -229,7 +229,7 @@ public function testUpdatePageTitle00() { public function testUpdatePrimaryLang() { $runner = App::getRunner(); $runner->setArgsVector([ - 'webfiori', + 'WebFiori', 'update-settings', '--w' => 'primary-lang' ]); @@ -254,7 +254,7 @@ public function testUpdatePrimaryLang00() { 'NEW PAGE DESCRIPTION' ]); $runner->setArgsVector([ - 'webfiori', + 'WebFiori', 'update-settings', '--w' => 'page-description' ]); @@ -275,11 +275,11 @@ public function testUpdatePrimaryLang00() { public function testUpdatePrimaryTheme00() { $runner = App::getRunner(); $runner->setInputs([ - 'themes\\fioriTheme2\\NewTestTheme2' + 'Themes\\FioriTheme2\\NewTestTheme2' ]); $runner->setArgsVector([ - 'webfiori', + 'WebFiori', 'update-settings', '--w' => 'theme' ]); @@ -290,7 +290,7 @@ public function testUpdatePrimaryTheme00() { "Success: Theme successfully updated.\n" ], $runner->getOutput()); - $this->assertEquals('themes\\fioriTheme2\\NewTestTheme2', App::getConfig()->getTheme()); + $this->assertEquals('Themes\\FioriTheme2\\NewTestTheme2', App::getConfig()->getTheme()); } /** * @test @@ -300,10 +300,10 @@ public function testUpdatePrimaryTheme01() { $runner->setInputs([ 'themes\\greeny\\NotATheme', '', - 'themes\\fioriTheme2\\NewTestTheme2' + 'Themes\\FioriTheme2\\NewTestTheme2' ]); $runner->setArgsVector([ - 'webfiori', + 'WebFiori', 'update-settings', '--w' => 'theme' ]); @@ -318,7 +318,7 @@ public function testUpdatePrimaryTheme01() { "Success: Theme successfully updated.\n" ], $runner->getOutput()); - $this->assertEquals('themes\\fioriTheme2\\NewTestTheme2', App::getConfig()->getTheme()); + $this->assertEquals('Themes\\FioriTheme2\\NewTestTheme2', App::getConfig()->getTheme()); } /** * @test @@ -326,11 +326,11 @@ public function testUpdatePrimaryTheme01() { public function testUpdatePrimaryTheme02() { $runner = App::getRunner(); $runner->setInputs([ - 'webfiori\\framework\\Privilege', - 'themes\\fioriTheme2\\NewTestTheme2' + 'WebFiori\\Framework\\Privilege', + 'Themes\\FioriTheme2\\NewTestTheme2' ]); $runner->setArgsVector([ - 'webfiori', + 'WebFiori', 'update-settings', '--w' => 'theme' ]); @@ -343,7 +343,7 @@ public function testUpdatePrimaryTheme02() { "Success: Theme successfully updated.\n" ], $runner->getOutput()); - $this->assertEquals('themes\\fioriTheme2\\NewTestTheme2', App::getConfig()->getTheme()); + $this->assertEquals('Themes\\FioriTheme2\\NewTestTheme2', App::getConfig()->getTheme()); } /** * @test @@ -351,11 +351,11 @@ public function testUpdatePrimaryTheme02() { public function testUpdatePrimaryTheme03() { $runner = App::getRunner(); $runner->setInputs([ - 'webfiori\\framework\\App', - 'themes\\fioriTheme2\\NewTestTheme2' + 'WebFiori\\Framework\\App', + 'Themes\\FioriTheme2\\NewTestTheme2' ]); $runner->setArgsVector([ - 'webfiori', + 'WebFiori', 'update-settings', '--w' => 'theme' ]); @@ -368,7 +368,7 @@ public function testUpdatePrimaryTheme03() { "Success: Theme successfully updated.\n" ], $runner->getOutput()); - $this->assertEquals('themes\\fioriTheme2\\NewTestTheme2', App::getConfig()->getTheme()); + $this->assertEquals('Themes\\FioriTheme2\\NewTestTheme2', App::getConfig()->getTheme()); } /** * @test @@ -380,7 +380,7 @@ public function testUpdateSchedulerPass00() { ]); $runner->setArgsVector([ - 'webfiori', + 'WebFiori', 'update-settings', '--w' => 'scheduler-pass', ]); @@ -403,7 +403,7 @@ public function testUpdateSchedulerPass01() { ]); $runner->setArgsVector([ - 'webfiori', + 'WebFiori', 'update-settings', '--w' => 'scheduler-pass', ]); @@ -428,7 +428,7 @@ public function testUpdateTitleSep00() { ]); $runner->setArgsVector([ - 'webfiori', + 'WebFiori', 'update-settings', '--w' => 'xyz' ]); @@ -458,7 +458,7 @@ public function testUpdateTitleSep00() { public function testUpdateVersion00() { $runner = App::getRunner(); $runner->setArgsVector([ - 'webfiori', + 'WebFiori', 'update-settings', '--w' => 'version' ]); diff --git a/tests/webfiori/framework/test/cli/UpdateTableCommandTest.php b/tests/WebFiori/Framework/Tests/Cli/UpdateTableCommandTest.php similarity index 90% rename from tests/webfiori/framework/test/cli/UpdateTableCommandTest.php rename to tests/WebFiori/Framework/Tests/Cli/UpdateTableCommandTest.php index 722f5d1d8..cfa412ef4 100644 --- a/tests/webfiori/framework/test/cli/UpdateTableCommandTest.php +++ b/tests/WebFiori/Framework/Tests/Cli/UpdateTableCommandTest.php @@ -1,20 +1,20 @@ executeSingleCommand(new UpdateTableCommand(), [ - 'webfiori', + 'WebFiori', 'update-table', ], [ ' ', // Invalid class name 'ok\\y\\Super', // Invalid class name - 'app\\database\\TestTable', + 'App\\Database\\TestTable', '0', 'new-col', '1', @@ -26,7 +26,7 @@ public function test00() { 'Cool new column.', 'y', 'ModifiedO', - "\n" // Hit Enter to pick default value (app\database) + "\n" // Hit Enter to pick default value (App\database) ]); $this->assertEquals(0, $this->getExitCode()); @@ -70,11 +70,11 @@ public function test00() { "Enter your optional comment about the column:\n", "Would you like to update same class or create a copy with the update?(y/N)\n", "Enter a name for the new class:\n", - "Enter an optional namespace for the class: Enter = 'app\database'\n", + "Enter an optional namespace for the class: Enter = 'App\Database'\n", "Success: Column added.\n", ], $output); - $clazz = '\\app\\database\\ModifiedOTable'; + $clazz = '\\App\\Database\\ModifiedOTable'; $this->assertTrue(class_exists($clazz)); $file = new File(ROOT_PATH.$clazz.'.php'); $file->remove(); @@ -91,10 +91,10 @@ public function test00() { */ public function test01() { $output = $this->executeSingleCommand(new UpdateTableCommand(), [ - 'webfiori', + 'WebFiori', 'update-table', ], [ - 'app\\database\\TestTable', + 'App\\Database\\TestTable', '2', 'id', 'user-id', @@ -107,7 +107,7 @@ public function test01() { 'Cool modifiyed column.', 'y', 'Modified', - "\n" // Hit Enter to pick default value (app\database) + "\n" // Hit Enter to pick default value (App\database) ]); $this->assertEquals(0, $this->getExitCode()); @@ -149,11 +149,11 @@ public function test01() { "Enter your optional comment about the column:\n", "Would you like to update same class or create a copy with the update?(y/N)\n", "Enter a name for the new class:\n", - "Enter an optional namespace for the class: Enter = 'app\database'\n", + "Enter an optional namespace for the class: Enter = 'App\Database'\n", "Success: Column updated.\n", ], $output); - $clazz = '\\app\\database\\ModifiedTable'; + $clazz = '\\App\\Database\\ModifiedTable'; $this->assertTrue(class_exists($clazz)); $file = new File(ROOT_PATH.$clazz.'.php'); $file->remove(); @@ -167,15 +167,15 @@ public function test01() { public function test02() { $output = $this->executeSingleCommand(new UpdateTableCommand(), [ - 'webfiori', + 'WebFiori', 'update-table', ], [ - 'app\\database\\Test2Table', + 'App\\Database\\Test2Table', '4', '0', 'y', 'Modified2', - "\n" // Hit Enter to pick default value (app\database) + "\n" // Hit Enter to pick default value (App\database) ]); $this->assertEquals(0, $this->getExitCode()); @@ -191,11 +191,11 @@ public function test02() { "0: user_id_fk\n", "Would you like to update same class or create a copy with the update?(y/N)\n", "Enter a name for the new class:\n", - "Enter an optional namespace for the class: Enter = 'app\database'\n", + "Enter an optional namespace for the class: Enter = 'App\Database'\n", "Success: Table updated.\n", ], $output); - $clazz = '\\app\\database\\Modified2Table'; + $clazz = '\\App\\Database\\Modified2Table'; $this->assertTrue(class_exists($clazz)); $file = new File(ROOT_PATH.$clazz.'.php'); $file->remove(); diff --git a/tests/webfiori/framework/test/cli/VersionCommandTest.php b/tests/WebFiori/Framework/Tests/Cli/VersionCommandTest.php similarity index 88% rename from tests/webfiori/framework/test/cli/VersionCommandTest.php rename to tests/WebFiori/Framework/Tests/Cli/VersionCommandTest.php index 4bdb4baa5..d40a98a80 100644 --- a/tests/webfiori/framework/test/cli/VersionCommandTest.php +++ b/tests/WebFiori/Framework/Tests/Cli/VersionCommandTest.php @@ -1,8 +1,8 @@ assertEquals(0, count($db->getTables())); - $db->register('database'); + $db->register('Database'); $this->assertEquals(2, count($db->getTables())); } /** @@ -64,7 +64,7 @@ public function test04() { App::getConfig()->addOrUpdateDBConnection($conn); $db = new DB('default-conn'); $this->assertEquals(0, count($db->getTables())); - $db->register('database'); + $db->register('Database'); $this->assertEquals(2, count($db->getTables())); App::getConfig()->removeAllDBConnections(); } diff --git a/tests/webfiori/framework/test/langs/LanguageTest.php b/tests/WebFiori/Framework/Tests/Langs/LanguageTest.php similarity index 97% rename from tests/webfiori/framework/test/langs/LanguageTest.php rename to tests/WebFiori/Framework/Tests/Langs/LanguageTest.php index ad47bc6c4..c51562374 100644 --- a/tests/webfiori/framework/test/langs/LanguageTest.php +++ b/tests/WebFiori/Framework/Tests/Langs/LanguageTest.php @@ -1,11 +1,11 @@ expectException(Exception::class); - $this->expectExceptionMessage('A language class for the language \'FR\' was found. But it is not a sub class of \'webfiori\framework\Lang\'.'); + $this->expectExceptionMessage('A language class for the language \'FR\' was found. But it is not a sub class of \'WebFiori\Framework\Lang\'.'); Lang::loadTranslation('fr'); } /** @@ -221,7 +221,7 @@ public function testLoadTranslation02() { */ public function testLoadTranslation03() { $this->expectException(Exception::class); - $this->expectExceptionMessage('The translation file was found. But no object of type \'webfiori\framework\Lang\' is stored. Make sure that the parameter ' + $this->expectExceptionMessage('The translation file was found. But no object of type \'WebFiori\Framework\Lang\' is stored. Make sure that the parameter ' .'$addtoLoadedAfterCreate is set to true when creating the language object.'); Lang::loadTranslation('Jp'); } diff --git a/tests/webfiori/framework/test/mail/EmailMessageTest.php b/tests/WebFiori/Framework/Tests/Mail/EmailMessageTest.php similarity index 96% rename from tests/webfiori/framework/test/mail/EmailMessageTest.php rename to tests/WebFiori/Framework/Tests/Mail/EmailMessageTest.php index ec3f159e4..4049abfc0 100644 --- a/tests/webfiori/framework/test/mail/EmailMessageTest.php +++ b/tests/WebFiori/Framework/Tests/Mail/EmailMessageTest.php @@ -1,14 +1,14 @@ setTheme(' New Super Theme '); $theme3 = $page->getTheme(); - $this->assertTrue($theme3 instanceof \webfiori\framework\Theme); + $this->assertTrue($theme3 instanceof \WebFiori\Framework\Theme); } /** * @test diff --git a/tests/webfiori/framework/test/PrivilegeTest.php b/tests/WebFiori/Framework/Tests/PrivilegeTest.php similarity index 91% rename from tests/webfiori/framework/test/PrivilegeTest.php rename to tests/WebFiori/Framework/Tests/PrivilegeTest.php index b5e976293..b60755797 100644 --- a/tests/webfiori/framework/test/PrivilegeTest.php +++ b/tests/WebFiori/Framework/Tests/PrivilegeTest.php @@ -1,10 +1,10 @@ 'home', - RouteOption::TO => \app\apis\RoutingTestClass::class + RouteOption::TO => \App\Apis\RoutingTestClass::class ]); Router::route('https://127.0.0.1/home'); @@ -514,7 +514,7 @@ public function testClassRoute02() { Router::removeAll(); Router::addRoute([ RouteOption::PATH => 'home', - RouteOption::TO => \app\apis\RoutingTestClass::class, + RouteOption::TO => \App\Apis\RoutingTestClass::class, RouteOption::ACTION => 'doSomething' ]); Router::route('https://127.0.0.1/home'); diff --git a/tests/webfiori/framework/test/router/RouterUriTest.php b/tests/WebFiori/Framework/Tests/Router/RouterUriTest.php similarity index 98% rename from tests/webfiori/framework/test/router/RouterUriTest.php rename to tests/WebFiori/Framework/Tests/Router/RouterUriTest.php index acac72694..40aff9616 100644 --- a/tests/webfiori/framework/test/router/RouterUriTest.php +++ b/tests/WebFiori/Framework/Tests/Router/RouterUriTest.php @@ -1,11 +1,11 @@ expectException(InvalidArgumentException::class); - $this->expectExceptionMessage("Invalid argument type. Expected 'string' or 'webfiori\\framework\\scheduler\\TaskArgument'"); + $this->expectExceptionMessage("Invalid argument type. Expected 'string' or 'WebFiori\\Framework\\Scheduler\\TaskArgument'"); $job = new BaseTask(); $job->addExecutionArg(new Privilege()); } diff --git a/tests/webfiori/framework/test/scheduler/SchedulerTest.php b/tests/WebFiori/Framework/Tests/Scheduler/SchedulerTest.php similarity index 94% rename from tests/webfiori/framework/test/scheduler/SchedulerTest.php rename to tests/WebFiori/Framework/Tests/Scheduler/SchedulerTest.php index 396f0bf3d..e3a136314 100644 --- a/tests/webfiori/framework/test/scheduler/SchedulerTest.php +++ b/tests/WebFiori/Framework/Tests/Scheduler/SchedulerTest.php @@ -1,12 +1,12 @@ close(); - $filePath = ROOT_PATH.DS.'app'.DS.'sto'.DS.'sessions'.DS.$session->getId(); + $filePath = ROOT_PATH.DS.'App'.DS.'sto'.DS.'sessions'.DS.$session->getId(); $this->assertTrue(File::isFileExist($filePath)); $this->assertFalse($session->isRunning()); $this->assertEquals(0,$session->getStartedAt()); diff --git a/tests/webfiori/framework/test/session/SessionsManagerTest.php b/tests/WebFiori/Framework/Tests/Session/SessionsManagerTest.php similarity index 98% rename from tests/webfiori/framework/test/session/SessionsManagerTest.php rename to tests/WebFiori/Framework/Tests/Session/SessionsManagerTest.php index f2ba0804f..e2fb4b3ee 100644 --- a/tests/webfiori/framework/test/session/SessionsManagerTest.php +++ b/tests/WebFiori/Framework/Tests/Session/SessionsManagerTest.php @@ -1,14 +1,14 @@ removeDirectory($themePath); + } + } + } + parent::tearDown(); + } + + private function removeDirectory($dir) { + if (!is_dir($dir)) { + return; + } + $files = array_diff(scandir($dir), ['.', '..']); + foreach ($files as $file) { + $path = $dir . DS . $file; + is_dir($path) ? $this->removeDirectory($path) : unlink($path); + } + rmdir($dir); + } public function testAvailableThemes00() { $themes = ThemeManager::getRegisteredThemes(); $this->assertEquals(2, count($themes)); } @@ -60,7 +86,7 @@ public function testToJson00() { public function testUseTheme00() { $themeName = 'New Theme 2'; ThemeManager::resetRegistered(); - ThemeManager::register(new \themes\fioriTheme2\NewTestTheme2()); + ThemeManager::register(new \Themes\FioriTheme2\NewTestTheme2()); //$this->assertFalse(Theme::isThemeLoaded($themeName)); $theme = ThemeManager::usingTheme($themeName); $this->assertTrue($theme instanceof Theme); @@ -71,9 +97,9 @@ public function testUseTheme00() { $this->assertEquals('https://opensource.org/licenses/MIT',$theme->getLicenseUrl()); $this->assertEquals('MIT',$theme->getLicenseName()); $this->assertEquals(1,count(ThemeManager::getRegisteredThemes())); - $this->assertEquals('fioriTheme2', $theme->getDirectoryName()); + $this->assertEquals('FioriTheme2', $theme->getDirectoryName()); $this->assertEquals('https://my-theme-side.com', $theme->getUrl()); - $this->assertEquals(ROOT_PATH.DS.'themes'.DS.'fioriTheme2'.DS, $theme->getAbsolutePath()); + $this->assertEquals(ROOT_PATH.DS.'Themes'.DS.'FioriTheme2'.DS, $theme->getAbsolutePath()); $this->assertEquals('css', $theme->getCssDirName()); $this->assertEquals('js', $theme->getJsDirName()); $this->assertEquals('images', $theme->getImagesDirName()); diff --git a/tests/webfiori/framework/test/UserTest.php b/tests/WebFiori/Framework/Tests/UserTest.php similarity index 97% rename from tests/webfiori/framework/test/UserTest.php rename to tests/WebFiori/Framework/Tests/UserTest.php index c563b4d1a..4577872b2 100644 --- a/tests/webfiori/framework/test/UserTest.php +++ b/tests/WebFiori/Framework/Tests/UserTest.php @@ -1,11 +1,11 @@ assertEquals('NewTask', $writter->getName()); - $this->assertEquals('app\\tasks', $writter->getNamespace()); + $this->assertEquals('App\\Tasks', $writter->getNamespace()); $this->assertEquals('Task', $writter->getSuffix()); $this->assertEquals([ - "webfiori\\framework\\scheduler\\AbstractTask", - "webfiori\\framework\\scheduler\\TaskStatusEmail", - "webfiori\\framework\\scheduler\\TasksManager", + "WebFiori\\Framework\\Scheduler\\AbstractTask", + "WebFiori\\Framework\\Scheduler\\TaskStatusEmail", + "WebFiori\\Framework\\Scheduler\\TasksManager", ], $writter->getUseStatements()); $this->assertEquals('No Description', $writter->getTaskDescription()); $this->assertEquals(0, count($writter->getTask()->getArguments())); @@ -33,12 +33,12 @@ public function test01() { $writter = new SchedulerTaskClassWriter(); $writter->setClassName('NewOk'); $this->assertEquals('NewOkTask', $writter->getName()); - $this->assertEquals('app\\tasks', $writter->getNamespace()); + $this->assertEquals('App\\Tasks', $writter->getNamespace()); $this->assertEquals('Task', $writter->getSuffix()); $this->assertEquals([ - "webfiori\\framework\\scheduler\\AbstractTask", - "webfiori\\framework\\scheduler\\TaskStatusEmail", - "webfiori\\framework\\scheduler\\TasksManager", + "WebFiori\\Framework\\Scheduler\\AbstractTask", + "WebFiori\\Framework\\Scheduler\\TaskStatusEmail", + "WebFiori\\Framework\\Scheduler\\TasksManager", ], $writter->getUseStatements()); $this->assertEquals('No Description', $writter->getTaskDescription()); $this->assertEquals(0, count($writter->getTask()->getArguments())); @@ -63,12 +63,12 @@ public function test02() { $this->assertEquals('NewOk2BTask', $writter->getName()); - $this->assertEquals('app\\tasks', $writter->getNamespace()); + $this->assertEquals('App\\Tasks', $writter->getNamespace()); $this->assertEquals('Task', $writter->getSuffix()); $this->assertEquals([ - "webfiori\\framework\\scheduler\\AbstractTask", - "webfiori\\framework\\scheduler\\TaskStatusEmail", - "webfiori\\framework\\scheduler\\TasksManager", + "WebFiori\\Framework\\Scheduler\\AbstractTask", + "WebFiori\\Framework\\Scheduler\\TaskStatusEmail", + "WebFiori\\Framework\\Scheduler\\TasksManager", ], $writter->getUseStatements()); $this->assertEquals('A test Task', $writter->getTaskDescription()); $this->assertEquals(1, count($writter->getTask()->getArguments())); diff --git a/tests/webfiori/framework/test/writers/CLICommandClassWriterTest.php b/tests/WebFiori/Framework/Tests/Writers/CLICommandClassWriterTest.php similarity index 90% rename from tests/webfiori/framework/test/writers/CLICommandClassWriterTest.php rename to tests/WebFiori/Framework/Tests/Writers/CLICommandClassWriterTest.php index 8d88d7d86..9c02dc46a 100644 --- a/tests/webfiori/framework/test/writers/CLICommandClassWriterTest.php +++ b/tests/WebFiori/Framework/Tests/Writers/CLICommandClassWriterTest.php @@ -1,9 +1,9 @@ assertEquals('NewCommand', $writer->getName()); - $this->assertEquals(ROOT_PATH.DS.APP_DIR.DS.'commands'.DS.'NewCommand.php', $writer->getAbsolutePath()); - $this->assertEquals('app\\commands', $writer->getNamespace()); + $this->assertEquals(ROOT_PATH.DS.APP_DIR.DS.'Commands'.DS.'NewCommand.php', $writer->getAbsolutePath()); + $this->assertEquals('App\\Commands', $writer->getNamespace()); $this->assertEquals('new-command', $writer->getCommandName()); $this->assertEquals('', $writer->getDescription()); $this->assertEquals([], $writer->getArgs()); @@ -37,8 +37,8 @@ public function test01() { $this->assertFalse($writer->setClassName(' ')); $this->assertTrue($writer->setClassName('DoItXCommand')); $this->assertEquals('DoItXCommand', $writer->getName()); - $this->assertEquals(ROOT_PATH.DS.APP_DIR.DS.'commands'.DS.'DoItXCommand.php', $writer->getAbsolutePath()); - $this->assertEquals('app\\commands', $writer->getNamespace()); + $this->assertEquals(ROOT_PATH.DS.APP_DIR.DS.'Commands'.DS.'DoItXCommand.php', $writer->getAbsolutePath()); + $this->assertEquals('App\\Commands', $writer->getNamespace()); $this->assertEquals('Lets-Do-It', $writer->getCommandName()); $this->assertEquals('', $writer->getDescription()); $this->assertEquals([], $writer->getArgs()); @@ -80,8 +80,8 @@ public function test02() { $this->assertFalse($writer->setClassName(' ')); $this->assertTrue($writer->setClassName('DoItX2Command')); $this->assertEquals('DoItX2Command', $writer->getName()); - $this->assertEquals(ROOT_PATH.DS.APP_DIR.DS.'commands'.DS.'DoItX2Command.php', $writer->getAbsolutePath()); - $this->assertEquals('app\\commands', $writer->getNamespace()); + $this->assertEquals(ROOT_PATH.DS.APP_DIR.DS.'Commands'.DS.'DoItX2Command.php', $writer->getAbsolutePath()); + $this->assertEquals('App\\Commands', $writer->getNamespace()); $this->assertEquals('Lets-Do-It', $writer->getCommandName()); $this->assertEquals('', $writer->getDescription()); $this->assertEquals([], $writer->getArgs()); diff --git a/tests/webfiori/framework/test/writers/DatabaseMigrationWriterTest.php b/tests/WebFiori/Framework/Tests/Writers/DatabaseMigrationWriterTest.php similarity index 63% rename from tests/webfiori/framework/test/writers/DatabaseMigrationWriterTest.php rename to tests/WebFiori/Framework/Tests/Writers/DatabaseMigrationWriterTest.php index e3568798b..e02dab022 100644 --- a/tests/webfiori/framework/test/writers/DatabaseMigrationWriterTest.php +++ b/tests/WebFiori/Framework/Tests/Writers/DatabaseMigrationWriterTest.php @@ -1,20 +1,29 @@ removeClass($clazz); $runner = new SchemaRunner(null); $writter = new DatabaseMigrationWriter($runner); $this->assertEquals('Migration000', $writter->getName()); - $this->assertEquals('app\\database\\migrations', $writter->getNamespace()); + $this->assertEquals('App\\Database\\Migrations', $writter->getNamespace()); $this->assertEquals('', $writter->getSuffix()); $this->assertEquals([ "WebFiori\Database\Database", @@ -46,6 +55,10 @@ public function test00() { ], $writter->getUseStatements()); $writter->writeClass(); + // Check if file was written and require it + $filePath = $writter->getPath() . DS . $writter->getName() . '.php'; + $this->assertTrue(file_exists($filePath), "Class file was not created: $filePath"); + require_once $filePath; $this->assertTrue(class_exists($clazz)); $runner->register($clazz); $allClasses[] = $clazz; @@ -53,7 +66,7 @@ public function test00() { $this->assertEquals(1, count($migrations)); $m00 = $migrations[0]; $this->assertTrue($m00 instanceof AbstractMigration); - $this->assertEquals('app\\database\\migrations\\Migration000', $m00->getName()); + $this->assertEquals('App\\Database\\Migrations\\Migration000', $m00->getName()); $this->removeClass($clazz); $runner = new SchemaRunner(null); } @@ -63,15 +76,20 @@ public function test00() { public function test01() { DatabaseMigrationWriter::resetCounter(); $runner = new SchemaRunner(null); - $path = APP_PATH.DS.'database'.DS.'migrations'; - $ns = '\\app\\database\\migrations'; + $path = APP_PATH.DS.'Database'.DS.'Migrations'; + $ns = '\\App\\Database\\Migrations'; $writter = new DatabaseMigrationWriter($runner); $writter->setClassName('MyMigration'); $this->assertEquals('MyMigration', $writter->getName()); - $this->assertEquals('app\\database\\migrations', $writter->getNamespace()); + $this->assertEquals('App\\Database\\Migrations', $writter->getNamespace()); $writter->writeClass(); - $clazz = "\\app\\database\\migrations\\MyMigration"; + $clazz = "\\App\\Database\\Migrations\\MyMigration"; + + // Check if file was written and require it + $filePath = $writter->getPath() . DS . $writter->getName() . '.php'; + $this->assertTrue(file_exists($filePath), "Class file was not created: $filePath"); + require_once $filePath; $this->assertTrue(class_exists($clazz)); $runner->register($clazz); $allClasses[] = $clazz; @@ -79,7 +97,7 @@ public function test01() { $this->assertEquals(1, count($migrations)); $m00 = $migrations[0]; $this->assertTrue($m00 instanceof AbstractMigration); - $this->assertEquals('app\\database\\migrations\\MyMigration', $m00->getName()); + $this->assertEquals('App\\Database\\Migrations\\MyMigration', $m00->getName()); $this->removeClass($clazz); $runner = new SchemaRunner(null); } @@ -89,12 +107,17 @@ public function test01() { public function test02() { DatabaseMigrationWriter::resetCounter(); $runner = new SchemaRunner(null); - $path = APP_PATH.DS.'database'.DS.'migrations'; - $ns = '\\app\\database\\migrations'; + $path = APP_PATH.DS.'Database'.DS.'Migrations'; + $ns = '\\App\\Database\\Migrations'; $writter = new DatabaseMigrationWriter($runner); $this->assertEquals('Migration000', $writter->getName()); $writter->writeClass(); - $clazz = "\\app\\database\\migrations\\Migration000"; + $clazz = "\\App\\Database\\Migrations\\Migration000"; + + // Check if file was written and require it + $filePath = $writter->getPath() . DS . $writter->getName() . '.php'; + $this->assertTrue(file_exists($filePath), "Class file was not created: $filePath"); + require_once $filePath; $this->assertTrue(class_exists($clazz)); $runner->register($clazz); $allClasses[] = $clazz; @@ -104,13 +127,18 @@ public function test02() { $this->assertEquals(1, count($migrations)); $m00 = $migrations[0]; $this->assertTrue($m00 instanceof AbstractMigration); - $this->assertEquals('app\\database\\migrations\\Migration000', $m00->getName()); + $this->assertEquals('App\\Database\\Migrations\\Migration000', $m00->getName()); $writter2 = new DatabaseMigrationWriter($runner2); $this->assertEquals('Migration001', $writter2->getName()); $writter2->writeClass(); - $clazz2 = "\\app\\database\\migrations\\Migration001"; - $this->assertTrue(class_exists($clazz)); + $clazz2 = "\\App\\Database\\Migrations\\Migration001"; + + // Check if file was written and require it + $filePath2 = $writter2->getPath() . DS . $writter2->getName() . '.php'; + $this->assertTrue(file_exists($filePath2), "Class file was not created: $filePath2"); + require_once $filePath2; + $this->assertTrue(class_exists($clazz2)); $runner->register($clazz); $allClasses[] = $clazz; $runner3 = new SchemaRunner(null); @@ -120,7 +148,7 @@ public function test02() { $this->assertEquals(2, count($migrations2)); $m01 = $migrations2[1]; $this->assertTrue($m00 instanceof AbstractMigration); - $this->assertEquals('app\\database\\migrations\\Migration001', $m01->getName()); + $this->assertEquals('App\\Database\\Migrations\\Migration001', $m01->getName()); $this->removeClass($clazz); $runner = new SchemaRunner(null); $this->removeClass($clazz2); @@ -131,8 +159,8 @@ public function test02() { public function test03() { DatabaseMigrationWriter::resetCounter(); $runner = new SchemaRunner(null); - $path = APP_PATH.DS.'database'.DS.'migrations'; - $ns = '\\app\\database\\migrations'; + $path = APP_PATH.DS.'Database'.DS.'Migrations'; + $ns = '\\App\\Database\\Migrations'; $allClasses = []; for ($x = 0 ; $x < 110 ; $x++) { $writter = new DatabaseMigrationWriter($runner); @@ -145,7 +173,12 @@ public function test03() { } $this->assertEquals($name, $writter->getName()); $writter->writeClass(); - $clazz = "\\app\\database\\migrations\\".$name; + $clazz = "\\App\\Database\\Migrations\\".$name; + + // Check if file was written and require it + $filePath = $writter->getPath() . DS . $writter->getName() . '.php'; + $this->assertTrue(file_exists($filePath), "Class file was not created: $filePath"); + require_once $filePath; $this->assertTrue(class_exists($clazz)); $runner->register($clazz); $allClasses[] = $clazz; @@ -158,10 +191,10 @@ public function test03() { $this->assertEquals($x + 1, count($migrations)); $m = $migrations[$x]; $this->assertTrue($m instanceof AbstractMigration); - $this->assertEquals("app\\database\\migrations\\" . $name, $m->getName()); + $this->assertEquals("App\\Database\\Migrations\\" . $name, $m->getName()); } foreach ($migrations as $m) { - $this->removeClass("\\app\\database\\migrations\\".$m->getName()); + $this->removeClass("\\App\\Database\\Migrations\\".$m->getName()); } } private function removeClass($classPath) { diff --git a/tests/webfiori/framework/test/writers/LangWritterTest.php b/tests/WebFiori/Framework/Tests/Writers/LangWritterTest.php similarity index 71% rename from tests/webfiori/framework/test/writers/LangWritterTest.php rename to tests/WebFiori/Framework/Tests/Writers/LangWritterTest.php index 99cf77370..e4257d4f2 100644 --- a/tests/webfiori/framework/test/writers/LangWritterTest.php +++ b/tests/WebFiori/Framework/Tests/Writers/LangWritterTest.php @@ -1,9 +1,9 @@ assertEquals('LangEN', $writter->getName()); - $this->assertEquals('app\\langs', $writter->getNamespace()); + $this->assertEquals('App\\Langs', $writter->getNamespace()); $this->assertEquals('', $writter->getSuffix()); $this->assertEquals([ Lang::class diff --git a/tests/webfiori/framework/test/writers/MiddlewareWritterTest.php b/tests/WebFiori/Framework/Tests/Writers/MiddlewareWritterTest.php similarity index 78% rename from tests/webfiori/framework/test/writers/MiddlewareWritterTest.php rename to tests/WebFiori/Framework/Tests/Writers/MiddlewareWritterTest.php index 26b9fd894..9d91cbabc 100644 --- a/tests/webfiori/framework/test/writers/MiddlewareWritterTest.php +++ b/tests/WebFiori/Framework/Tests/Writers/MiddlewareWritterTest.php @@ -1,9 +1,9 @@ assertEquals('NewMiddleware', $writter->getName()); - $this->assertEquals('app\\middleware', $writter->getNamespace()); + $this->assertEquals('App\\Middleware', $writter->getNamespace()); $this->assertEquals('Middleware', $writter->getSuffix()); $this->assertEquals([ - "webfiori\\framework\\middleware\\AbstractMiddleware", - "webfiori\\framework\\session\\SessionsManager", + "WebFiori\\Framework\\Middleware\\AbstractMiddleware", + "WebFiori\\Framework\\Session\\SessionsManager", "WebFiori\\Http\\Request", "WebFiori\\Http\\Response", ], $writter->getUseStatements()); @@ -39,11 +39,11 @@ public function test01() { $writter->addGroup('two-group'); $writter->addGroup('global'); $this->assertEquals('XMdMiddleware', $writter->getName()); - $this->assertEquals('app\\middleware', $writter->getNamespace()); + $this->assertEquals('App\\Middleware', $writter->getNamespace()); $this->assertEquals('Middleware', $writter->getSuffix()); $this->assertEquals([ - "webfiori\\framework\\middleware\\AbstractMiddleware", - "webfiori\\framework\\session\\SessionsManager", + "WebFiori\\Framework\\Middleware\\AbstractMiddleware", + "WebFiori\\Framework\\Session\\SessionsManager", "WebFiori\\Http\\Request", "WebFiori\\Http\\Response", ], $writter->getUseStatements()); diff --git a/tests/webfiori/framework/test/writers/TableWritterTest.php b/tests/WebFiori/Framework/Tests/Writers/TableWritterTest.php similarity index 92% rename from tests/webfiori/framework/test/writers/TableWritterTest.php rename to tests/WebFiori/Framework/Tests/Writers/TableWritterTest.php index 966e6aa3f..1f4d76278 100644 --- a/tests/webfiori/framework/test/writers/TableWritterTest.php +++ b/tests/WebFiori/Framework/Tests/Writers/TableWritterTest.php @@ -1,11 +1,11 @@ assertEquals('NewTable', $writter->getName()); - $this->assertEquals('app\\database', $writter->getNamespace()); + $this->assertEquals('App\\Database', $writter->getNamespace()); $this->assertEquals('Table', $writter->getSuffix()); $this->assertEquals([ @@ -34,16 +34,16 @@ public function test00() { public function test01() { $writter = new TableClassWriter(); $writter->setClassName('CoolT'); - $writter->setEntityInfo('MyEntity', 'app\\entity', ROOT_PATH.DS.APP_DIR.DS.'entity', true); + $writter->setEntityInfo('MyEntity', 'App\\Entity', ROOT_PATH.DS.APP_DIR.DS.'Entity', true); $this->assertEquals('CoolTTable', $writter->getName()); - $this->assertEquals('app\\database', $writter->getNamespace()); + $this->assertEquals('App\\Database', $writter->getNamespace()); $this->assertEquals('Table', $writter->getSuffix()); $this->assertEquals([ ], $writter->getUseStatements()); $this->assertEquals('MyEntity', $writter->getEntityName()); - $this->assertEquals('app\\entity', $writter->getEntityNamespace()); - $this->assertEquals(ROOT_PATH.DS.APP_DIR.DS.'entity', $writter->getEntityPath()); + $this->assertEquals('App\\Entity', $writter->getEntityNamespace()); + $this->assertEquals(ROOT_PATH.DS.APP_DIR.DS.'Entity', $writter->getEntityPath()); $this->assertTrue($writter->getTable() instanceof MySQLTable); $this->assertFalse($writter->getTable() instanceof MSSQLTable); $writter->writeClass(); @@ -54,7 +54,7 @@ public function test01() { $this->assertTrue($clazzObj instanceof MySQLTable); $this->assertEquals('`new_table`', $clazzObj->getName()); $this->assertEquals(0, $clazzObj->getColsCount()); - $this->removeClass('app\\entity\\MyEntity'); + $this->removeClass('App\\Entity\\MyEntity'); } /** * @test @@ -63,7 +63,7 @@ public function test02() { $writter = new TableClassWriter(); $writter->setClassName('CoolT2Table'); $writter->setTableType('mssql'); - $writter->setEntityInfo('MyEntity', 'app\\entity', ROOT_PATH.DS.APP_DIR.DS.'entity', true); + $writter->setEntityInfo('MyEntity', 'App\\Entity', ROOT_PATH.DS.APP_DIR.DS.'Entity', true); $this->assertEquals('CoolT2Table', $writter->getName()); $this->assertFalse($writter->getTable() instanceof MySQLTable); @@ -76,7 +76,7 @@ public function test02() { $this->assertTrue($clazzObj instanceof MSSQLTable); $this->assertEquals('[new_table]', $clazzObj->getName()); $this->assertEquals(0, $clazzObj->getColsCount()); - $this->removeClass('app\\entity\\MyEntity'); + $this->removeClass('App\\Entity\\MyEntity'); } /** * @test diff --git a/tests/webfiori/framework/test/writers/ThemeWritterTest.php b/tests/WebFiori/Framework/Tests/Writers/ThemeWritterTest.php similarity index 78% rename from tests/webfiori/framework/test/writers/ThemeWritterTest.php rename to tests/WebFiori/Framework/Tests/Writers/ThemeWritterTest.php index a34a81687..596c220a6 100644 --- a/tests/webfiori/framework/test/writers/ThemeWritterTest.php +++ b/tests/WebFiori/Framework/Tests/Writers/ThemeWritterTest.php @@ -1,9 +1,9 @@ assertEquals('NewTheme', $writter->getName()); - $this->assertEquals('app\\themes\\new', $writter->getNamespace()); + $this->assertEquals('App\\Themes\\new', $writter->getNamespace()); $this->assertEquals('Theme', $writter->getSuffix()); $this->assertEquals([ ], $writter->getUseStatements()); @@ -29,9 +29,9 @@ public function test01() { $writter->setClassName('SuperHotNew'); $writter->setThemeName('Cool Theme'); $this->assertEquals('SuperHotNewTheme', $writter->getName()); - $writter->setNamespace('app\\themes\\cool'); - $writter->setPath(ROOT_PATH.DS.APP_DIR.DS.'themes'.DS.'cool'); - $this->assertEquals('app\\themes\\cool', $writter->getNamespace()); + $writter->setNamespace('App\\Themes\\cool'); + $writter->setPath(ROOT_PATH.DS.APP_DIR.DS.'Themes'.DS.'cool'); + $this->assertEquals('App\\Themes\\cool', $writter->getNamespace()); $this->assertEquals('Theme', $writter->getSuffix()); $this->assertEquals([ ], $writter->getUseStatements()); diff --git a/tests/webfiori/framework/test/writers/WebServiceTestCaseWriterTest.php b/tests/WebFiori/Framework/Tests/Writers/WebServiceTestCaseWriterTest.php similarity index 75% rename from tests/webfiori/framework/test/writers/WebServiceTestCaseWriterTest.php rename to tests/WebFiori/Framework/Tests/Writers/WebServiceTestCaseWriterTest.php index 8351f70d1..c7c75435a 100644 --- a/tests/webfiori/framework/test/writers/WebServiceTestCaseWriterTest.php +++ b/tests/WebFiori/Framework/Tests/Writers/WebServiceTestCaseWriterTest.php @@ -1,10 +1,10 @@ assertEquals('tests\\apis\\WebServiceTest', $w->getName(true)); + $this->assertEquals('tests\\Apis\\WebServiceTest', $w->getName(true)); $this->assertEquals(9, $w->getPhpUnitVersion()); - $this->assertEquals(ROOT_PATH.DS.'tests'.DS.'apis'.DS.'WebServiceTest.php', $w->getAbsolutePath()); + $this->assertEquals(ROOT_PATH.DS.'tests'.DS.'Apis'.DS.'WebServiceTest.php', $w->getAbsolutePath()); $w->writeClass(); $this->assertTrue(class_exists('\\'.$w->getName(true))); unlink($w->getAbsolutePath()); diff --git a/tests/webfiori/framework/test/writers/WebServiceWritterTest.php b/tests/WebFiori/Framework/Tests/Writers/WebServiceWritterTest.php similarity index 94% rename from tests/webfiori/framework/test/writers/WebServiceWritterTest.php rename to tests/WebFiori/Framework/Tests/Writers/WebServiceWritterTest.php index 10a5362fe..139c7ef0d 100644 --- a/tests/webfiori/framework/test/writers/WebServiceWritterTest.php +++ b/tests/WebFiori/Framework/Tests/Writers/WebServiceWritterTest.php @@ -1,8 +1,8 @@ assertEquals('NewWebService', $writter->getName()); - $this->assertEquals('app\\apis', $writter->getNamespace()); + $this->assertEquals('App\\Apis', $writter->getNamespace()); $this->assertEquals('Service', $writter->getSuffix()); $this->assertEquals([ "WebFiori\Http\AbstractWebService", @@ -30,7 +30,7 @@ public function test01() { $writter = new WebServiceWriter(); $writter->setClassName('SuperService'); $this->assertEquals('SuperService', $writter->getName()); - $this->assertEquals('app\\apis', $writter->getNamespace()); + $this->assertEquals('App\\Apis', $writter->getNamespace()); $this->assertEquals('Service', $writter->getSuffix()); $this->assertEquals([ "WebFiori\Http\AbstractWebService", @@ -58,7 +58,7 @@ public function test02() { $writter = new WebServiceWriter(); $writter->setClassName('Super2Service'); $this->assertEquals('Super2Service', $writter->getName()); - $this->assertEquals('app\\apis', $writter->getNamespace()); + $this->assertEquals('App\\Apis', $writter->getNamespace()); $this->assertEquals('Service', $writter->getSuffix()); $this->assertEquals([ "WebFiori\Http\AbstractWebService", diff --git a/tests/bootstrap.php b/tests/bootstrap.php index aa22286c9..16ef1fe6e 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -9,12 +9,12 @@ use WebFiori\Database\ConnectionInfo; use WebFiori\Database\Schema\SchemaRunner; -use webfiori\framework\App; -use webfiori\framework\autoload\ClassLoader; -use webfiori\framework\config\JsonDriver; -use webfiori\framework\ThemeManager; -use themes\fioriTheme\NewFTestTheme; -use themes\fioriTheme2\NewTestTheme2; +use WebFiori\Framework\App; +use WebFiori\Framework\Autoload\ClassLoader; +use WebFiori\Framework\Config\JsonDriver; +use WebFiori\Framework\ThemeManager; +use Themes\FioriTheme\NewFTestTheme; +use Themes\FioriTheme2\NewTestTheme2; $DS = DIRECTORY_SEPARATOR; @@ -30,8 +30,8 @@ //WebFiori Framework might exist. //Add and remove directories as needed. $WebFioriFrameworkDirs = [ - __DIR__.$DS.'..'.$DS.'webfiori', - __DIR__.$DS.'..'.$DS.'vendor'.$DS.'webfiori'.$DS.'webfiori' + __DIR__.$DS.'..'.$DS.'WebFiori', + __DIR__.$DS.'..'.$DS.'vendor'.$DS.'WebFiori'.$DS.'WebFiori' ]; fprintf(STDOUT, "PHP Version: '".PHP_VERSION."'\n"); fprintf(STDOUT, "Version ID: '".PHP_VERSION_ID."'\n"); @@ -48,7 +48,7 @@ foreach ($WebFioriFrameworkDirs as $dir) { //linux - $file = $DS.$dir.'framework'.$DS.'autoload'.$DS.'ClassLoader.php'; + $file = $DS.$dir.$DS.'Framework'.$DS.'Autoload'.$DS.'ClassLoader.php'; fprintf(STDOUT,"Checking if file '$file' is exist...\n"); if (file_exists($file)) { @@ -62,7 +62,7 @@ foreach ($WebFioriFrameworkDirs as $dir) { //other - $file = $dir.$DS.'framework'.$DS.'autoload'.$DS.'ClassLoader.php'; + $file = $dir.$DS.'Framework'.$DS.'Autoload'.$DS.'ClassLoader.php'; fprintf(STDOUT,"Checking if file '$file' is exist...\n"); if (file_exists($file)) { @@ -83,9 +83,10 @@ ClassLoader::get([ 'search-folders' => [ 'tests', - 'webfiori', + 'WebFiori', 'vendor', - 'app' + 'App', + 'Themes' ], 'define-root' => true, 'root' => $ROOT, @@ -94,7 +95,7 @@ fprintf(STDOUT,'Autoloader Initialized.'."\n"); fprintf(STDOUT,"---------------------------------\n"); fprintf(STDOUT,"Initializing application...\n"); -App::initiate('app', 'public', $ROOT); +App::initiate('App', 'public', $ROOT); App::start(); fprintf(STDOUT,'Done.'."\n"); fprintf(STDOUT,'Autoload Root Directory: \''.ClassLoader::get()->root().'\'.'."\n"); diff --git a/tests/phpunit.xml b/tests/phpunit.xml index 720bfee7f..61b04087b 100644 --- a/tests/phpunit.xml +++ b/tests/phpunit.xml @@ -5,82 +5,82 @@ - ../webfiori/framework/Access.php - ../webfiori/framework/DB.php - ../webfiori/framework/Language.php + ../WebFiori/Framework/Access.php + ../WebFiori/Framework/DB.php + ../WebFiori/Framework/Language.php - ../webfiori/framework/config/JsonDriver.php - ../webfiori/framework/config/ClassDriver.php + ../WebFiori/Framework/Config/JsonDriver.php + ../WebFiori/Framework/Config/ClassDriver.php - ../webfiori/framework/Privilege.php - ../webfiori/framework/PrivilegesGroup.php - ../webfiori/framework/User.php - ../webfiori/framework/Theme.php + ../WebFiori/Framework/Privilege.php + ../WebFiori/Framework/PrivilegesGroup.php + ../WebFiori/Framework/User.php + ../WebFiori/Framework/Theme.php - ../webfiori/framework/ui/BeforeRenderCallback.php - ../webfiori/framework/ui/WebPage.php + ../WebFiori/Framework/ui/BeforeRenderCallback.php + ../WebFiori/Framework/ui/WebPage.php - ../webfiori/framework/scheduler/BaseTask.php - ../webfiori/framework/scheduler/AbstractTask.php - ../webfiori/framework/scheduler/TasksManager.php - ../webfiori/framework/scheduler/TaskArgument.php + ../WebFiori/Framework/Scheduler/BaseTask.php + ../WebFiori/Framework/Scheduler/AbstractTask.php + ../WebFiori/Framework/Scheduler/TasksManager.php + ../WebFiori/Framework/Scheduler/TaskArgument.php - ../webfiori/framework/router/RouterUri.php - ../webfiori/framework/router/Router.php + ../WebFiori/Framework/Router/RouterUri.php + ../WebFiori/Framework/Router/Router.php - ../webfiori/framework/middleware/AbstractMiddleware.php - ../webfiori/framework/middleware/MiddlewareManager.php - ../webfiori/framework/middleware/CacheMiddleware.php - ../webfiori/framework/middleware/StartSessionMiddleware.php + ../WebFiori/Framework/Middleware/AbstractMiddleware.php + ../WebFiori/Framework/Middleware/MiddlewareManager.php + ../WebFiori/Framework/Middleware/CacheMiddleware.php + ../WebFiori/Framework/Middleware/StartSessionMiddleware.php - ../webfiori/framework/session/Session.php - ../webfiori/framework/session/SessionsManager.php - ../webfiori/framework/session/DefaultSessionStorage.php - ../webfiori/framework/session/DatabaseSessionStorage.php - ../webfiori/framework/session/SessionDB.php + ../WebFiori/Framework/Session/Session.php + ../WebFiori/Framework/Session/SessionsManager.php + ../WebFiori/Framework/Session/DefaultSessionStorage.php + ../WebFiori/Framework/Session/DatabaseSessionStorage.php + ../WebFiori/Framework/Session/SessionDB.php - ../webfiori/framework/cli/commands/AddCommand.php - ../webfiori/framework/cli/commands/CreateCommand.php - ../webfiori/framework/cli/commands/ListRoutesCommand.php - ../webfiori/framework/cli/commands/ListThemesCommand.php - ../webfiori/framework/cli/commands/RunSQLQueryCommand.php - ../webfiori/framework/cli/commands/SchedulerCommand.php - ../webfiori/framework/cli/commands/SettingsCommand.php - ../webfiori/framework/cli/commands/UpdateSettingsCommand.php - ../webfiori/framework/cli/commands/UpdateTableCommand.php - ../webfiori/framework/cli/commands/VersionCommand.php - ../webfiori/framework/cli/commands/WHelpCommand.php - ../webfiori/framework/cli/commands/RunMigrationsCommand.php - ../webfiori/framework/cli/CLITestCase.php - ../webfiori/framework/cli/CLIUtils.php + ../WebFiori/Framework/Cli/Commands/AddCommand.php + ../WebFiori/Framework/Cli/Commands/CreateCommand.php + ../WebFiori/Framework/Cli/Commands/ListRoutesCommand.php + ../WebFiori/Framework/Cli/Commands/ListThemesCommand.php + ../WebFiori/Framework/Cli/Commands/RunSQLQueryCommand.php + ../WebFiori/Framework/Cli/Commands/SchedulerCommand.php + ../WebFiori/Framework/Cli/Commands/SettingsCommand.php + ../WebFiori/Framework/Cli/Commands/UpdateSettingsCommand.php + ../WebFiori/Framework/Cli/Commands/UpdateTableCommand.php + ../WebFiori/Framework/Cli/Commands/VersionCommand.php + ../WebFiori/Framework/Cli/Commands/WHelpCommand.php + ../WebFiori/Framework/Cli/Commands/RunMigrationsCommand.php + ../WebFiori/Framework/cli/CLITestCase.php + ../WebFiori/Framework/cli/CLIUtils.php - ../webfiori/framework/cli/helpers/ClassInfoReader.php - ../webfiori/framework/cli/helpers/CreateBackgroundTask.php - ../webfiori/framework/cli/helpers/CreateCLIClassHelper.php - ../webfiori/framework/cli/helpers/CreateClassHelper.php - ../webfiori/framework/cli/helpers/CreateDBAccessHelper.php - ../webfiori/framework/cli/helpers/CreateFullRESTHelper.php - ../webfiori/framework/cli/helpers/CreateMiddleware.php - ../webfiori/framework/cli/helpers/CreateTableObj.php - ../webfiori/framework/cli/helpers/CreateThemeHelper.php - ../webfiori/framework/cli/helpers/CreateWebService.php - ../webfiori/framework/cli/helpers/TableObjHelper.php - ../webfiori/framework/cli/helpers/CreateAPITestCase.php - ../webfiori/framework/cli/helpers/CreateMigration.php + ../WebFiori/Framework/Cli/Helpers/ClassInfoReader.php + ../WebFiori/Framework/Cli/Helpers/CreateBackgroundTask.php + ../WebFiori/Framework/Cli/Helpers/CreateCLIClassHelper.php + ../WebFiori/Framework/Cli/Helpers/CreateClassHelper.php + ../WebFiori/Framework/Cli/Helpers/CreateDBAccessHelper.php + ../WebFiori/Framework/Cli/Helpers/CreateFullRESTHelper.php + ../WebFiori/Framework/Cli/Helpers/CreateMiddleware.php + ../WebFiori/Framework/Cli/Helpers/CreateTableObj.php + ../WebFiori/Framework/Cli/Helpers/CreateThemeHelper.php + ../WebFiori/Framework/Cli/Helpers/CreateWebService.php + ../WebFiori/Framework/Cli/Helpers/TableObjHelper.php + ../WebFiori/Framework/Cli/Helpers/CreateAPITestCase.php + ../WebFiori/Framework/Cli/Helpers/CreateMigration.php - ../webfiori/framework/writers/CLICommandClassWriter.php - ../webfiori/framework/writers/ClassWriter.php - ../webfiori/framework/writers/DBClassWriter.php - ../webfiori/framework/writers/LangClassWriter.php - ../webfiori/framework/writers/MiddlewareClassWriter.php - ../webfiori/framework/writers/SchedulerTaskClassWriter.php - ../webfiori/framework/writers/TableClassWriter.php - ../webfiori/framework/writers/ThemeClassWriter.php - ../webfiori/framework/writers/ThemeComponentWriter.php - ../webfiori/framework/writers/WebServiceWriter.php - ../webfiori/framework/writers/APITestCaseWriter.php - ../webfiori/framework/writers/DatabaseMigrationWriter.php + ../WebFiori/Framework/Writers/CLICommandClassWriter.php + ../WebFiori/Framework/Writers/ClassWriter.php + ../WebFiori/Framework/Writers/DBClassWriter.php + ../WebFiori/Framework/Writers/LangClassWriter.php + ../WebFiori/Framework/Writers/MiddlewareClassWriter.php + ../WebFiori/Framework/Writers/SchedulerTaskClassWriter.php + ../WebFiori/Framework/Writers/TableClassWriter.php + ../WebFiori/Framework/Writers/ThemeClassWriter.php + ../WebFiori/Framework/Writers/ThemeComponentWriter.php + ../WebFiori/Framework/Writers/WebServiceWriter.php + ../WebFiori/Framework/Writers/APITestCaseWriter.php + ../WebFiori/Framework/Writers/DatabaseMigrationWriter.php @@ -89,42 +89,42 @@ - ./webfiori/framework/test - ./webfiori/framework/test/langs - ./webfiori/framework/test/router - ./webfiori/framework/test/mail - ./webfiori/framework/test/writers - ./webfiori/framework/test/cli - ./webfiori/framework/test/theme - ./webfiori/framework/test/scheduler - ./webfiori/framework/test/session + ./WebFiori/Framework/Tests + ./WebFiori/Framework/Tests/Langs + ./WebFiori/Framework/Tests/Router + ./WebFiori/Framework/Tests/Mail + ./WebFiori/Framework/Tests/Writers + ./WebFiori/Framework/Tests/Cli + ./WebFiori/Framework/Tests/Theme + ./WebFiori/Framework/Tests/Scheduler + ./WebFiori/Framework/Tests/Session - ./webfiori/framework/test/DBTest.php + ./WebFiori/Framework/Tests/DBTest.php - ./webfiori/framework/test/langs + ./WebFiori/Framework/Tests/Langs - ./webfiori/framework/test/router + ./WebFiori/Framework/Tests/Router - ./webfiori/framework/test/mail + ./WebFiori/Framework/Tests/Mail - ./webfiori/framework/test/writers + ./WebFiori/Framework/Tests/Writers - ./webfiori/framework/test/cli + ./WebFiori/Framework/Tests/Cli - ./webfiori/framework/test/theme + ./WebFiori/Framework/Tests/Theme - ./webfiori/framework/test/scheduler + ./WebFiori/Framework/Tests/Scheduler - ./webfiori/framework/test/session + ./WebFiori/Framework/Tests/Session \ No newline at end of file diff --git a/tests/phpunit10.xml b/tests/phpunit10.xml index b9b55e805..ff5539c00 100644 --- a/tests/phpunit10.xml +++ b/tests/phpunit10.xml @@ -10,111 +10,111 @@ - ./webfiori/framework/test - ./webfiori/framework/test/theme - ./webfiori/framework/test/cli - ./webfiori/framework/test/langs - ./webfiori/framework/test/router - ./webfiori/framework/test/mail - ./webfiori/framework/test/writers - ./webfiori/framework/test/scheduler - ./webfiori/framework/test/session + ./WebFiori/Framework/Tests + ./WebFiori/Framework/Tests/Theme + ./WebFiori/Framework/Tests/Cli + ./WebFiori/Framework/Tests/Langs + ./WebFiori/Framework/Tests/Router + ./WebFiori/Framework/Tests/Mail + ./WebFiori/Framework/Tests/Writers + ./WebFiori/Framework/Tests/Scheduler + ./WebFiori/Framework/Tests/Session - ./webfiori/framework/test/DBTest.php + ./WebFiori/Framework/Tests/DBTest.php - ./webfiori/framework/test/langs + ./WebFiori/Framework/Tests/Langs - ./webfiori/framework/test/router + ./WebFiori/Framework/Tests/Router - ./webfiori/framework/test/mail + ./WebFiori/Framework/Tests/Mail - ./webfiori/framework/test/writers + ./WebFiori/Framework/Tests/Writers - ./webfiori/framework/test/cli + ./WebFiori/Framework/Tests/Cli - ./webfiori/framework/test/theme + ./WebFiori/Framework/Tests/Theme - ./webfiori/framework/test/scheduler + ./WebFiori/Framework/Tests/Scheduler - ./webfiori/framework/test/session + ./WebFiori/Framework/Tests/Session - ../webfiori/framework/Access.php - ../webfiori/framework/DB.php - ../webfiori/framework/Language.php - ../webfiori/framework/config/JsonDriver.php - ../webfiori/framework/config/ClassDriver.php - ../webfiori/framework/Privilege.php - ../webfiori/framework/PrivilegesGroup.php - ../webfiori/framework/User.php - ../webfiori/framework/Theme.php - ../webfiori/framework/ui/BeforeRenderCallback.php - ../webfiori/framework/ui/WebPage.php - ../webfiori/framework/scheduler/BaseTask.php - ../webfiori/framework/scheduler/AbstractTask.php - ../webfiori/framework/scheduler/TasksManager.php - ../webfiori/framework/scheduler/TaskArgument.php - ../webfiori/framework/router/RouterUri.php - ../webfiori/framework/router/Router.php - ../webfiori/framework/middleware/AbstractMiddleware.php - ../webfiori/framework/middleware/MiddlewareManager.php - ../webfiori/framework/middleware/CacheMiddleware.php - ../webfiori/framework/middleware/StartSessionMiddleware.php - ../webfiori/framework/session/Session.php - ../webfiori/framework/session/SessionsManager.php - ../webfiori/framework/session/DefaultSessionStorage.php - ../webfiori/framework/session/DatabaseSessionStorage.php - ../webfiori/framework/session/SessionDB.php - ../webfiori/framework/cli/commands/AddCommand.php - ../webfiori/framework/cli/commands/CreateCommand.php - ../webfiori/framework/cli/commands/ListRoutesCommand.php - ../webfiori/framework/cli/commands/ListThemesCommand.php - ../webfiori/framework/cli/commands/RunSQLQueryCommand.php - ../webfiori/framework/cli/commands/SchedulerCommand.php - ../webfiori/framework/cli/commands/SettingsCommand.php - ../webfiori/framework/cli/commands/UpdateSettingsCommand.php - ../webfiori/framework/cli/commands/UpdateTableCommand.php - ../webfiori/framework/cli/commands/VersionCommand.php - ../webfiori/framework/cli/commands/WHelpCommand.php - ../webfiori/framework/cli/commands/RunMigrationsCommand.php - ../webfiori/framework/cli/CLITestCase.php - ../webfiori/framework/cli/CLIUtils.php - ../webfiori/framework/cli/helpers/ClassInfoReader.php - ../webfiori/framework/cli/helpers/CreateBackgroundTask.php - ../webfiori/framework/cli/helpers/CreateCLIClassHelper.php - ../webfiori/framework/cli/helpers/CreateClassHelper.php - ../webfiori/framework/cli/helpers/CreateDBAccessHelper.php - ../webfiori/framework/cli/helpers/CreateFullRESTHelper.php - ../webfiori/framework/cli/helpers/CreateMiddleware.php - ../webfiori/framework/cli/helpers/CreateTableObj.php - ../webfiori/framework/cli/helpers/CreateThemeHelper.php - ../webfiori/framework/cli/helpers/CreateWebService.php - ../webfiori/framework/cli/helpers/TableObjHelper.php - ../webfiori/framework/cli/helpers/CreateAPITestCase.php - ../webfiori/framework/cli/helpers/CreateMigration.php - ../webfiori/framework/writers/CLICommandClassWriter.php - ../webfiori/framework/writers/ClassWriter.php - ../webfiori/framework/writers/DBClassWriter.php - ../webfiori/framework/writers/LangClassWriter.php - ../webfiori/framework/writers/MiddlewareClassWriter.php - ../webfiori/framework/writers/SchedulerTaskClassWriter.php - ../webfiori/framework/writers/TableClassWriter.php - ../webfiori/framework/writers/ThemeClassWriter.php - ../webfiori/framework/writers/ThemeComponentWriter.php - ../webfiori/framework/writers/WebServiceWriter.php - ../webfiori/framework/writers/APITestCaseWriter.php - ../webfiori/framework/writers/DatabaseMigrationWriter.php + ../WebFiori/Framework/Access.php + ../WebFiori/Framework/DB.php + ../WebFiori/Framework/Language.php + ../WebFiori/Framework/Config/JsonDriver.php + ../WebFiori/Framework/Config/ClassDriver.php + ../WebFiori/Framework/Privilege.php + ../WebFiori/Framework/PrivilegesGroup.php + ../WebFiori/Framework/User.php + ../WebFiori/Framework/Theme.php + ../WebFiori/Framework/ui/BeforeRenderCallback.php + ../WebFiori/Framework/ui/WebPage.php + ../WebFiori/Framework/Scheduler/BaseTask.php + ../WebFiori/Framework/Scheduler/AbstractTask.php + ../WebFiori/Framework/Scheduler/TasksManager.php + ../WebFiori/Framework/Scheduler/TaskArgument.php + ../WebFiori/Framework/Router/RouterUri.php + ../WebFiori/Framework/Router/Router.php + ../WebFiori/Framework/Middleware/AbstractMiddleware.php + ../WebFiori/Framework/Middleware/MiddlewareManager.php + ../WebFiori/Framework/Middleware/CacheMiddleware.php + ../WebFiori/Framework/Middleware/StartSessionMiddleware.php + ../WebFiori/Framework/Session/Session.php + ../WebFiori/Framework/Session/SessionsManager.php + ../WebFiori/Framework/Session/DefaultSessionStorage.php + ../WebFiori/Framework/Session/DatabaseSessionStorage.php + ../WebFiori/Framework/Session/SessionDB.php + ../WebFiori/Framework/Cli/Commands/AddCommand.php + ../WebFiori/Framework/Cli/Commands/CreateCommand.php + ../WebFiori/Framework/Cli/Commands/ListRoutesCommand.php + ../WebFiori/Framework/Cli/Commands/ListThemesCommand.php + ../WebFiori/Framework/Cli/Commands/RunSQLQueryCommand.php + ../WebFiori/Framework/Cli/Commands/SchedulerCommand.php + ../WebFiori/Framework/Cli/Commands/SettingsCommand.php + ../WebFiori/Framework/Cli/Commands/UpdateSettingsCommand.php + ../WebFiori/Framework/Cli/Commands/UpdateTableCommand.php + ../WebFiori/Framework/Cli/Commands/VersionCommand.php + ../WebFiori/Framework/Cli/Commands/WHelpCommand.php + ../WebFiori/Framework/Cli/Commands/RunMigrationsCommand.php + ../WebFiori/Framework/Cli/CLITestCase.php + ../WebFiori/Framework/Cli/CLIUtils.php + ../WebFiori/Framework/Cli/Helpers/ClassInfoReader.php + ../WebFiori/Framework/Cli/Helpers/CreateBackgroundTask.php + ../WebFiori/Framework/Cli/Helpers/CreateCLIClassHelper.php + ../WebFiori/Framework/Cli/Helpers/CreateClassHelper.php + ../WebFiori/Framework/Cli/Helpers/CreateDBAccessHelper.php + ../WebFiori/Framework/Cli/Helpers/CreateFullRESTHelper.php + ../WebFiori/Framework/Cli/Helpers/CreateMiddleware.php + ../WebFiori/Framework/Cli/Helpers/CreateTableObj.php + ../WebFiori/Framework/Cli/Helpers/CreateThemeHelper.php + ../WebFiori/Framework/Cli/Helpers/CreateWebService.php + ../WebFiori/Framework/Cli/Helpers/TableObjHelper.php + ../WebFiori/Framework/Cli/Helpers/CreateAPITestCase.php + ../WebFiori/Framework/Cli/Helpers/CreateMigration.php + ../WebFiori/Framework/Writers/CLICommandClassWriter.php + ../WebFiori/Framework/Writers/ClassWriter.php + ../WebFiori/Framework/Writers/DBClassWriter.php + ../WebFiori/Framework/Writers/LangClassWriter.php + ../WebFiori/Framework/Writers/MiddlewareClassWriter.php + ../WebFiori/Framework/Writers/SchedulerTaskClassWriter.php + ../WebFiori/Framework/Writers/TableClassWriter.php + ../WebFiori/Framework/Writers/ThemeClassWriter.php + ../WebFiori/Framework/Writers/ThemeComponentWriter.php + ../WebFiori/Framework/Writers/WebServiceWriter.php + ../WebFiori/Framework/Writers/APITestCaseWriter.php + ../WebFiori/Framework/Writers/DatabaseMigrationWriter.php diff --git a/tests/webfiori/framework/scheduler/webServices/temp b/tests/webfiori/framework/scheduler/webServices/temp deleted file mode 100644 index 8b1378917..000000000 --- a/tests/webfiori/framework/scheduler/webServices/temp +++ /dev/null @@ -1 +0,0 @@ - diff --git a/tests/webfiori/framework/test/cli/DBClassWritterTest.php b/tests/webfiori/framework/test/cli/DBClassWritterTest.php deleted file mode 100644 index 2f520d683..000000000 --- a/tests/webfiori/framework/test/cli/DBClassWritterTest.php +++ /dev/null @@ -1,73 +0,0 @@ -getEntityMapper(); - $mapper->setEntityName('CoolUser'); - $mapper->setNamespace('webfiori\\entity'); - $writter = new DBClassWriter('UserDBClass', 'webfiori\\db', $table); - $writter->writeClass(); - $this->assertTrue(class_exists($writter->getName(true))); - $this->removeClass($writter->getName(true)); - } - - /** - * @test - */ - public function test01() { - $table = new EmployeeInfoTable(); - $mapper = $table->getEntityMapper(); - $mapper->setEntityName('Employee'); - $mapper->setNamespace('webfiori\\entity'); - $writter = new DBClassWriter('EmployeeDB', 'webfiori\\db', $table); - $writter->writeClass(); - $this->assertTrue(class_exists($writter->getName(true))); - $this->removeClass($writter->getName(true)); - } - - /** - * @test - */ - public function test02() { - $table = new PositionInfoTable(); - $mapper = $table->getEntityMapper(); - $mapper->setEntityName('Position'); - $mapper->setNamespace('webfiori\\entity'); - $writter = new DBClassWriter('PositionDB', 'webfiori\\db', $table); - $writter->writeClass(); - $this->assertTrue(class_exists($writter->getName(true))); - $this->removeClass($writter->getName(true)); - } - - /** - * @test - */ - public function test03() { - $table = new PositionInfoTable(); - $writter = new DBClassWriter('PositionDB2', 'webfiori\\db', $table); - $writter->setConnection(' '); - $this->assertNull($writter->getConnectionName()); - $writter->setConnection('ok-connection'); - $this->assertEquals('ok-connection', $writter->getConnectionName()); - $writter->includeColumnsUpdate(); - $writter->writeClass(); - $this->assertTrue(class_exists($writter->getName(true))); - $this->removeClass($writter->getName(true)); - } -} diff --git a/themes/fiori/.gitkeep b/themes/fiori/.gitkeep deleted file mode 100644 index 8b1378917..000000000 --- a/themes/fiori/.gitkeep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/webfiori/db/temp b/webfiori/db/temp deleted file mode 100644 index 8b1378917..000000000 --- a/webfiori/db/temp +++ /dev/null @@ -1 +0,0 @@ -