Skip to content
Open

Dev #171

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ jobs:
export PHPLIST_DATABASE_PASSWORD=${{ env.DB_PASSWORD }}
export PHPLIST_DATABASE_PORT=${{ job.services.mysql.ports['3306'] }}
export PHPLIST_DATABASE_HOST=127.0.0.1
export PHPLIST_DATABASE_PATH=
vendor/bin/phpunit tests/Integration/
continue-on-error: ${{matrix.php-versions == '8.0' }} # [temp-php8]
- name: Running static analysis
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/client-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:

jobs:
generate-openapi:
if: (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'dev')) || (github.event_name == 'pull_request' && github.base_ref == 'main')
runs-on: ubuntu-22.04
outputs:
source_branch: ${{ steps.branch.outputs.source_branch }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/front-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ on:
- main
jobs:
generate-openapi:
if: (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'dev')) || (github.event_name == 'pull_request' && github.base_ref == 'main')
runs-on: ubuntu-22.04
outputs:
source_branch: ${{ steps.branch.outputs.source_branch }}
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@
/var/
/vendor/
.phpunit.result.cache
.env
.env.dist
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
},
"require": {
"php": "^8.1",
"phplist/core": "dev-main",
"phplist/core": "dev-dev",
Comment thread
TatevikGr marked this conversation as resolved.
"elasticsearch/elasticsearch": "^8.9",
"friendsofsymfony/rest-bundle": "*",
"symfony/test-pack": "^1.0",
"symfony/process": "^6.4",
Expand All @@ -57,7 +58,7 @@
"phpunit/phpunit": "^10.0",
"guzzlehttp/guzzle": "^7.2.0",
"squizlabs/php_codesniffer": "^3.2.0",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan": "^2.2",
"nette/caching": "^3.0.0",
"nikic/php-parser": "^4.19.1",
"phpmd/phpmd": "^2.6.0",
Expand Down Expand Up @@ -85,6 +86,7 @@
"PhpList\\Core\\Composer\\ScriptHandler::createGeneralConfiguration",
"PhpList\\Core\\Composer\\ScriptHandler::createBundleConfiguration",
"PhpList\\Core\\Composer\\ScriptHandler::createRoutesConfiguration",
"PhpList\\Core\\Composer\\ScriptHandler::createDotenvConfiguration",
"PhpList\\Core\\Composer\\ScriptHandler::createParametersConfiguration",
"PhpList\\Core\\Composer\\ScriptHandler::clearAllCaches"
],
Expand Down
2 changes: 1 addition & 1 deletion config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ services:
calls:
- ['registerHandler', [ 'json', ['@my.secure_handler', 'createResponse'] ] ]

PhpList\Core\Security\Authentication:
PhpList\Core\Domain\Identity\Service\Authentication:
autowire: true
autoconfigure: true

Expand Down
4 changes: 2 additions & 2 deletions config/services/messenger_handlers.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
services:
PhpList\Core\Domain\Messaging\MessageHandler\CampaignProcessor\CampaignProcessorMessageHandler:
PhpList\Core\Domain\Messaging\MessageHandler\CampaignProcessorMessageHandler:
autowire: true
autoconfigure: true
public: false

PhpList\Core\Domain\Messaging\MessageHandler\CampaignProcessor\TestCampaignProcessorMessageHandler:
PhpList\Core\Domain\Messaging\MessageHandler\CampaignProcessorTestMessageHandler:
autowire: true
autoconfigure: true
public: false
3 changes: 2 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.2/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="vendor/autoload.php"
bootstrap="tests/bootstrap.php"
>
<php>
<ini name="error_reporting" value="-1"/>
<server name="KERNEL_CLASS" value="PhpList\Core\Core\ApplicationKernel"/>
<server name="APP_ENV" value="test" force="true"/>
</php>
</phpunit>
4 changes: 2 additions & 2 deletions src/Common/Controller/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
namespace PhpList\RestBundle\Common\Controller;

use PhpList\Core\Domain\Identity\Model\Administrator;
use PhpList\Core\Security\Authentication;
use PhpList\Core\Domain\Identity\Service\Authentication;
use PhpList\RestBundle\Common\Validator\RequestValidator;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;

/** @SuppressWarnings(PHPMD.NumberOfChildren) */
/** @SuppressWarnings("PHPMD.NumberOfChildren") */
abstract class BaseController extends AbstractController
{
protected Authentication $authentication;
Expand Down
4 changes: 2 additions & 2 deletions src/Common/EventListener/ExceptionListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use PhpList\Core\Domain\Messaging\Exception\AttachmentFileNotFoundException;
use PhpList\Core\Domain\Messaging\Exception\MessageNotReceivedException;
use PhpList\Core\Domain\Messaging\Exception\SubscriberNotFoundException;
use PhpList\Core\Domain\Subscription\Exception\AttributeDefinitionCreationException;
use PhpList\Core\Domain\Common\Exception\AttributeDefinitionCreationException;
use PhpList\Core\Domain\Subscription\Exception\SubscriptionCreationException;
use PhpList\Core\Domain\Common\Exception\InvalidUploadException;
use PhpList\Core\Domain\Common\Exception\MissingUploadException;
Expand Down Expand Up @@ -57,7 +57,7 @@ public function onKernelException(ExceptionEvent $event): void
new JsonResponse([
'message' => 'Validation failed',
'errors' => $this->parseFlatValidationMessage($exception->getMessage()),
], 422)
], 422)
);

return;
Expand Down
14 changes: 12 additions & 2 deletions src/Common/Serializer/CursorPaginationNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class CursorPaginationNormalizer implements NormalizerInterface
{
/**
* @param CursorPaginationResult $object
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function normalize($object, string $format = null, array $context = []): array
{
Expand All @@ -32,10 +32,20 @@ public function normalize($object, string $format = null, array $context = []):
}

/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function supportsNormalization($data, string $format = null): bool
{
return $data instanceof CursorPaginationResult;
}

/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function getSupportedTypes(?string $format): array
{
return [
CursorPaginationResult::class => true,
];
}
}
2 changes: 1 addition & 1 deletion src/Configuration/Controller/ConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use PhpList\Core\Domain\Configuration\Model\Config;
use PhpList\Core\Domain\Configuration\Service\Manager\ConfigManager;
use PhpList\Core\Domain\Identity\Model\PrivilegeFlag;
use PhpList\Core\Security\Authentication;
use PhpList\Core\Domain\Identity\Service\Authentication;
use PhpList\RestBundle\Common\Controller\BaseController;
use PhpList\RestBundle\Common\Validator\RequestValidator;
use PhpList\RestBundle\Configuration\Request\CreateConfigRequest;
Expand Down
14 changes: 12 additions & 2 deletions src/Configuration/Serializer/ConfigNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ConfigNormalizer implements NormalizerInterface
/**
* Normalizes a configuration item.
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function normalize($object, string $format = null, array $context = []): array
{
Expand All @@ -42,10 +42,20 @@ public function normalize($object, string $format = null, array $context = []):
/**
* Checks whether the value can be normalized.
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function supportsNormalization($data, string $format = null): bool
{
return $data instanceof Config;
}

/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function getSupportedTypes(?string $format): array
{
return [
Config::class => true,
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use PhpList\Core\Domain\Common\Model\Filter\PaginatedFilter;
use PhpList\Core\Domain\Identity\Model\AdminAttributeDefinition;
use PhpList\Core\Domain\Identity\Service\Manager\AdminAttributeDefinitionManager;
use PhpList\Core\Security\Authentication;
use PhpList\Core\Domain\Identity\Service\Authentication;
use PhpList\RestBundle\Common\Controller\BaseController;
use PhpList\RestBundle\Common\Service\Provider\PaginatedDataProvider;
use PhpList\RestBundle\Common\Validator\RequestValidator;
Expand Down
2 changes: 1 addition & 1 deletion src/Identity/Controller/AdminAttributeValueController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use PhpList\Core\Domain\Identity\Model\AdminAttributeDefinition;
use PhpList\Core\Domain\Identity\Model\AdminAttributeValue;
use PhpList\Core\Domain\Identity\Service\Manager\AdminAttributeManager;
use PhpList\Core\Security\Authentication;
use PhpList\Core\Domain\Identity\Service\Authentication;
use PhpList\RestBundle\Common\Controller\BaseController;
use PhpList\RestBundle\Common\Service\Provider\PaginatedDataProvider;
use PhpList\RestBundle\Common\Validator\RequestValidator;
Expand Down
2 changes: 1 addition & 1 deletion src/Identity/Controller/AdministratorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use PhpList\Core\Domain\Common\Model\Filter\PaginatedFilter;
use PhpList\Core\Domain\Identity\Model\Administrator;
use PhpList\Core\Domain\Identity\Service\Manager\AdministratorManager;
use PhpList\Core\Security\Authentication;
use PhpList\Core\Domain\Identity\Service\Authentication;
use PhpList\RestBundle\Common\Controller\BaseController;
use PhpList\RestBundle\Common\Service\Provider\PaginatedDataProvider;
use PhpList\RestBundle\Common\Validator\RequestValidator;
Expand Down
2 changes: 1 addition & 1 deletion src/Identity/Controller/PasswordResetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Doctrine\ORM\EntityManagerInterface;
use OpenApi\Attributes as OA;
use PhpList\Core\Domain\Identity\Service\Manager\PasswordManager;
use PhpList\Core\Security\Authentication;
use PhpList\Core\Domain\Identity\Service\Authentication;
use PhpList\RestBundle\Common\Controller\BaseController;
use PhpList\RestBundle\Common\Validator\RequestValidator;
use PhpList\RestBundle\Identity\Request\RequestPasswordResetRequest;
Expand Down
2 changes: 1 addition & 1 deletion src/Identity/Controller/SessionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use OpenApi\Attributes as OA;
use PhpList\Core\Domain\Identity\Model\AdministratorToken;
use PhpList\Core\Domain\Identity\Service\Manager\SessionManager;
use PhpList\Core\Security\Authentication;
use PhpList\Core\Domain\Identity\Service\Authentication;
use PhpList\RestBundle\Common\Controller\BaseController;
use PhpList\RestBundle\Common\Validator\RequestValidator;
use PhpList\RestBundle\Identity\Request\CreateSessionRequest;
Expand Down
14 changes: 12 additions & 2 deletions src/Identity/Serializer/AdminAttributeDefinitionNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
class AdminAttributeDefinitionNormalizer implements NormalizerInterface
{
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function normalize($object, string $format = null, array $context = []): array
{
Expand All @@ -42,10 +42,20 @@ public function normalize($object, string $format = null, array $context = []):
}

/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function supportsNormalization($data, string $format = null): bool
{
return $data instanceof AdminAttributeDefinition;
}

/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function getSupportedTypes(?string $format): array
{
return [
AdminAttributeDefinition::class => true,
];
}
}
14 changes: 12 additions & 2 deletions src/Identity/Serializer/AdminAttributeValueNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __construct(
}

/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function normalize($object, string $format = null, array $context = []): array
{
Expand All @@ -42,10 +42,20 @@ public function normalize($object, string $format = null, array $context = []):
}

/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function supportsNormalization($data, string $format = null): bool
{
return $data instanceof AdminAttributeValue;
}

/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function getSupportedTypes(?string $format): array
{
return [
AdminAttributeValue::class => true,
];
}
}
16 changes: 13 additions & 3 deletions src/Identity/Serializer/AdministratorNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
class AdministratorNormalizer implements NormalizerInterface
{
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
* @throws InvalidArgumentException
*/
public function normalize($object, string $format = null, array $context = []): array
Expand All @@ -45,15 +45,25 @@ public function normalize($object, string $format = null, array $context = []):
'email' => $object->getEmail(),
'super_user' => $object->isSuperUser(),
'privileges' => $object->getPrivileges()->all(),
'created_at' => $object->getCreatedAt()?->format(DateTimeInterface::ATOM),
'created_at' => $object->getCreatedAt()->format(DateTimeInterface::ATOM),
];
}

/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function supportsNormalization($data, string $format = null): bool
{
return $data instanceof Administrator;
}

/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function getSupportedTypes(?string $format): array
{
return [
Administrator::class => true,
];
}
}
14 changes: 12 additions & 2 deletions src/Identity/Serializer/AdministratorTokenNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class AdministratorTokenNormalizer implements NormalizerInterface
{
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function normalize($object, string $format = null, array $context = []): array
{
Expand All @@ -27,10 +27,20 @@ public function normalize($object, string $format = null, array $context = []):
}

/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function supportsNormalization($data, string $format = null): bool
{
return $data instanceof AdministratorToken;
}

/**
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function getSupportedTypes(?string $format): array
{
return [
AdministratorToken::class => true,
];
}
}
2 changes: 1 addition & 1 deletion src/Messaging/Controller/AttachmentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use OpenApi\Attributes as OA;
use PhpList\Core\Domain\Messaging\Model\Attachment;
use PhpList\Core\Domain\Messaging\Service\AttachmentDownloadService;
use PhpList\Core\Security\Authentication;
use PhpList\Core\Domain\Identity\Service\Authentication;
use PhpList\RestBundle\Common\Controller\BaseController;
use PhpList\RestBundle\Common\Validator\RequestValidator;
use Symfony\Bridge\Doctrine\Attribute\MapEntity;
Expand Down
Loading
Loading