Skip to content

Commit

Permalink
Ecs fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
marekrzytki committed May 14, 2024
1 parent 536b8cd commit f62205c
Show file tree
Hide file tree
Showing 78 changed files with 421 additions and 295 deletions.
17 changes: 9 additions & 8 deletions spec/EmailSender/SenderSpec.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on [email protected].
*/

declare(strict_types=1);
Expand Down Expand Up @@ -41,14 +42,14 @@ function it_is_initializable(
SenderAdapterInterface $senderAdapter,
EmailProviderInterface $provider,
DefaultSettingsProviderInterface $defaultSettingsProvider,
EmailTemplateTranslationRepositoryInterface $templateTranslationRepository
EmailTemplateTranslationRepositoryInterface $templateTranslationRepository,
): void {
$this->beConstructedWith(
$rendererAdapter,
$senderAdapter,
$provider,
$defaultSettingsProvider,
$templateTranslationRepository
$templateTranslationRepository,
);
$this->shouldHaveType(Sender::class);
}
Expand All @@ -60,7 +61,7 @@ function it_should_send_email(
DefaultSettingsProviderInterface $defaultSettingsProvider,
EmailTemplateTranslationRepositoryInterface $templateTranslationRepository,
EmailInterface $email,
RenderedEmail $renderedEmail
RenderedEmail $renderedEmail,
): void {
$this->beConstructedWith(
$rendererAdapter,
Expand Down Expand Up @@ -102,7 +103,7 @@ function it_should_set_custom_email_template_if_found(
DefaultSettingsProviderInterface $defaultSettingsProvider,
EmailTemplateTranslationRepositoryInterface $templateTranslationRepository,
EmailInterface $email,
RenderedEmail $renderedEmail
RenderedEmail $renderedEmail,
): void {
$this->beConstructedWith(
$rendererAdapter,
Expand All @@ -122,7 +123,7 @@ function it_should_set_custom_email_template_if_found(
$emailTemplateTranslation = new EmailTemplateTranslation();
$templateTranslationRepository->findOneByLocaleCodeAndType(
self::LOCALE,
self::EMAIL_TYPE
self::EMAIL_TYPE,
)->willReturn($emailTemplateTranslation);

$rendererAdapter->render($email, Argument::type('array'))->willReturn($renderedEmail);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on [email protected].
*/

declare(strict_types=1);
Expand Down Expand Up @@ -31,7 +32,7 @@ function let(
DataCollectorTranslator $dataCollectorTranslator,
RouterInterface $router,
Request $request,
ParameterBagInterface $attributes
ParameterBagInterface $attributes,
): void {
$request->attributes = $attributes;

Expand All @@ -47,7 +48,7 @@ function it_should_do_nothing_when_route_is_not_create_email_template(
RequestEvent $requestEvent,
Request $request,
ParameterBag $attributes,
EmailCodesProviderInterface $emailCodesProvider
EmailCodesProviderInterface $emailCodesProvider,
): void {
$requestEvent->getRequest()->willReturn($request);

Expand All @@ -64,7 +65,7 @@ function it_should_not_redirect_when_type_are_available_to_create_email_template
ParameterBag $attributes,
EmailCodesProviderInterface $emailCodesProvider,
Session $session,
FlashBagInterface $flashBag
FlashBagInterface $flashBag,
): void {
$requestEvent->getRequest()->willReturn($request);

Expand All @@ -90,7 +91,7 @@ function it_should_redirect_when_route_is_create_email_template(
Session $session,
FlashBagInterface $flashBag,
RouterInterface $router,
DataCollectorTranslator $dataCollectorTranslator
DataCollectorTranslator $dataCollectorTranslator,
): void {
$requestEvent->getRequest()->willReturn($request);

Expand Down
19 changes: 10 additions & 9 deletions spec/EventListener/TwigErrorEventListenerSpec.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on [email protected].
*/

declare(strict_types=1);
Expand Down Expand Up @@ -37,13 +38,13 @@ function it_is_initializable(): void
function it_should_do_nothing_if_exception_is_not_a_twig_security_error(
HttpKernelInterface $httpKernel,
Request $request,
CustomTwigErrorResponseProviderInterface $customTwigErrorResponseProvider
CustomTwigErrorResponseProviderInterface $customTwigErrorResponseProvider,
): void {
$exceptionEvent = new ExceptionEvent(
$httpKernel->getWrappedObject(),
$request->getWrappedObject(),
HttpKernelInterface::MASTER_REQUEST,
new \Exception()
new \Exception(),
);
$customTwigErrorResponseProvider->provide(Argument::type(Error::class))->shouldNotBeCalled();

Expand All @@ -53,14 +54,14 @@ function it_should_do_nothing_if_exception_is_not_a_twig_security_error(
function it_should_do_nothing_if_provided_custom_response_is_null(
HttpKernelInterface $httpKernel,
Request $request,
CustomTwigErrorResponseProviderInterface $customTwigErrorResponseProvider
CustomTwigErrorResponseProviderInterface $customTwigErrorResponseProvider,
): void {
$genericResponse = new Response();
$exceptionEvent = new ExceptionEvent(
$httpKernel->getWrappedObject(),
$request->getWrappedObject(),
HttpKernelInterface::MASTER_REQUEST,
new \Exception()
new \Exception(),
);
$exceptionEvent->setResponse($genericResponse);
$customTwigErrorResponseProvider->provide(Argument::type(Error::class))->willReturn(null);
Expand All @@ -73,15 +74,15 @@ function it_should_do_nothing_if_provided_custom_response_is_null(
function it_should_set_response_to_the_provided_custom_twig_error_response(
HttpKernelInterface $httpKernel,
Request $request,
CustomTwigErrorResponseProviderInterface $customTwigErrorResponseProvider
CustomTwigErrorResponseProviderInterface $customTwigErrorResponseProvider,
): void {
$jsonResponse = new JsonResponse();
$error = new Error('foo');
$exceptionEvent = new ExceptionEvent(
$httpKernel->getWrappedObject(),
$request->getWrappedObject(),
HttpKernelInterface::MASTER_REQUEST,
$error
$error,
);
$exceptionEvent->setResponse(new Response());
$customTwigErrorResponseProvider->provide($error)->willReturn($jsonResponse);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on [email protected].
*/

declare(strict_types=1);
Expand Down
9 changes: 8 additions & 1 deletion spec/Provider/CustomTwigErrorResponseProviderSpec.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?php

/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on [email protected].
*/

declare(strict_types=1);

/*
Expand Down Expand Up @@ -47,7 +54,7 @@ function it_should_throw_exception_if_passed_object_not_implementing_the_proper_
function it_should_return_first_supporting_custom_twig_error_response(
TwigErrorResponseInterface $firstResponse,
TwigErrorResponseInterface $secondResponse,
TwigErrorResponseInterface $thirdResponse
TwigErrorResponseInterface $thirdResponse,
): void {
$error = new Error('foo');
$firstJsonResponse = new JsonResponse();
Expand Down
15 changes: 11 additions & 4 deletions spec/Provider/EmailCodesProviderSpec.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?php

/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on [email protected].
*/

declare(strict_types=1);

/*
Expand Down Expand Up @@ -34,12 +41,12 @@ class EmailCodesProviderSpec extends ObjectBehavior

function let(
EmailTemplateRepositoryInterface $emailTemplateRepository,
DataCollectorTranslator $dataCollectorTranslator
DataCollectorTranslator $dataCollectorTranslator,
): void {
$this->beConstructedWith(
self::EXAMPLE_EMAILS_CONFIGURATION,
$emailTemplateRepository,
$dataCollectorTranslator
$dataCollectorTranslator,
);
}

Expand Down Expand Up @@ -93,12 +100,12 @@ function it_should_return_not_email_template_types(EmailTemplateRepositoryInterf
function it_should_return_not_used_types_for_edit_email_template(
EmailTemplateRepositoryInterface $emailTemplateRepository,
EmailTemplateInterface $emailTemplate,
DataCollectorTranslator $dataCollectorTranslator
DataCollectorTranslator $dataCollectorTranslator,
): void {
$dataCollectorTranslator->trans(
'Contact Request',
[],
EmailTemplateType::MAIL_TEMPLATE_TYPE_DOMAIN
EmailTemplateType::MAIL_TEMPLATE_TYPE_DOMAIN,
)->shouldBeCalled()->willReturn('Contact Request');

$emailTemplateRepository->getAllTypes()->willReturn([
Expand Down
11 changes: 9 additions & 2 deletions spec/Provider/MailPreviewDataProviderSpec.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?php

/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on [email protected].
*/

declare(strict_types=1);

/*
Expand Down Expand Up @@ -35,7 +42,7 @@ function it_should_throw_exception_if_generic_mail_preview_data_doesnt_exist():
}

function it_should_return_generic_mail_preview_data_if_none_mail_preview_data_for_requested_type_exist(
MailPreviewDataInterface $genericMailPreviewData
MailPreviewDataInterface $genericMailPreviewData,
): void {
$availableMailPreviewData = [
MailPreviewDataProvider::GENERIC_PREVIEW_DATA_KEY => $genericMailPreviewData,
Expand All @@ -60,7 +67,7 @@ function it_should_throw_exception_if_matched_mail_preview_data_is_not_implement

function it_should_return_mail_preview_data_for_requested_type(
MailPreviewDataInterface $genericMailPreviewData,
MailPreviewDataInterface $fooMailPreviewData
MailPreviewDataInterface $fooMailPreviewData,
): void {
$availableMailPreviewData = [
MailPreviewDataProvider::GENERIC_PREVIEW_DATA_KEY => $genericMailPreviewData,
Expand Down
9 changes: 5 additions & 4 deletions spec/Repository/EmailTemplateTranslationRepositorySpec.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php

/*
* This file was created by developers working at BitBag
* Do you need more information about us and what we do? Visit our https://bitbag.io website!
* We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on [email protected].
*/

declare(strict_types=1);
Expand Down Expand Up @@ -111,7 +112,7 @@ function it_invokes_decorated_class_method_on_remove(RepositoryInterface $reposi
function it_finds_one_by_locale_code_and_type(
EntityRepository $repository,
QueryBuilder $queryBuilder,
AbstractQuery $query
AbstractQuery $query,
): void {
$repository->createQueryBuilder('tt', null)->willReturn($queryBuilder);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?php

/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on [email protected].
*/

declare(strict_types=1);

/*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?php

/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on [email protected].
*/

declare(strict_types=1);

/*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?php

/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on [email protected].
*/

declare(strict_types=1);

/*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?php

/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on [email protected].
*/

declare(strict_types=1);

/*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<?php

/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on [email protected].
*/

declare(strict_types=1);

/*
Expand Down
Loading

0 comments on commit f62205c

Please sign in to comment.