diff --git a/Backend/design/html/campaign_edit.tpl b/Backend/design/html/campaign_edit.tpl index 0fc0b33..c3f1ad6 100644 --- a/Backend/design/html/campaign_edit.tpl +++ b/Backend/design/html/campaign_edit.tpl @@ -19,7 +19,7 @@ {$btr->general_open|escape} {/if} - + {include file='svg_icon.tpl' svgId='return'} {$btr->general_back|escape} diff --git a/Init/module.json b/Init/module.json index 3fba734..b49f80b 100644 --- a/Init/module.json +++ b/Init/module.json @@ -1,6 +1,6 @@ { "Okay": "4.5.3", - "version": "2.2.1", + "version": "2.2.2", "moduleName": "Promo: акції та знижки", "vendor": { "email": "devsviat@proton.me", diff --git a/tests/BackendLinksControllerTest.php b/tests/BackendLinksControllerTest.php new file mode 100644 index 0000000..64149c0 --- /dev/null +++ b/tests/BackendLinksControllerTest.php @@ -0,0 +1,44 @@ +getFileName(), 2) . '/design/html'; + $templates = glob($designDir . '/*.tpl') ?: []; + self::assertNotSame([], $templates); + + $unresolved = []; + foreach ($templates as $template) { + preg_match_all('/\{url\b[^}]*\bcontroller=([^\s}]+)/', (string) file_get_contents($template), $matches); + foreach ($matches[1] as $controller) { + if (!$this->resolves(trim($controller, '\'"'))) { + $unresolved[] = basename($template) . ': ' . $controller; + } + } + } + + self::assertSame([], $unresolved); + } + + private function resolves(string $controller): bool + { + if (preg_match('/^\[(\w+),\s*(\w+),\s*(\w+)\]$/', $controller, $parts) + || preg_match('/^(\w+)\.(\w+)\.(\w+)$/', $controller, $parts)) { + return class_exists("Okay\\Modules\\{$parts[1]}\\{$parts[2]}\\Backend\\Controllers\\{$parts[3]}"); + } + + return class_exists("Okay\\Admin\\Controllers\\{$controller}"); + } +}