@@ -19,7 +19,7 @@ |
||
19 | 19 | $path = str_replace("\\", DIRECTORY_SEPARATOR, $class); |
20 | 20 | |
21 | 21 | // filepath |
22 | - $abs_path = SOURCE_DIR . DIRECTORY_SEPARATOR . $path . ".php"; |
|
22 | + $abs_path = SOURCE_DIR.DIRECTORY_SEPARATOR.$path.".php"; |
|
23 | 23 | |
24 | 24 | // require the file |
25 | 25 | if (file_exists($abs_path)) { |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | public function getServer($key, $default = null) |
22 | 22 | { |
23 | 23 | $value = null; |
24 | - if(array_key_exists($key, $this->server)) { |
|
24 | + if (array_key_exists($key, $this->server)) { |
|
25 | 25 | $value = $this->server[$key]; |
26 | 26 | } |
27 | 27 | return $value ?: $default; |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function getProtocol() |
62 | 62 | { |
63 | - if(Config::getParam('force.https', false)) { |
|
63 | + if (Config::getParam('force.https', false)) { |
|
64 | 64 | return 'https://'; |
65 | 65 | } |
66 | 66 | return ($this->getServer('HTTPS') || $this->getServer('https')) ? 'https://' : 'http://'; |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | { |
35 | 35 | $platform = trim(Config::getInstance()->get('platform.name', 'PSFS')); |
36 | 36 | header('HTTP/1.1 401 Unauthorized'); |
37 | - header('WWW-Authenticate: Basic Realm="' . $platform . '"'); |
|
37 | + header('WWW-Authenticate: Basic Realm="'.$platform.'"'); |
|
38 | 38 | echo t('Zona restringida'); |
39 | 39 | exit(); |
40 | 40 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $admin['class'] = 'primary'; |
77 | 77 | break; |
78 | 78 | } |
79 | - } else { |
|
79 | + }else { |
|
80 | 80 | $admin['class'] = 'primary'; |
81 | 81 | } |
82 | 82 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function createStructureModule($module, $force = false, $type = "", $apiClass = "") |
40 | 40 | { |
41 | - $modPath = CORE_DIR . DIRECTORY_SEPARATOR; |
|
41 | + $modPath = CORE_DIR.DIRECTORY_SEPARATOR; |
|
42 | 42 | $module = ucfirst($module); |
43 | 43 | $this->createModulePath($module, $modPath); |
44 | 44 | $this->createModulePathTree($module, $modPath); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | private function createModuleBaseFiles($module, $modPath, $force = false, $controllerType = '') |
61 | 61 | { |
62 | - $modulePath = $modPath . $module; |
|
62 | + $modulePath = $modPath.$module; |
|
63 | 63 | $this->generateControllerTemplate($module, $modulePath, $force, $controllerType); |
64 | 64 | $this->generateServiceTemplate($module, $modulePath, $force); |
65 | 65 | $this->genereateAutoloaderTemplate($module, $modulePath, $force); |
@@ -87,28 +87,28 @@ discard block |
||
87 | 87 | "namespace" => preg_replace('/(\\\|\/)/', '\\', $module), |
88 | 88 | "url" => preg_replace('/(\\\|\/)/', '/', $module), |
89 | 89 | "class" => $class, |
90 | - "controllerType" => $class . "Base", |
|
90 | + "controllerType" => $class."Base", |
|
91 | 91 | "is_base" => false |
92 | 92 | )); |
93 | - $controller = $this->writeTemplateToFile($controllerBody, $modPath . DIRECTORY_SEPARATOR . "Controller" . |
|
94 | - DIRECTORY_SEPARATOR . "{$class}Controller.php", $force); |
|
93 | + $controller = $this->writeTemplateToFile($controllerBody, $modPath.DIRECTORY_SEPARATOR."Controller". |
|
94 | + DIRECTORY_SEPARATOR."{$class}Controller.php", $force); |
|
95 | 95 | |
96 | 96 | $controllerBody = $this->tpl->dump("generator/controller.template.twig", array( |
97 | 97 | "module" => $module, |
98 | 98 | "namespace" => preg_replace('/(\\\|\/)/', '\\', $module), |
99 | 99 | "url" => preg_replace('/(\\\|\/)/', '/', $module), |
100 | - "class" => $class . "Base", |
|
100 | + "class" => $class."Base", |
|
101 | 101 | "service" => $class, |
102 | 102 | "controllerType" => $controllerType, |
103 | 103 | "is_base" => true, |
104 | 104 | "domain" => $class, |
105 | 105 | )); |
106 | - $controllerBase = $this->writeTemplateToFile($controllerBody, $modPath . DIRECTORY_SEPARATOR . "Controller" . |
|
107 | - DIRECTORY_SEPARATOR . "base" . DIRECTORY_SEPARATOR . "{$class}BaseController.php", true); |
|
106 | + $controllerBase = $this->writeTemplateToFile($controllerBody, $modPath.DIRECTORY_SEPARATOR."Controller". |
|
107 | + DIRECTORY_SEPARATOR."base".DIRECTORY_SEPARATOR."{$class}BaseController.php", true); |
|
108 | 108 | |
109 | - $filename = $modPath . DIRECTORY_SEPARATOR . "Test" . DIRECTORY_SEPARATOR . "{$class}Test.php"; |
|
109 | + $filename = $modPath.DIRECTORY_SEPARATOR."Test".DIRECTORY_SEPARATOR."{$class}Test.php"; |
|
110 | 110 | $test = true; |
111 | - if(!file_exists($filename)) { |
|
111 | + if (!file_exists($filename)) { |
|
112 | 112 | $testTemplate = $this->tpl->dump("generator/testCase.template.twig", array( |
113 | 113 | "module" => $module, |
114 | 114 | "namespace" => preg_replace('/(\\\|\/)/', '\\', $module), |
@@ -127,8 +127,8 @@ discard block |
||
127 | 127 | */ |
128 | 128 | private function createModuleModels($module, $path) |
129 | 129 | { |
130 | - $modulePath = $path . $module; |
|
131 | - $modulePath = str_replace(CORE_DIR . DIRECTORY_SEPARATOR, '', $modulePath); |
|
130 | + $modulePath = $path.$module; |
|
131 | + $modulePath = str_replace(CORE_DIR.DIRECTORY_SEPARATOR, '', $modulePath); |
|
132 | 132 | |
133 | 133 | $configGenerator = $this->getConfigGenerator($modulePath); |
134 | 134 | |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | $configTemplate = $this->tpl->dump("generator/config.propel.template.twig", array( |
139 | 139 | "module" => $module, |
140 | 140 | )); |
141 | - $this->writeTemplateToFile($configTemplate, CORE_DIR . DIRECTORY_SEPARATOR . $modulePath . DIRECTORY_SEPARATOR . "Config" . |
|
142 | - DIRECTORY_SEPARATOR . "config.php", true); |
|
141 | + $this->writeTemplateToFile($configTemplate, CORE_DIR.DIRECTORY_SEPARATOR.$modulePath.DIRECTORY_SEPARATOR."Config". |
|
142 | + DIRECTORY_SEPARATOR."config.php", true); |
|
143 | 143 | Logger::log("Generado config genérico para propel"); |
144 | 144 | } |
145 | 145 | |
@@ -154,8 +154,8 @@ discard block |
||
154 | 154 | private function generateBaseApiTemplate($module, $modPath, $force = false, $apiClass = "") |
155 | 155 | { |
156 | 156 | $created = true; |
157 | - $modelPath = $modPath . $module . DIRECTORY_SEPARATOR . 'Models'; |
|
158 | - $apiPath = $modPath . $module . DIRECTORY_SEPARATOR . 'Api'; |
|
157 | + $modelPath = $modPath.$module.DIRECTORY_SEPARATOR.'Models'; |
|
158 | + $apiPath = $modPath.$module.DIRECTORY_SEPARATOR.'Api'; |
|
159 | 159 | if (file_exists($modelPath)) { |
160 | 160 | $dir = dir($modelPath); |
161 | 161 | $this->generateApiFiles($module, $force, $apiClass, $dir, $apiPath); |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | //Generamos el fichero de configuración |
174 | 174 | Logger::log("Generamos fichero vacío de configuración"); |
175 | 175 | return $this->writeTemplateToFile("<?php\n\t", |
176 | - $modPath . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "config.php", |
|
176 | + $modPath.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."config.php", |
|
177 | 177 | $force); |
178 | 178 | } |
179 | 179 | |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | "db" => $this->config->get("db_name"), |
195 | 195 | )); |
196 | 196 | return $this->writeTemplateToFile($schema, |
197 | - $modPath . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "schema.xml", |
|
197 | + $modPath.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."schema.xml", |
|
198 | 198 | $force); |
199 | 199 | } |
200 | 200 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | "namespace" => preg_replace('/(\\\|\/)/', '', $module), |
213 | 213 | )); |
214 | 214 | return $this->writeTemplateToFile($buildProperties, |
215 | - $modPath . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "propel.php", |
|
215 | + $modPath.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."propel.php", |
|
216 | 216 | $force); |
217 | 217 | } |
218 | 218 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | "module" => $module, |
231 | 231 | )); |
232 | 232 | return $this->writeTemplateToFile($index, |
233 | - $modPath . DIRECTORY_SEPARATOR . "Templates" . DIRECTORY_SEPARATOR . "index.html.twig", |
|
233 | + $modPath.DIRECTORY_SEPARATOR."Templates".DIRECTORY_SEPARATOR."index.html.twig", |
|
234 | 234 | $force); |
235 | 235 | } |
236 | 236 | |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | )); |
261 | 261 | |
262 | 262 | return $this->writeTemplateToFile($controller, |
263 | - $modPath . DIRECTORY_SEPARATOR . 'base' . DIRECTORY_SEPARATOR . "{$api}BaseApi.php", true); |
|
263 | + $modPath.DIRECTORY_SEPARATOR.'base'.DIRECTORY_SEPARATOR."{$api}BaseApi.php", true); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | /** |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | "package" => $package, |
286 | 286 | )); |
287 | 287 | |
288 | - return $this->writeTemplateToFile($controller, $modPath . DIRECTORY_SEPARATOR . "{$api}.php", $force); |
|
288 | + return $this->writeTemplateToFile($controller, $modPath.DIRECTORY_SEPARATOR."{$api}.php", $force); |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | /** |
@@ -302,15 +302,15 @@ discard block |
||
302 | 302 | $base = $dir->path; |
303 | 303 | while ($file = $dir->read()) { |
304 | 304 | if (!in_array(strtolower($file), ['.', '..', 'base', 'map'])) { |
305 | - if (is_dir($base . DIRECTORY_SEPARATOR . $file)) { |
|
306 | - $this->generateApiFiles($module, $force, $apiClass, dir($base . DIRECTORY_SEPARATOR . $file), $apiPath . DIRECTORY_SEPARATOR . $file, $file); |
|
307 | - } else if (!preg_match('/Query\.php$/i', $file) |
|
305 | + if (is_dir($base.DIRECTORY_SEPARATOR.$file)) { |
|
306 | + $this->generateApiFiles($module, $force, $apiClass, dir($base.DIRECTORY_SEPARATOR.$file), $apiPath.DIRECTORY_SEPARATOR.$file, $file); |
|
307 | + }else if (!preg_match('/Query\.php$/i', $file) |
|
308 | 308 | && !preg_match('/I18n\.php$/i', $file) |
309 | 309 | && preg_match('/\.php$/i', $file) |
310 | 310 | ) { |
311 | 311 | $filename = str_replace(".php", "", $file); |
312 | 312 | $this->log->addLog("Generamos Api BASES para {$filename}"); |
313 | - if($this->checkIfIsModel($module, $filename, $package)) { |
|
313 | + if ($this->checkIfIsModel($module, $filename, $package)) { |
|
314 | 314 | $this->createApiBaseFile($module, $apiPath, $filename, $apiClass, $package); |
315 | 315 | $this->createApi($module, $apiPath, $force, $filename, $package); |
316 | 316 | } |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | $parts[] = $package; |
334 | 334 | } |
335 | 335 | $parts[] = $filename; |
336 | - $namespace = '\\' . implode('\\', $parts); |
|
336 | + $namespace = '\\'.implode('\\', $parts); |
|
337 | 337 | $reflectorClass = new \ReflectionClass($namespace); |
338 | 338 | $isModel = $reflectorClass->isInstantiable(); |
339 | 339 | return $isModel; |
@@ -18,53 +18,53 @@ discard block |
||
18 | 18 | const MODULE_NAME = 'CLIENT'; |
19 | 19 | |
20 | 20 | public static $filesToCheckWithoutSchema = [ |
21 | - DIRECTORY_SEPARATOR . 'phpunit.xml.dist', |
|
22 | - DIRECTORY_SEPARATOR . 'autoload.php', |
|
23 | - DIRECTORY_SEPARATOR . 'Test' . DIRECTORY_SEPARATOR . self::MODULE_NAME . 'Test.php', |
|
24 | - DIRECTORY_SEPARATOR . 'Templates' . DIRECTORY_SEPARATOR . 'index.html.twig', |
|
25 | - DIRECTORY_SEPARATOR . 'Services' . DIRECTORY_SEPARATOR . self::MODULE_NAME . 'Service.php', |
|
26 | - DIRECTORY_SEPARATOR . 'Controller' . DIRECTORY_SEPARATOR . self::MODULE_NAME . 'Controller.php', |
|
27 | - DIRECTORY_SEPARATOR . 'Controller' . DIRECTORY_SEPARATOR . 'base' . DIRECTORY_SEPARATOR . self::MODULE_NAME . 'BaseController.php', |
|
28 | - DIRECTORY_SEPARATOR . 'Public' . DIRECTORY_SEPARATOR . 'js' . DIRECTORY_SEPARATOR . 'app.js', |
|
29 | - DIRECTORY_SEPARATOR . 'Public' . DIRECTORY_SEPARATOR . 'css' . DIRECTORY_SEPARATOR . 'styles.css', |
|
30 | - DIRECTORY_SEPARATOR . 'Config' . DIRECTORY_SEPARATOR . 'schema.xml', |
|
31 | - DIRECTORY_SEPARATOR . 'Config' . DIRECTORY_SEPARATOR . 'propel.php', |
|
32 | - DIRECTORY_SEPARATOR . 'Config' . DIRECTORY_SEPARATOR . 'loadDatabase.php', |
|
33 | - DIRECTORY_SEPARATOR . 'Config' . DIRECTORY_SEPARATOR . 'config.php', |
|
34 | - DIRECTORY_SEPARATOR . 'Config' . DIRECTORY_SEPARATOR . 'Sql' . DIRECTORY_SEPARATOR . 'CLIENT.sql', |
|
35 | - DIRECTORY_SEPARATOR . 'Config' . DIRECTORY_SEPARATOR . 'Sql' . DIRECTORY_SEPARATOR . 'sqldb.map', |
|
21 | + DIRECTORY_SEPARATOR.'phpunit.xml.dist', |
|
22 | + DIRECTORY_SEPARATOR.'autoload.php', |
|
23 | + DIRECTORY_SEPARATOR.'Test'.DIRECTORY_SEPARATOR.self::MODULE_NAME.'Test.php', |
|
24 | + DIRECTORY_SEPARATOR.'Templates'.DIRECTORY_SEPARATOR.'index.html.twig', |
|
25 | + DIRECTORY_SEPARATOR.'Services'.DIRECTORY_SEPARATOR.self::MODULE_NAME.'Service.php', |
|
26 | + DIRECTORY_SEPARATOR.'Controller'.DIRECTORY_SEPARATOR.self::MODULE_NAME.'Controller.php', |
|
27 | + DIRECTORY_SEPARATOR.'Controller'.DIRECTORY_SEPARATOR.'base'.DIRECTORY_SEPARATOR.self::MODULE_NAME.'BaseController.php', |
|
28 | + DIRECTORY_SEPARATOR.'Public'.DIRECTORY_SEPARATOR.'js'.DIRECTORY_SEPARATOR.'app.js', |
|
29 | + DIRECTORY_SEPARATOR.'Public'.DIRECTORY_SEPARATOR.'css'.DIRECTORY_SEPARATOR.'styles.css', |
|
30 | + DIRECTORY_SEPARATOR.'Config'.DIRECTORY_SEPARATOR.'schema.xml', |
|
31 | + DIRECTORY_SEPARATOR.'Config'.DIRECTORY_SEPARATOR.'propel.php', |
|
32 | + DIRECTORY_SEPARATOR.'Config'.DIRECTORY_SEPARATOR.'loadDatabase.php', |
|
33 | + DIRECTORY_SEPARATOR.'Config'.DIRECTORY_SEPARATOR.'config.php', |
|
34 | + DIRECTORY_SEPARATOR.'Config'.DIRECTORY_SEPARATOR.'Sql'.DIRECTORY_SEPARATOR.'CLIENT.sql', |
|
35 | + DIRECTORY_SEPARATOR.'Config'.DIRECTORY_SEPARATOR.'Sql'.DIRECTORY_SEPARATOR.'sqldb.map', |
|
36 | 36 | ]; |
37 | 37 | |
38 | 38 | public static $filesToCheckWithSchema = [ |
39 | 39 | // Simple model creation |
40 | - DIRECTORY_SEPARATOR . 'Api' . DIRECTORY_SEPARATOR . 'Solo.php', |
|
41 | - DIRECTORY_SEPARATOR . 'Api' . DIRECTORY_SEPARATOR . 'base' . DIRECTORY_SEPARATOR . 'SoloBaseApi.php', |
|
42 | - DIRECTORY_SEPARATOR . 'Models' . DIRECTORY_SEPARATOR . 'Solo.php', |
|
43 | - DIRECTORY_SEPARATOR . 'Models' . DIRECTORY_SEPARATOR . 'SoloQuery.php', |
|
44 | - DIRECTORY_SEPARATOR . 'Models' . DIRECTORY_SEPARATOR . 'Base' . DIRECTORY_SEPARATOR . 'Solo.php', |
|
45 | - DIRECTORY_SEPARATOR . 'Models' . DIRECTORY_SEPARATOR . 'Base' . DIRECTORY_SEPARATOR . 'SoloQuery.php', |
|
46 | - DIRECTORY_SEPARATOR . 'Models' . DIRECTORY_SEPARATOR . 'Map' . DIRECTORY_SEPARATOR . 'SoloTableMap.php', |
|
40 | + DIRECTORY_SEPARATOR.'Api'.DIRECTORY_SEPARATOR.'Solo.php', |
|
41 | + DIRECTORY_SEPARATOR.'Api'.DIRECTORY_SEPARATOR.'base'.DIRECTORY_SEPARATOR.'SoloBaseApi.php', |
|
42 | + DIRECTORY_SEPARATOR.'Models'.DIRECTORY_SEPARATOR.'Solo.php', |
|
43 | + DIRECTORY_SEPARATOR.'Models'.DIRECTORY_SEPARATOR.'SoloQuery.php', |
|
44 | + DIRECTORY_SEPARATOR.'Models'.DIRECTORY_SEPARATOR.'Base'.DIRECTORY_SEPARATOR.'Solo.php', |
|
45 | + DIRECTORY_SEPARATOR.'Models'.DIRECTORY_SEPARATOR.'Base'.DIRECTORY_SEPARATOR.'SoloQuery.php', |
|
46 | + DIRECTORY_SEPARATOR.'Models'.DIRECTORY_SEPARATOR.'Map'.DIRECTORY_SEPARATOR.'SoloTableMap.php', |
|
47 | 47 | // Package model creation and I18n |
48 | - DIRECTORY_SEPARATOR . 'Api' . DIRECTORY_SEPARATOR . 'Test' . DIRECTORY_SEPARATOR . 'Test.php', |
|
49 | - DIRECTORY_SEPARATOR . 'Api' . DIRECTORY_SEPARATOR . 'Test' . DIRECTORY_SEPARATOR . 'base' . DIRECTORY_SEPARATOR . 'TestBaseApi.php', |
|
50 | - DIRECTORY_SEPARATOR . 'Models' . DIRECTORY_SEPARATOR . 'Test' . DIRECTORY_SEPARATOR . 'Test.php', |
|
51 | - DIRECTORY_SEPARATOR . 'Models' . DIRECTORY_SEPARATOR . 'Test' . DIRECTORY_SEPARATOR . 'TestQuery.php', |
|
52 | - DIRECTORY_SEPARATOR . 'Models' . DIRECTORY_SEPARATOR . 'Test' . DIRECTORY_SEPARATOR . 'TestI18n.php', |
|
53 | - DIRECTORY_SEPARATOR . 'Models' . DIRECTORY_SEPARATOR . 'Test' . DIRECTORY_SEPARATOR . 'TestI18nQuery.php', |
|
54 | - DIRECTORY_SEPARATOR . 'Models' . DIRECTORY_SEPARATOR . 'Test' . DIRECTORY_SEPARATOR . 'Base' . DIRECTORY_SEPARATOR . 'Test.php', |
|
55 | - DIRECTORY_SEPARATOR . 'Models' . DIRECTORY_SEPARATOR . 'Test' . DIRECTORY_SEPARATOR . 'Base' . DIRECTORY_SEPARATOR . 'TestQuery.php', |
|
56 | - DIRECTORY_SEPARATOR . 'Models' . DIRECTORY_SEPARATOR . 'Test' . DIRECTORY_SEPARATOR . 'Base' . DIRECTORY_SEPARATOR . 'TestI18n.php', |
|
57 | - DIRECTORY_SEPARATOR . 'Models' . DIRECTORY_SEPARATOR . 'Test' . DIRECTORY_SEPARATOR . 'Base' . DIRECTORY_SEPARATOR . 'TestI18nQuery.php', |
|
58 | - DIRECTORY_SEPARATOR . 'Models' . DIRECTORY_SEPARATOR . 'Test' . DIRECTORY_SEPARATOR . 'Map' . DIRECTORY_SEPARATOR . 'TestTableMap.php', |
|
59 | - DIRECTORY_SEPARATOR . 'Models' . DIRECTORY_SEPARATOR . 'Test' . DIRECTORY_SEPARATOR . 'Map' . DIRECTORY_SEPARATOR . 'TestI18nTableMap.php', |
|
48 | + DIRECTORY_SEPARATOR.'Api'.DIRECTORY_SEPARATOR.'Test'.DIRECTORY_SEPARATOR.'Test.php', |
|
49 | + DIRECTORY_SEPARATOR.'Api'.DIRECTORY_SEPARATOR.'Test'.DIRECTORY_SEPARATOR.'base'.DIRECTORY_SEPARATOR.'TestBaseApi.php', |
|
50 | + DIRECTORY_SEPARATOR.'Models'.DIRECTORY_SEPARATOR.'Test'.DIRECTORY_SEPARATOR.'Test.php', |
|
51 | + DIRECTORY_SEPARATOR.'Models'.DIRECTORY_SEPARATOR.'Test'.DIRECTORY_SEPARATOR.'TestQuery.php', |
|
52 | + DIRECTORY_SEPARATOR.'Models'.DIRECTORY_SEPARATOR.'Test'.DIRECTORY_SEPARATOR.'TestI18n.php', |
|
53 | + DIRECTORY_SEPARATOR.'Models'.DIRECTORY_SEPARATOR.'Test'.DIRECTORY_SEPARATOR.'TestI18nQuery.php', |
|
54 | + DIRECTORY_SEPARATOR.'Models'.DIRECTORY_SEPARATOR.'Test'.DIRECTORY_SEPARATOR.'Base'.DIRECTORY_SEPARATOR.'Test.php', |
|
55 | + DIRECTORY_SEPARATOR.'Models'.DIRECTORY_SEPARATOR.'Test'.DIRECTORY_SEPARATOR.'Base'.DIRECTORY_SEPARATOR.'TestQuery.php', |
|
56 | + DIRECTORY_SEPARATOR.'Models'.DIRECTORY_SEPARATOR.'Test'.DIRECTORY_SEPARATOR.'Base'.DIRECTORY_SEPARATOR.'TestI18n.php', |
|
57 | + DIRECTORY_SEPARATOR.'Models'.DIRECTORY_SEPARATOR.'Test'.DIRECTORY_SEPARATOR.'Base'.DIRECTORY_SEPARATOR.'TestI18nQuery.php', |
|
58 | + DIRECTORY_SEPARATOR.'Models'.DIRECTORY_SEPARATOR.'Test'.DIRECTORY_SEPARATOR.'Map'.DIRECTORY_SEPARATOR.'TestTableMap.php', |
|
59 | + DIRECTORY_SEPARATOR.'Models'.DIRECTORY_SEPARATOR.'Test'.DIRECTORY_SEPARATOR.'Map'.DIRECTORY_SEPARATOR.'TestI18nTableMap.php', |
|
60 | 60 | // Package related model |
61 | - DIRECTORY_SEPARATOR . 'Api' . DIRECTORY_SEPARATOR . 'Related' . DIRECTORY_SEPARATOR . 'Related.php', |
|
62 | - DIRECTORY_SEPARATOR . 'Api' . DIRECTORY_SEPARATOR . 'Related' . DIRECTORY_SEPARATOR . 'base' . DIRECTORY_SEPARATOR . 'RelatedBaseApi.php', |
|
63 | - DIRECTORY_SEPARATOR . 'Models' . DIRECTORY_SEPARATOR . 'Related' . DIRECTORY_SEPARATOR . 'Related.php', |
|
64 | - DIRECTORY_SEPARATOR . 'Models' . DIRECTORY_SEPARATOR . 'Related' . DIRECTORY_SEPARATOR . 'RelatedQuery.php', |
|
65 | - DIRECTORY_SEPARATOR . 'Models' . DIRECTORY_SEPARATOR . 'Related' . DIRECTORY_SEPARATOR . 'Base' . DIRECTORY_SEPARATOR . 'Related.php', |
|
66 | - DIRECTORY_SEPARATOR . 'Models' . DIRECTORY_SEPARATOR . 'Related' . DIRECTORY_SEPARATOR . 'Base' . DIRECTORY_SEPARATOR . 'RelatedQuery.php', |
|
67 | - DIRECTORY_SEPARATOR . 'Models' . DIRECTORY_SEPARATOR . 'Related' . DIRECTORY_SEPARATOR . 'Map' . DIRECTORY_SEPARATOR . 'RelatedTableMap.php', |
|
61 | + DIRECTORY_SEPARATOR.'Api'.DIRECTORY_SEPARATOR.'Related'.DIRECTORY_SEPARATOR.'Related.php', |
|
62 | + DIRECTORY_SEPARATOR.'Api'.DIRECTORY_SEPARATOR.'Related'.DIRECTORY_SEPARATOR.'base'.DIRECTORY_SEPARATOR.'RelatedBaseApi.php', |
|
63 | + DIRECTORY_SEPARATOR.'Models'.DIRECTORY_SEPARATOR.'Related'.DIRECTORY_SEPARATOR.'Related.php', |
|
64 | + DIRECTORY_SEPARATOR.'Models'.DIRECTORY_SEPARATOR.'Related'.DIRECTORY_SEPARATOR.'RelatedQuery.php', |
|
65 | + DIRECTORY_SEPARATOR.'Models'.DIRECTORY_SEPARATOR.'Related'.DIRECTORY_SEPARATOR.'Base'.DIRECTORY_SEPARATOR.'Related.php', |
|
66 | + DIRECTORY_SEPARATOR.'Models'.DIRECTORY_SEPARATOR.'Related'.DIRECTORY_SEPARATOR.'Base'.DIRECTORY_SEPARATOR.'RelatedQuery.php', |
|
67 | + DIRECTORY_SEPARATOR.'Models'.DIRECTORY_SEPARATOR.'Related'.DIRECTORY_SEPARATOR.'Map'.DIRECTORY_SEPARATOR.'RelatedTableMap.php', |
|
68 | 68 | ]; |
69 | 69 | |
70 | 70 | /** |
@@ -87,30 +87,30 @@ discard block |
||
87 | 87 | { |
88 | 88 | $generatorService = Service::getInstance(); |
89 | 89 | $this->assertInstanceOf(Service::class, $generatorService, 'Error getting GeneratorService instance'); |
90 | - $modulePath = CORE_DIR . DIRECTORY_SEPARATOR . self::MODULE_NAME; |
|
90 | + $modulePath = CORE_DIR.DIRECTORY_SEPARATOR.self::MODULE_NAME; |
|
91 | 91 | |
92 | 92 | $this->createNewModule($generatorService); |
93 | 93 | |
94 | 94 | GeneratorHelper::copyr( |
95 | - dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'examples' . DIRECTORY_SEPARATOR . 'generator' . DIRECTORY_SEPARATOR . 'Config', |
|
96 | - $modulePath . DIRECTORY_SEPARATOR . 'Config' |
|
95 | + dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'examples'.DIRECTORY_SEPARATOR.'generator'.DIRECTORY_SEPARATOR.'Config', |
|
96 | + $modulePath.DIRECTORY_SEPARATOR.'Config' |
|
97 | 97 | ); |
98 | - require_once $modulePath . DIRECTORY_SEPARATOR . 'autoload.php'; |
|
98 | + require_once $modulePath.DIRECTORY_SEPARATOR.'autoload.php'; |
|
99 | 99 | $generatorService->createStructureModule(self::MODULE_NAME, false); |
100 | 100 | $this->checkBasicStructure(); |
101 | 101 | |
102 | 102 | foreach (self::$filesToCheckWithSchema as $fileName) { |
103 | - $this->assertFileExists($modulePath . $fileName, $fileName . ' do not exists after generate module with schema'); |
|
103 | + $this->assertFileExists($modulePath.$fileName, $fileName.' do not exists after generate module with schema'); |
|
104 | 104 | } |
105 | 105 | return $modulePath; |
106 | 106 | } |
107 | 107 | |
108 | 108 | private function checkBasicStructure() |
109 | 109 | { |
110 | - $modulePath = CORE_DIR . DIRECTORY_SEPARATOR . self::MODULE_NAME; |
|
110 | + $modulePath = CORE_DIR.DIRECTORY_SEPARATOR.self::MODULE_NAME; |
|
111 | 111 | $this->assertDirectoryExists($modulePath, 'Directory not created'); |
112 | 112 | foreach (self::$filesToCheckWithoutSchema as $fileName) { |
113 | - $this->assertFileExists($modulePath . $fileName, $fileName . ' do not exists after generate module from scratch'); |
|
113 | + $this->assertFileExists($modulePath.$fileName, $fileName.' do not exists after generate module from scratch'); |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * Class DocumentorServiceTest |
10 | 10 | * @package PSFS\tests\services |
11 | 11 | */ |
12 | -class DocumentorServiceTest extends GeneratorServiceTest{ |
|
12 | +class DocumentorServiceTest extends GeneratorServiceTest { |
|
13 | 13 | |
14 | 14 | public static $namespaces = [ |
15 | 15 | '\CLIENT\Api\Test\Test', |
@@ -23,10 +23,10 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function prepareDocumentRoot() |
25 | 25 | { |
26 | - if(file_exists(CONFIG_DIR . DIRECTORY_SEPARATOR . 'domains.json')) { |
|
27 | - unlink(CONFIG_DIR . DIRECTORY_SEPARATOR . 'domains.json'); |
|
26 | + if (file_exists(CONFIG_DIR.DIRECTORY_SEPARATOR.'domains.json')) { |
|
27 | + unlink(CONFIG_DIR.DIRECTORY_SEPARATOR.'domains.json'); |
|
28 | 28 | } |
29 | - $this->assertFileDoesNotExist(CONFIG_DIR . DIRECTORY_SEPARATOR . 'domains.json', 'Previous generated domains json, please delete it before testing'); |
|
29 | + $this->assertFileDoesNotExist(CONFIG_DIR.DIRECTORY_SEPARATOR.'domains.json', 'Previous generated domains json, please delete it before testing'); |
|
30 | 30 | GeneratorHelper::deleteDir(CACHE_DIR); |
31 | 31 | $this->assertDirectoryDoesNotExist(CACHE_DIR, 'Cache folder already exists with data'); |
32 | 32 | GeneratorHelper::createRoot(WEB_DIR, null, true); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $documentorService = Service::getInstance(); |
53 | 53 | $module = $documentorService->getModules(self::MODULE_NAME); |
54 | 54 | $doc = $documentorService->extractApiEndpoints($module); |
55 | - foreach($doc as $namespace => $endpoints) { |
|
55 | + foreach ($doc as $namespace => $endpoints) { |
|
56 | 56 | $this->assertContains($namespace, self::$namespaces, 'Namespace not included in the test'); |
57 | 57 | $this->assertCount(7, $endpoints, 'Different number of endpoints'); |
58 | 58 | } |
@@ -61,7 +61,7 @@ |
||
61 | 61 | $this->assertTrue($router instanceof Router); |
62 | 62 | |
63 | 63 | // Check if route file exists |
64 | - $this->assertFileExists(CONFIG_DIR . DIRECTORY_SEPARATOR . "urls.json"); |
|
64 | + $this->assertFileExists(CONFIG_DIR.DIRECTORY_SEPARATOR."urls.json"); |
|
65 | 65 | |
66 | 66 | // CHecks if we have admin routes as minimal routes |
67 | 67 | $adminRoutes = AdminHelper::getAdminRoutes($router->getRoutes()); |
@@ -59,7 +59,7 @@ |
||
59 | 59 | Logger::log('Test debug logs', LOG_DEBUG, [], true); |
60 | 60 | // Other logs |
61 | 61 | Logger::log('Test other logs', LOG_CRON, [], true); |
62 | - } catch (\Exception $e) { |
|
62 | + }catch (\Exception $e) { |
|
63 | 63 | $this->assertFalse(true, $e->getMessage()); |
64 | 64 | } finally { |
65 | 65 | $this->assertTrue(true, 'Finished Logger test function'); |
@@ -46,28 +46,28 @@ discard block |
||
46 | 46 | $hash = sha1(microtime()); |
47 | 47 | |
48 | 48 | // TXT cache test |
49 | - $cache->storeData('tests' . DIRECTORY_SEPARATOR . $hash, json_encode($data)); |
|
50 | - $this->assertFileExists(CACHE_DIR . DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR . $hash, 'Cache not stored!!'); |
|
49 | + $cache->storeData('tests'.DIRECTORY_SEPARATOR.$hash, json_encode($data)); |
|
50 | + $this->assertFileExists(CACHE_DIR.DIRECTORY_SEPARATOR.'tests'.DIRECTORY_SEPARATOR.$hash, 'Cache not stored!!'); |
|
51 | 51 | |
52 | 52 | // Gather cache data from file without transformation |
53 | - $cachedData = $cache->readFromCache('tests' . DIRECTORY_SEPARATOR . $hash, 300, function () { |
|
53 | + $cachedData = $cache->readFromCache('tests'.DIRECTORY_SEPARATOR.$hash, 300, function() { |
|
54 | 54 | }); |
55 | 55 | $this->assertEquals($cachedData, json_encode($data), 'Different data cached!'); |
56 | 56 | |
57 | 57 | // Gather cache data from file with JSON transformation |
58 | - $cache->storeData('tests' . DIRECTORY_SEPARATOR . $hash, $data, Cache::JSONGZ); |
|
59 | - $cachedData = $cache->readFromCache('tests' . DIRECTORY_SEPARATOR . $hash, 300, function () { |
|
58 | + $cache->storeData('tests'.DIRECTORY_SEPARATOR.$hash, $data, Cache::JSONGZ); |
|
59 | + $cachedData = $cache->readFromCache('tests'.DIRECTORY_SEPARATOR.$hash, 300, function() { |
|
60 | 60 | }, Cache::JSONGZ); |
61 | 61 | $this->assertEquals($cachedData, $data, 'Error when try to gather cache with JSON transform'); |
62 | 62 | |
63 | 63 | // Gather cache data from expired file |
64 | 64 | sleep(2); |
65 | - $cachedData = $cache->readFromCache('tests' . DIRECTORY_SEPARATOR . $hash, 1, function () use ($data) { |
|
65 | + $cachedData = $cache->readFromCache('tests'.DIRECTORY_SEPARATOR.$hash, 1, function() use ($data) { |
|
66 | 66 | return $data; |
67 | 67 | }, Cache::JSONGZ); |
68 | 68 | $this->assertEquals($cachedData, $data, 'Error when try to gather cache with JSON transform'); |
69 | 69 | |
70 | - FileHelper::deleteDir(CACHE_DIR . DIRECTORY_SEPARATOR . 'test'); |
|
70 | + FileHelper::deleteDir(CACHE_DIR.DIRECTORY_SEPARATOR.'test'); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | private function prepareTestVariables(): array |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | 'cache' => 600, |
79 | 79 | 'params' => [], |
80 | 80 | 'http' => 'GET', |
81 | - 'slug' => 'test-' . $hash, |
|
81 | + 'slug' => 'test-'.$hash, |
|
82 | 82 | 'class' => 'Test', |
83 | - 'method' => 'test' . ucfirst($hash), |
|
83 | + 'method' => 'test'.ucfirst($hash), |
|
84 | 84 | 'module' => 'TEST', |
85 | 85 | ]); |
86 | 86 | |
@@ -108,14 +108,14 @@ discard block |
||
108 | 108 | |
109 | 109 | // Flushing cache |
110 | 110 | Cache::getInstance()->flushCache(); |
111 | - $this->assertDirectoryDoesNotExist(CACHE_DIR . DIRECTORY_SEPARATOR . $path, 'Cache directory not deleted properly'); |
|
111 | + $this->assertDirectoryDoesNotExist(CACHE_DIR.DIRECTORY_SEPARATOR.$path, 'Cache directory not deleted properly'); |
|
112 | 112 | |
113 | 113 | $config['cache.data.enable'] = $cache_data_config; |
114 | 114 | Config::save($config, []); |
115 | 115 | |
116 | 116 | // Cleaning test data |
117 | - FileHelper::deleteDir(CACHE_DIR . DIRECTORY_SEPARATOR . 'tests'); |
|
118 | - $this->assertDirectoryDoesNotExist(CACHE_DIR . DIRECTORY_SEPARATOR . 'tests', 'Test data directory not cleaned properly'); |
|
117 | + FileHelper::deleteDir(CACHE_DIR.DIRECTORY_SEPARATOR.'tests'); |
|
118 | + $this->assertDirectoryDoesNotExist(CACHE_DIR.DIRECTORY_SEPARATOR.'tests', 'Test data directory not cleaned properly'); |
|
119 | 119 | |
120 | 120 | } |
121 | 121 | |
@@ -127,14 +127,14 @@ discard block |
||
127 | 127 | public function testPrivileges() |
128 | 128 | { |
129 | 129 | list($path, $hash) = $this->prepareTestVariables(); |
130 | - GeneratorHelper::createDir(dirname(CACHE_DIR . DIRECTORY_SEPARATOR . $path)); |
|
131 | - GeneratorHelper::createDir(CACHE_DIR . DIRECTORY_SEPARATOR . $path); |
|
130 | + GeneratorHelper::createDir(dirname(CACHE_DIR.DIRECTORY_SEPARATOR.$path)); |
|
131 | + GeneratorHelper::createDir(CACHE_DIR.DIRECTORY_SEPARATOR.$path); |
|
132 | 132 | $cache = $this->getInstance(); |
133 | - chmod(realpath(CACHE_DIR . DIRECTORY_SEPARATOR . $path), 0600); |
|
134 | - $cache->storeData($path . $hash, json_encode('')); |
|
135 | - chmod(realpath(CACHE_DIR . DIRECTORY_SEPARATOR . $path), 0777); |
|
136 | - FileHelper::deleteDir(CACHE_DIR . DIRECTORY_SEPARATOR . $path); |
|
137 | - chmod(realpath(CACHE_DIR . DIRECTORY_SEPARATOR . 'TEST'), 0777); |
|
138 | - FileHelper::deleteDir(CACHE_DIR . DIRECTORY_SEPARATOR . 'TEST'); |
|
133 | + chmod(realpath(CACHE_DIR.DIRECTORY_SEPARATOR.$path), 0600); |
|
134 | + $cache->storeData($path.$hash, json_encode('')); |
|
135 | + chmod(realpath(CACHE_DIR.DIRECTORY_SEPARATOR.$path), 0777); |
|
136 | + FileHelper::deleteDir(CACHE_DIR.DIRECTORY_SEPARATOR.$path); |
|
137 | + chmod(realpath(CACHE_DIR.DIRECTORY_SEPARATOR.'TEST'), 0777); |
|
138 | + FileHelper::deleteDir(CACHE_DIR.DIRECTORY_SEPARATOR.'TEST'); |
|
139 | 139 | } |
140 | 140 | } |
141 | 141 | \ No newline at end of file |