* [ADD] Test API module without using a real sysPass instance.

* [MOD] Improve module loading.
* [MOD] Improve backup file regex.
* [MOD] Minor code tweaks.

Signed-off-by: Rubén D <nuxsmin@syspass.org>
This commit is contained in:
Rubén D
2021-10-17 16:26:39 +02:00
parent 58249da565
commit ebe58282f6
66 changed files with 3076 additions and 2228 deletions

View File

@@ -24,15 +24,12 @@
namespace SP\Modules\Api\Controllers;
use DI\DependencyException;
use DI\NotFoundException;
use Exception;
use League\Fractal\Resource\Item;
use SP\Adapters\CategoryAdapter;
use SP\Core\Acl\ActionsInterface;
use SP\Core\Events\Event;
use SP\Core\Events\EventMessage;
use SP\Core\Exceptions\InvalidClassException;
use SP\DataModel\CategoryData;
use SP\DataModel\ItemSearchData;
use SP\Modules\Api\Controllers\Help\CategoryHelp;
@@ -64,8 +61,6 @@ final class CategoryController extends ControllerBase
$id = $this->apiService->getParamInt('id', true);
$customFields = Util::boolval($this->apiService->getParamString('customFields'));
$adapter = new CategoryAdapter($this->configData);
$categoryData = $this->categoryService->getById($id);
$this->eventDispatcher->notifyEvent(
@@ -80,8 +75,10 @@ final class CategoryController extends ControllerBase
);
$out = $this->fractal
->createData(
new Item($categoryData, new CategoryAdapter($this->configData)));
->createData(new Item(
$categoryData,
new CategoryAdapter($this->configData)
));
if ($customFields) {
$this->apiService->requireMasterPass();
@@ -112,6 +109,8 @@ final class CategoryController extends ControllerBase
$id = $this->categoryService->create($categoryData);
$categoryData->setId($id);
$this->eventDispatcher->notifyEvent(
'create.category',
new Event(
@@ -245,9 +244,7 @@ final class CategoryController extends ControllerBase
/**
* initialize
*
* @throws DependencyException
* @throws NotFoundException
* @throws InvalidClassException
* @throws \SP\Core\Exceptions\InvalidClassException
*/
protected function initialize(): void
{