diff --git a/.github/dev_bug_report.md b/.github/dev_bug_report.md deleted file mode 100755 index ef93e56..0000000 --- a/.github/dev_bug_report.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -name: Dev Bug Report -about: Create a report to help us improve -title: '' -labels: stat_backlog, type_bug -assignees: '' - ---- - -# Bug Description -A clear and concise description of what the bug is. - -# How to Reproduce - -Steps to reproduce the behavior: - -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -## Minimal Code Example - -``` -// your code ... -``` - -# Expected Behavior -A clear and concise description of what you expected to happen. - -# Screenshots -If applicable, add screenshots to help explain your problem. - -# Additional Information -Add any other context about the problem here. diff --git a/.github/dev_feature_request.md b/.github/dev_feature_request.md deleted file mode 100755 index 9573c35..0000000 --- a/.github/dev_feature_request.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Dev Feature Request -about: Suggest an idea for this project -title: '' -labels: stat_backlog, type_feature -assignees: '' - ---- - -# What is the feature you request -* A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -* A clear and concise description of what you want to happen. - -# Alternatives -A clear and concise description of any alternative solutions or features you've considered. - -# Additional Information -Add any other context or screenshots about the feature request here. diff --git a/.github/user_bug_report.md b/.github/user_bug_report.md deleted file mode 100755 index 4b92a8e..0000000 --- a/.github/user_bug_report.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -name: User Bug Report -about: Create a report to help us improve -title: '' -labels: stat_backlog, type_bug -assignees: '' - ---- - -# Bug Description - -A clear and concise description of what the bug is. - -# How to Reproduce - -Steps to reproduce the behavior: - -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -# Expected Behavior - -A clear and concise description of what you expected to happen. - -# Screenshots - -If applicable, add screenshots to help explain your problem. - -# System Information - -- System: [e.g. PC or iPhone11, ...] -- OS: [e.g. iOS] -- Browser [e.g. chrome, safari] -- KarakaVersion [e.g. 22] - -# Additional Information - -Add any other context about the problem here. diff --git a/.github/user_feature_request.md b/.github/user_feature_request.md deleted file mode 100755 index c9595e8..0000000 --- a/.github/user_feature_request.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -name: User Feature Request -about: Suggest an idea for this project -title: '' -labels: stat_backlog, type_feature -assignees: '' - ---- - -# What is the feature you request - -* A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -* A clear and concise description of what you want to happen. - -# Alternatives - -A clear and concise description of any alternative solutions or features you've considered. - -# Additional Information - -Add any other context or screenshots about the feature request here. diff --git a/Admin/Routes/Web/Api.php b/Admin/Routes/Web/Api.php index 1fd9922..b55d5c9 100755 --- a/Admin/Routes/Web/Api.php +++ b/Admin/Routes/Web/Api.php @@ -20,7 +20,7 @@ use phpOMS\Router\RouteVerb; return [ '^.*/search(\?.*|$)' => [ [ - 'dest' => '\Modules\Search\Controller\ApiController:routeSearch', + 'dest' => '\Modules\Search\Controller\ApiController:search', 'verb' => RouteVerb::ANY, 'permission' => [ 'module' => ApiController::NAME, diff --git a/Admin/Routes/Web/Backend.php b/Admin/Routes/Web/Backend.php index 9c9cc0d..c128272 100755 --- a/Admin/Routes/Web/Backend.php +++ b/Admin/Routes/Web/Backend.php @@ -12,4 +12,21 @@ */ declare(strict_types=1); -return []; +use Modules\Search\Controller\BackendController; +use Modules\Search\Models\PermissionCategory; +use phpOMS\Account\PermissionType; +use phpOMS\Router\RouteVerb; + +return [ + '^.*/search(\?.*|$)' => [ + [ + 'dest' => '\Modules\Search\Controller\BackendController:search', + 'verb' => RouteVerb::ANY, + 'permission' => [ + 'module' => BackendController::NAME, + 'type' => PermissionType::READ, + 'state' => PermissionCategory::SEARCH, + ], + ], + ], +]; diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md deleted file mode 100755 index 1b14538..0000000 --- a/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,46 +0,0 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. - -## Our Standards - -Examples of behavior that contributes to creating a positive environment include: - -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery and unwelcome sexual attention or advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a professional setting - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. - -## Scope - -This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at spl1nes.com@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. - -Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] - -[homepage]: http://contributor-covenant.org -[version]: http://contributor-covenant.org/version/1/4/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100755 index e237dc9..0000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,82 +0,0 @@ -# Development - -## Development environment - - The setup and configuration of the development environment is in the hands of every developer themselves. However, it is recommended to follow the setup instructions in the [Developer-Guide](https://github.com/Karaka-Management/Developer-Guide/blob/develop/general/setup.md). - -## Code of conduct - -Every organization member and contributor to the organization must follow the [code of conduct](../Policies & Guidelines/Code of conduct.md). - -## Code changes - -### Topics / Tasks / Todos - -Generally, the development philosophy is result orientated. This means that anyone can propose tasks, pick up existing tasks or right away implement their code changes. However, implementing code changes without consulting with a senior developer in advance has a much higher risk of code changes not getting admitted. The easiest way to discuss a code change idea in advance are the github [issues](https://github.com/Karaka-Management/Karaka/issues) or [discussions](https://github.com/Karaka-Management/Karaka/discussions). - -Developers are encouraged to pick open tasks with high priorities according to their own skill level. Senior developers may directly assign tasks to developers based on their importance. New developers may find it easier to start with a task that has a low priority as they often also have a lower difficulty. - -Open tasks can be found in the project overview: [PROJECT.md](https://github.com/Karaka-Management/Organization-Guide/blob/master/Project/PROJECT.md) - -Tasks currently in development are prefixed in the priority column with an asterisk `*` and a name tag in the task description of the developer who is working on the task. - -The open tasks are reviewed once a month by a senior developer. The senior developer updates the project overview if necessary and requests feedback regarding development status of important tasks under development. During this process important tasks may also get directly assigned to developers. This review is performed on a judgmental bases of the senior basis. - -### Code style - -Code changes must follow the [style guidelines](https://github.com/Karaka-Management/Developer-Guide/tree/develop/standards). Additionally, the automatic code style inspection tools must return no errors, failures or warnings. Developers should test their changes with inspection tools and configurations mentioned in the [inspection documentation](https://github.com/Karaka-Management/Developer-Guide/blob/develop/quality/inspections.md) in advance before submitting them for review. - -In rare cases errors, failures or warnings during the automatic inspection are acceptable. Reasons can be changes in the programming language, special cases which cannot, are difficult or must be individually configured in the inspection settings. If this is the case for a code change and if inspection configuration changes are necessary are decided by the senior developer performing the code review. - -Automated checks which are run during the review process: - -```sh -php ./vendor/bin/phpcs --severity=1 ./ --standard="Build/Config/phpcs.xml" -npx eslint ./ -c ./Build/Config/.eslintrc.json -``` - -### Tests - -Code changes must follow the inspection guidelines (i.e. code coverage) mentioned in the [inspection documentation](https://github.com/Karaka-Management/Developer-Guide/blob/develop/quality/inspections.md). Developers should check if the code changes comply with the inspection guidelines before submitting them. - -In rare cases it might be not possible to follow the inspection guidelines. In such cases the senior developer performing the code review may decide if the code change still gets accepted. - -Automated tests which are run during the review process: - -```sh -php ./vendor/bin/phpunit -c tests/PHPUnit/phpunit_default.xml -php ./vendor/bin/phpstan analyse --autoload-file=phpOMS/Autoloader.php -l 9 -c Build/Config/phpstan.neon ./ -npx jasmine-node ./ -./cOMS/tests/test.sh -``` - -Additional inspections which are run but might be ignored during the review depending on the use case are mentioned in the [inspection documentation](https://github.com/Karaka-Management/Developer-Guide/blob/develop/quality/inspections.md) as other checks. - -### Demo - -Some code changes may also require changes or extensions in the demo setup scripts. The demo setup script try to simulate a real world use case by generating and modifying mostly random data. This is also a good way to setup and “manually” test the code changes in a larger picture. The demo setup script can be found in the [demoSetup](https://github.com/Karaka-Management/demoSetup) repository. The demo setup script takes a long time due to the large amount of user input simulated data which is generated. Therefore it is recommended to run this only sporadically. - -### Code review - -In addition to the automatic code review performed by the various inspection tools such as (phpcs, phpstan, phpunit, eslint and custom scripts) a senior developer must check the proposed code change before it is merged with the respective `develop` branch. Only upon the approval by the reviewer a code change requests gets merged as no other developers have permission in the software to make such code merges. - -In case a code change request is not approved the reviewer states the reason for the decision, this may include some tips and requests which will allow the contributor to make improvements so that the code change may get approved. - -If the code reviewer only finds minor issues with the proposed code change the reviewer may make small changes to the proposed code change and inform the contributor to speed up the implementation process. Code reviewers are encouraged to do this with new contributors to avoid long iteration processes and to not discourage new developers. However, communication is key and severe issues with code change requests or if the contributor already made multiple code change requests in the past the reviewer should not implement the improvements by himself and rather decline the code change requests with his reasoning. - -### Release flow - -Code changes must be performed in a new branch. A new branch can be created with: - -```sh -git checkout -b new-branch-name -``` - -The name of the branch can be chosen freely however it is recommended to follow the following branch naming conventions: - -* `feature-*` for feature implementations -* `bug-*` for bug fixes -* `security-*` for security related fixes/improvements -* `general-*` for general improvements (i.e. code documentation improvements, code style improvements) - -The senior developer who performs the code review merges the change request into the `develop` branch upon approval. \ No newline at end of file diff --git a/Controller/ApiController.php b/Controller/ApiController.php index aa97d35..e4cbc4f 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -29,8 +29,6 @@ use phpOMS\Router\WebRouter; */ final class ApiController extends Controller { - private $router = null; - /** * {@inheritdoc} */ @@ -55,22 +53,11 @@ final class ApiController extends Controller * * @since 1.0.0 */ - public function routeSearch(HttpRequest $request, ResponseAbstract $response, mixed $data = null) : void + public function search(HttpRequest $request, ResponseAbstract $response, mixed $data = null) : void { - $this->app->dispatcher->dispatch( - $this->router->route( - $request->getDataString('search') ?? '', - $request->getDataString('CSRF'), - $request->getRouteVerb(), - $this->app->appId, - $this->app->unitId, - $this->app->accountManager->get($request->header->account) - ), - $request, - $response - ); + $data = $this->routeSearch($request, $response, $data); - if (empty($response->data)) { + if (empty($data)) { $this->fillJsonRawResponse($request, $response, []); } } diff --git a/Controller/BackendController.php b/Controller/BackendController.php new file mode 100644 index 0000000..fabddb7 --- /dev/null +++ b/Controller/BackendController.php @@ -0,0 +1,75 @@ +router = new WebRouter(); + $this->router->importFromFile(__DIR__ . '/../Admin/SearchCommands.php'); + } + + /** + * Backend method to handle basic search request + * + * @param RequestAbstract $request Request + * @param ResponseAbstract $response Response + * @param array $data Generic data + * + * @return RenderableInterface + * + * @api + * + * @since 1.0.0 + */ + public function search(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface + { + $view = new View($this->app->l11nManager, $request, $response); + $view->setTemplate('/Modules/Search/Theme/Backend/search-result'); + + $internalRequest = clone $request; + $internalResponse = clone $response; + + $internalResponse->header = clone $request->header; + + $internalResponse->data = []; + + $temp = empty($request->getDataString('search')) ? [] : $this->routeSearch($internalRequest, $internalResponse, $data); + $view->data = empty($temp) ? [] : \reset($temp); + + return $view; + } +} diff --git a/Controller/Controller.php b/Controller/Controller.php index e76a02b..1c7581e 100755 --- a/Controller/Controller.php +++ b/Controller/Controller.php @@ -15,7 +15,10 @@ declare(strict_types=1); namespace Modules\Search\Controller; use Modules\Search\Models\Search; +use phpOMS\Message\Http\HttpRequest; +use phpOMS\Message\ResponseAbstract; use phpOMS\Module\ModuleAbstract; +use phpOMS\Router\RouterInterface; /** * Search class. @@ -75,4 +78,41 @@ class Controller extends ModuleAbstract * @since 1.0.0 */ public static array $dependencies = []; + + protected ?RouterInterface $router = null; + + /** + * Api method to handle basic search request + * + * @param HttpRequest $request Request + * @param ResponseAbstract $response Response + * @param array $data Generic data + * + * @return array + * + * @api + * + * @since 1.0.0 + */ + public function routeSearch(HttpRequest $request, ResponseAbstract $response, mixed $data = null) : array + { + if ($this->router === null) { + return []; + } + + $this->app->dispatcher->dispatch( + $this->router->route( + $request->getDataString('search') ?? '', + $request->getDataString('CSRF'), + $request->getRouteVerb(), + $this->app->appId, + $this->app->unitId, + $this->app->accountManager->get($request->header->account) + ), + $request, + $response + ); + + return $response->data; + } } diff --git a/ICAL.txt b/ICAL.txt index 019045f..f1b55ed 100755 --- a/ICAL.txt +++ b/ICAL.txt @@ -1,6 +1,6 @@ # Individual Contributor License Agreement ("CLA") 1.0 -Thank you for your interest in Karaka-Management (the "Company"). In order to clarify the intellectual property license granted with Contributions from any person or entity, the Company must provide a Contributor License Agreement ("CLA") on file that has been made available to each Contributor. This license is for your protection as a Contributor as well as the protection of the Company and its users; it does not change your rights to use your own Contributions for any other purpose. +Thank you for your interest in Jingga e. K. (the "Company"). In order to clarify the intellectual property license granted with Contributions from any person or entity, the Company must provide a Contributor License Agreement ("CLA") on file that has been made available to each Contributor. This license is for your protection as a Contributor as well as the protection of the Company and its users; it does not change your rights to use your own Contributions for any other purpose. By contributing to the Company You accept and agree to the following terms and conditions for Your present and future Contributions submitted to the Company. In return, the Company shall not use Your Contributions in a way that is contrary to the public benefit or inconsistent with its bylaws in effect at the time of the Contribution. Except for the license granted herein to the Company and recipients of software distributed by the Company, You reserve all right, title, and interest in and to Your Contributions. diff --git a/LICENSE.txt b/LICENSE.txt index 18d430e..4ba0161 100755 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -27,7 +27,7 @@ Version 2.0 Subject to the terms and conditions of this License, each Contributor grants to You after purchase a perpetual, worldwide, non-exclusive, irrevocable copyright license to prepare Derivative Works of, publicly display, publicly perform the Work and such Derivative Works in Source or Object form. You are not allowed to sublicense, reproduce, or distribute the Work and such Derivative Works in Source or Object form. -3. Redistribution. +3. Redistribution You may not reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form. diff --git a/Models/PermissionCategory.php b/Models/PermissionCategory.php index 2b3ba1b..f0fd57e 100755 --- a/Models/PermissionCategory.php +++ b/Models/PermissionCategory.php @@ -17,7 +17,7 @@ namespace Modules\Search\Models; use phpOMS\Stdlib\Base\Enum; /** - * Permision state enum. + * Permission category enum. * * @package Modules\Search\Models * @license OMS License 2.0 diff --git a/README.md b/README.md index af4f138..4cb40c2 100755 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ Currently Karaka is still developing the first Alpha version. As soon as we have General updates can be found in our info section at https://jingga.app/info and developer updates can be found in our developer section at https://jingga.app/dev. In our developer section you can also check out the automatically generated reports such as code coverage, code style, static analysis etc. as well as our code style guide lines and developer documentation. -* [Project Status](https://github.com/Karaka-Management/Organization-Guide/blob/master/Project/PROJECT.md) +* [Project Status](https://github.com/orgs/Karaka-Management/projects/10) ## Tech stack @@ -62,7 +62,7 @@ General updates can be found in our info section at https://jingga.app/info and ## Become a contributor -Karaka has a very open culture and we always welcome new people who share our philosophy in providing create solutions which just work. You can find the development process description which also describes how to become a contributer in the [Organization documentation](https://github.com/Karaka-Management/Organization-Guide/blob/master/Processes/Development.md). +Karaka has a very open culture and we always welcome new people who share our philosophy in providing create solutions which just work. You can find the development process description which also describes how to become a contributer in the [Organization documentation](https://github.com/Karaka-Management/Organization-Guide/blob/master/Processes/01_Development.md). ## Misc diff --git a/Theme/Backend/Lang/de.lang.php b/Theme/Backend/Lang/de.lang.php new file mode 100644 index 0000000..63aa0b6 --- /dev/null +++ b/Theme/Backend/Lang/de.lang.php @@ -0,0 +1,17 @@ + [ + 'NoResults' => 'Keine Surchergebnisse', +]]; diff --git a/Theme/Backend/Lang/en.lang.php b/Theme/Backend/Lang/en.lang.php new file mode 100644 index 0000000..ac13327 --- /dev/null +++ b/Theme/Backend/Lang/en.lang.php @@ -0,0 +1,17 @@ + [ + 'NoResults' => 'No search results', +]]; diff --git a/Theme/Backend/search-result.tpl.php b/Theme/Backend/search-result.tpl.php new file mode 100644 index 0000000..abafdc2 --- /dev/null +++ b/Theme/Backend/search-result.tpl.php @@ -0,0 +1,108 @@ + +data as $controller) : + if (empty($controller)) { + continue; + } + + $first = \reset($controller); +?> +
+
+

+
+
+ +
+
+
+ + + +
+ + printHtml(\trim($data['title'])); ?> + + + + + + icon) ? '' : '' . $this->printHtml($tag->icon) . ''; ?> + printHtml($tag->getL11n()); ?> + + + + +
+
+
+
+ +
+ +
+
+ +
+
+ +
printHtml($data['email']); ?> +
printHtml($data['phone']); ?> +
printHtml($data['city']); ?> +
+
+
+
+
+ +
+ + + + +
+
+
+
getHtml('NoResults'); ?>
+
+
+
+ \ No newline at end of file diff --git a/tests/Autoloader.php b/tests/Autoloader.php index ac516a8..1ff89a2 100755 --- a/tests/Autoloader.php +++ b/tests/Autoloader.php @@ -75,8 +75,8 @@ final class Autoloader */ public static function defaultAutoloader(string $class) : void { - $class = \ltrim($class, '\\'); - $class = \strtr($class, '_\\', '//'); + $class = \ltrim($class, '\\'); + $class = \strtr($class, '_\\', '//'); if (\stripos($class, 'Web/Backend') !== false || \stripos($class, 'Web/Api') !== false) { $class = \is_dir(__DIR__ . '/Web') ? $class : \str_replace('Web/', 'MainRepository/Web/', $class); diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index ddc049d..3e10b9e 100755 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -1,4 +1,15 @@ [ + 'db' => [ 'core' => [ 'masters' => [ - 'admin' => [ + 'admin' => [ 'db' => 'mysql', /* db type */ 'host' => '127.0.0.1', /* db host address */ 'port' => '3306', /* db host port */ @@ -80,7 +91,7 @@ $CONFIG = [ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'insert' => [ + 'insert' => [ 'db' => 'mysql', /* db type */ 'host' => '127.0.0.1', /* db host address */ 'port' => '3306', /* db host port */ @@ -90,7 +101,7 @@ $CONFIG = [ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'select' => [ + 'select' => [ 'db' => 'mysql', /* db type */ 'host' => '127.0.0.1', /* db host address */ 'port' => '3306', /* db host port */ @@ -100,7 +111,7 @@ $CONFIG = [ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'update' => [ + 'update' => [ 'db' => 'mysql', /* db type */ 'host' => '127.0.0.1', /* db host address */ 'port' => '3306', /* db host port */ @@ -110,7 +121,7 @@ $CONFIG = [ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'delete' => [ + 'delete' => [ 'db' => 'mysql', /* db type */ 'host' => '127.0.0.1', /* db host address */ 'port' => '3306', /* db host port */ @@ -120,7 +131,7 @@ $CONFIG = [ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'schema' => [ + 'schema' => [ 'db' => 'mysql', /* db type */ 'host' => '127.0.0.1', /* db host address */ 'port' => '3306', /* db host port */ @@ -132,7 +143,7 @@ $CONFIG = [ ], ], 'postgresql' => [ - 'admin' => [ + 'admin' => [ 'db' => 'pgsql', /* db type */ 'host' => '127.0.0.1', /* db host address */ 'port' => '5432', /* db host port */ @@ -142,7 +153,7 @@ $CONFIG = [ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'insert' => [ + 'insert' => [ 'db' => 'pgsql', /* db type */ 'host' => '127.0.0.1', /* db host address */ 'port' => '5432', /* db host port */ @@ -152,7 +163,7 @@ $CONFIG = [ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'select' => [ + 'select' => [ 'db' => 'pgsql', /* db type */ 'host' => '127.0.0.1', /* db host address */ 'port' => '5432', /* db host port */ @@ -162,7 +173,7 @@ $CONFIG = [ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'update' => [ + 'update' => [ 'db' => 'pgsql', /* db type */ 'host' => '127.0.0.1', /* db host address */ 'port' => '5432', /* db host port */ @@ -172,7 +183,7 @@ $CONFIG = [ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'delete' => [ + 'delete' => [ 'db' => 'pgsql', /* db type */ 'host' => '127.0.0.1', /* db host address */ 'port' => '5432', /* db host port */ @@ -182,7 +193,7 @@ $CONFIG = [ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'schema' => [ + 'schema' => [ 'db' => 'pgsql', /* db type */ 'host' => '127.0.0.1', /* db host address */ 'port' => '5432', /* db host port */ @@ -194,37 +205,37 @@ $CONFIG = [ ], ], 'sqlite' => [ - 'admin' => [ + 'admin' => [ 'db' => 'sqlite', /* db type */ 'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'insert' => [ + 'insert' => [ 'db' => 'sqlite', /* db type */ 'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'select' => [ + 'select' => [ 'db' => 'sqlite', /* db type */ 'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'update' => [ + 'update' => [ 'db' => 'sqlite', /* db type */ 'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'delete' => [ + 'delete' => [ 'db' => 'sqlite', /* db type */ 'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'schema' => [ + 'schema' => [ 'db' => 'sqlite', /* db type */ 'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */ 'weight' => 1000, /* db table prefix */ @@ -232,7 +243,7 @@ $CONFIG = [ ], ], 'mssql' => [ - 'admin' => [ + 'admin' => [ 'db' => 'mssql', /* db type */ 'host' => '127.0.0.1', /* db host address */ 'port' => '1433', /* db host port */ @@ -242,7 +253,7 @@ $CONFIG = [ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'insert' => [ + 'insert' => [ 'db' => 'mssql', /* db type */ 'host' => '127.0.0.1', /* db host address */ 'port' => '1433', /* db host port */ @@ -252,7 +263,7 @@ $CONFIG = [ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'select' => [ + 'select' => [ 'db' => 'mssql', /* db type */ 'host' => '127.0.0.1', /* db host address */ 'port' => '1433', /* db host port */ @@ -262,7 +273,7 @@ $CONFIG = [ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'update' => [ + 'update' => [ 'db' => 'mssql', /* db type */ 'host' => '127.0.0.1', /* db host address */ 'port' => '1433', /* db host port */ @@ -272,7 +283,7 @@ $CONFIG = [ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'delete' => [ + 'delete' => [ 'db' => 'mssql', /* db type */ 'host' => '127.0.0.1', /* db host address */ 'port' => '1433', /* db host port */ @@ -282,7 +293,7 @@ $CONFIG = [ 'weight' => 1000, /* db table prefix */ 'datetimeformat' => 'Y-m-d H:i:s', ], - 'schema' => [ + 'schema' => [ 'db' => 'mssql', /* db type */ 'host' => '127.0.0.1', /* db host address */ 'port' => '1433', /* db host port */ @@ -322,16 +333,16 @@ $CONFIG = [ 'password' => '123456', ], ], - 'log' => [ + 'log' => [ 'file' => [ 'path' => __DIR__ . '/Logs', ], ], - 'page' => [ + 'page' => [ 'root' => '/', 'https' => false, ], - 'app' => [ + 'app' => [ 'path' => __DIR__, 'default' => [ 'app' => 'Backend', @@ -350,7 +361,7 @@ $CONFIG = [ ], ], ], - 'socket' => [ + 'socket' => [ 'master' => [ 'host' => '127.0.0.1', 'limit' => 300, @@ -360,7 +371,7 @@ $CONFIG = [ 'language' => [ 'en', ], - 'apis' => [ + 'apis' => [ ], ]; diff --git a/tests/Controller/ApiControllerTest.php b/tests/Controller/ApiControllerTest.php index 74e7217..412a82f 100755 --- a/tests/Controller/ApiControllerTest.php +++ b/tests/Controller/ApiControllerTest.php @@ -29,7 +29,6 @@ use phpOMS\Message\Http\HttpResponse; use phpOMS\Module\ModuleAbstract; use phpOMS\Module\ModuleManager; use phpOMS\Router\WebRouter; -use phpOMS\Uri\HttpUri; use phpOMS\Utils\TestUtils; /** @@ -102,7 +101,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase self::assertGreaterThan(0, \count($searchRoutes)); $response = new HttpResponse(); - $request = new HttpRequest(new HttpUri('')); + $request = new HttpRequest(); $request->header->account = 1; $request->setData('search', ':help introduction');