From 2bd669239afe2865ab404ba32028a038beb5a061 Mon Sep 17 00:00:00 2001 From: Bartek Wajda Date: Mon, 7 Aug 2023 16:10:59 +0200 Subject: [PATCH 1/9] IBX-6217: Forced `RichText\Renderer`to utilize `PermissionResolver` instead of `AuthorizationChecker` --- .../Resources/config/fieldtype_services.yaml | 21 +++---- src/lib/RichText/Renderer.php | 63 ++++++------------- 2 files changed, 29 insertions(+), 55 deletions(-) diff --git a/src/bundle/Resources/config/fieldtype_services.yaml b/src/bundle/Resources/config/fieldtype_services.yaml index 6cd7c5d7..02ccfacc 100644 --- a/src/bundle/Resources/config/fieldtype_services.yaml +++ b/src/bundle/Resources/config/fieldtype_services.yaml @@ -31,18 +31,17 @@ services: http://ibexa.co/namespaces/ezpublish5/xhtml5/edit: '@ibexa.richtext.converter.input.xhtml5' Ibexa\FieldTypeRichText\RichText\Renderer: - class: Ibexa\FieldTypeRichText\RichText\Renderer arguments: - - '@ibexa.api.repository' - - '@security.authorization_checker' - - '@ibexa.config.resolver' - - '@twig' - - '%ibexa.field_type.richtext.tag.namespace%' - - '%ibexa.field_type.richtext.style.namespace%' - - '%ibexa.field_type.richtext.embed.namespace%' - - '@?logger' - - '%ibexa.field_type.richtext.custom_tags%' - - '%ibexa.field_type.richtext.custom_styles%' + $repository: '@ibexa.api.repository' + $configResolver: '@ibexa.config.resolver' + $templateEngine: '@twig' + $permissionResolver: '@Ibexa\Contracts\Core\Repository\PermissionResolver' + $tagConfigurationNamespace: '%ibexa.field_type.richtext.tag.namespace%' + $styleConfigurationNamespace: '%ibexa.field_type.richtext.style.namespace%' + $embedConfigurationNamespace: '%ibexa.field_type.richtext.embed.namespace%' + $logger: '@?logger' + $customTagsConfiguration: '%ibexa.field_type.richtext.custom_tags%' + $customStylesConfiguration: '%ibexa.field_type.richtext.custom_styles%' Ibexa\FieldTypeRichText\RichText\Converter\Link: class: Ibexa\FieldTypeRichText\RichText\Converter\Link diff --git a/src/lib/RichText/Renderer.php b/src/lib/RichText/Renderer.php index 206eb7bc..1b7a0965 100644 --- a/src/lib/RichText/Renderer.php +++ b/src/lib/RichText/Renderer.php @@ -10,15 +10,14 @@ use Exception; use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException; +use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Ibexa\Contracts\FieldTypeRichText\RichText\RendererInterface; -use Ibexa\Core\MVC\Symfony\Security\Authorization\Attribute as AuthorizationAttribute; use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Twig\Environment; @@ -35,10 +34,7 @@ class Renderer implements RendererInterface */ protected $repository; - /** - * @var \Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface - */ - private $authorizationChecker; + private PermissionResolver $permissionResolver; /** * @var string @@ -80,23 +76,11 @@ class Renderer implements RendererInterface */ private $customStylesConfiguration; - /** - * @param \Ibexa\Contracts\Core\Repository\Repository $repository - * @param \Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface $authorizationChecker - * @param \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface $configResolver - * @param \Twig\Environment $templateEngine - * @param string $tagConfigurationNamespace - * @param string $styleConfigurationNamespace - * @param string $embedConfigurationNamespace - * @param \Psr\Log\LoggerInterface|null $logger - * @param array $customTagsConfiguration - * @param array $customStylesConfiguration - */ public function __construct( Repository $repository, - AuthorizationCheckerInterface $authorizationChecker, ConfigResolverInterface $configResolver, Environment $templateEngine, + PermissionResolver $permissionResolver, $tagConfigurationNamespace, $styleConfigurationNamespace, $embedConfigurationNamespace, @@ -105,9 +89,9 @@ public function __construct( array $customStylesConfiguration = [] ) { $this->repository = $repository; - $this->authorizationChecker = $authorizationChecker; $this->configResolver = $configResolver; $this->templateEngine = $templateEngine; + $this->permissionResolver = $permissionResolver; $this->tagConfigurationNamespace = $tagConfigurationNamespace; $this->styleConfigurationNamespace = $styleConfigurationNamespace; $this->embedConfigurationNamespace = $embedConfigurationNamespace; @@ -452,20 +436,15 @@ protected function getEmbedTemplateName($resourceType, $isInline, $isDenied) /** * Check embed permissions for the given Content. * - * @throws \Symfony\Component\Security\Core\Exception\AccessDeniedException - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Content $content + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException */ protected function checkContentPermissions(Content $content) { // Check both 'content/read' and 'content/view_embed'. if ( - !$this->authorizationChecker->isGranted( - new AuthorizationAttribute('content', 'read', ['valueObject' => $content]) - ) - && !$this->authorizationChecker->isGranted( - new AuthorizationAttribute('content', 'view_embed', ['valueObject' => $content]) - ) + !$this->permissionResolver->canUser('content', 'read', $content) + && !$this->permissionResolver->canUser('content', 'view_embed', $content) // Shouldn't we have `||` here? ) { throw new AccessDeniedException(); } @@ -473,9 +452,7 @@ protected function checkContentPermissions(Content $content) // Check that Content is published, since sudo allows loading unpublished content. if ( !$content->getVersionInfo()->isPublished() - && !$this->authorizationChecker->isGranted( - new AuthorizationAttribute('content', 'versionread', ['valueObject' => $content]) - ) + && !$this->permissionResolver->canUser('content', 'versionread', $content) ) { throw new AccessDeniedException(); } @@ -501,19 +478,17 @@ static function (Repository $repository) use ($id) { // Check both 'content/read' and 'content/view_embed'. if ( - !$this->authorizationChecker->isGranted( - new AuthorizationAttribute( - 'content', - 'read', - ['valueObject' => $location->contentInfo, 'targets' => [$location]] - ) + !$this->permissionResolver->canUser( + 'content', + 'read', + $location->contentInfo, + [$location] ) - && !$this->authorizationChecker->isGranted( - new AuthorizationAttribute( - 'content', - 'view_embed', - ['valueObject' => $location->contentInfo, 'targets' => [$location]] - ) + && !$this->permissionResolver->canUser( // Shouldn't we have `||` here? + 'content', + 'view_embed', + $location->contentInfo, + [$location] ) ) { throw new AccessDeniedException(); From e62bc24d2dd51a1260322cc643ef9ef553418e55 Mon Sep 17 00:00:00 2001 From: Bartek Wajda Date: Mon, 7 Aug 2023 16:13:56 +0200 Subject: [PATCH 2/9] IBX-6217: Type-hinted parameters --- src/lib/RichText/Renderer.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/RichText/Renderer.php b/src/lib/RichText/Renderer.php index 1b7a0965..20a6928b 100644 --- a/src/lib/RichText/Renderer.php +++ b/src/lib/RichText/Renderer.php @@ -81,9 +81,9 @@ public function __construct( ConfigResolverInterface $configResolver, Environment $templateEngine, PermissionResolver $permissionResolver, - $tagConfigurationNamespace, - $styleConfigurationNamespace, - $embedConfigurationNamespace, + string $tagConfigurationNamespace, + string $styleConfigurationNamespace, + string $embedConfigurationNamespace, LoggerInterface $logger = null, array $customTagsConfiguration = [], array $customStylesConfiguration = [] From 76dc253200172ddf58827261212f0c2d9ddae57a Mon Sep 17 00:00:00 2001 From: Bartek Wajda Date: Mon, 7 Aug 2023 16:19:28 +0200 Subject: [PATCH 3/9] IBX-6217: Fixed unit tests --- tests/lib/RichText/RendererTest.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/lib/RichText/RendererTest.php b/tests/lib/RichText/RendererTest.php index 3d5b467a..f6b4798c 100644 --- a/tests/lib/RichText/RendererTest.php +++ b/tests/lib/RichText/RendererTest.php @@ -9,6 +9,7 @@ namespace Ibexa\Tests\FieldTypeRichText\RichText; use Exception; +use Ibexa\Contracts\Core\Repository\PermissionResolver; use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Contracts\Core\Repository\Values\Content\Location; @@ -19,7 +20,6 @@ use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Twig\Environment; use Twig\Loader\LoaderInterface; @@ -29,7 +29,7 @@ class RendererTest extends TestCase public function setUp(): void { $this->repositoryMock = $this->getRepositoryMock(); - $this->authorizationCheckerMock = $this->getAuthorizationCheckerMock(); + $this->permissionResolverMock = $this->getPermissionResolverMock(); $this->configResolverMock = $this->getConfigResolverMock(); $this->templateEngineMock = $this->getTemplateEngineMock(); $this->loggerMock = $this->getLoggerMock(); @@ -1707,9 +1707,9 @@ protected function getMockedRenderer(array $methods = []) ->setConstructorArgs( [ $this->repositoryMock, - $this->authorizationCheckerMock, $this->configResolverMock, $this->templateEngineMock, + $this->permissionResolverMock, 'test.name.space.tag', 'test.name.space.style', 'test.name.space.embed', @@ -1734,16 +1734,16 @@ protected function getRepositoryMock() } /** - * @var \Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface|\PHPUnit\Framework\MockObject\MockObject + * @var \Ibexa\Contracts\Core\Repository\PermissionResolver|\PHPUnit\Framework\MockObject\MockObject */ - protected $authorizationCheckerMock; + protected $permissionResolverMock; /** * @return \PHPUnit\Framework\MockObject\MockObject */ - protected function getAuthorizationCheckerMock() + protected function getPermissionResolverMock() { - return $this->createMock(AuthorizationCheckerInterface::class); + return $this->createMock(PermissionResolver::class); } /** From 71661c797dd2c7113a632ae30255059bdfdc9982 Mon Sep 17 00:00:00 2001 From: Bartek Wajda Date: Mon, 7 Aug 2023 16:29:58 +0200 Subject: [PATCH 4/9] IBX-6217: CS --- phpstan-baseline.neon | 10 ---------- tests/lib/RichText/RendererTest.php | 31 ++++++++++++++--------------- 2 files changed, 15 insertions(+), 26 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 2813c23d..df6533a2 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -2965,16 +2965,6 @@ parameters: count: 1 path: tests/lib/RichText/RendererTest.php - - - message: "#^Property Ibexa\\\\Tests\\\\FieldTypeRichText\\\\RichText\\\\RendererTest\\:\\:\\$authorizationCheckerMock \\(PHPUnit\\\\Framework\\\\MockObject\\\\MockObject&Symfony\\\\Component\\\\Security\\\\Core\\\\Authorization\\\\AuthorizationCheckerInterface\\) does not accept PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\.$#" - count: 1 - path: tests/lib/RichText/RendererTest.php - - - - message: "#^Property Ibexa\\\\Tests\\\\FieldTypeRichText\\\\RichText\\\\RendererTest\\:\\:\\$configResolverMock \\(PHPUnit\\\\Framework\\\\MockObject\\\\MockObject&Psr\\\\Log\\\\LoggerInterface\\) does not accept PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\.$#" - count: 1 - path: tests/lib/RichText/RendererTest.php - - message: "#^Property Ibexa\\\\Tests\\\\FieldTypeRichText\\\\RichText\\\\RendererTest\\:\\:\\$loaderMock \\(PHPUnit\\\\Framework\\\\MockObject\\\\MockObject&Twig\\\\Loader\\\\LoaderInterface\\) does not accept PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\.$#" count: 1 diff --git a/tests/lib/RichText/RendererTest.php b/tests/lib/RichText/RendererTest.php index f6b4798c..aa8ab462 100644 --- a/tests/lib/RichText/RendererTest.php +++ b/tests/lib/RichText/RendererTest.php @@ -17,6 +17,7 @@ use Ibexa\Core\Base\Exceptions\NotFoundException; use Ibexa\Core\Repository\Repository; use Ibexa\FieldTypeRichText\RichText\Renderer; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; @@ -1733,43 +1734,41 @@ protected function getRepositoryMock() return $this->createMock(Repository::class); } - /** - * @var \Ibexa\Contracts\Core\Repository\PermissionResolver|\PHPUnit\Framework\MockObject\MockObject - */ - protected $permissionResolverMock; + /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface&\PHPUnit\Framework\MockObject\MockObject */ + protected $configResolverMock; /** - * @return \PHPUnit\Framework\MockObject\MockObject + * @return \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface&\PHPUnit\Framework\MockObject\MockObject */ - protected function getPermissionResolverMock() + protected function getConfigResolverMock() { - return $this->createMock(PermissionResolver::class); + return $this->createMock(ConfigResolverInterface::class); } /** - * @var \Psr\Log\LoggerInterface|\PHPUnit\Framework\MockObject\MockObject + * @var \Symfony\Component\Templating\EngineInterface|\PHPUnit\Framework\MockObject\MockObject */ - protected $configResolverMock; + protected $templateEngineMock; /** * @return \PHPUnit\Framework\MockObject\MockObject */ - protected function getConfigResolverMock() + protected function getTemplateEngineMock() { - return $this->createMock(ConfigResolverInterface::class); + return $this->createMock(Environment::class); } /** - * @var \Symfony\Component\Templating\EngineInterface|\PHPUnit\Framework\MockObject\MockObject + * @var \Ibexa\Contracts\Core\Repository\PermissionResolver&\PHPUnit\Framework\MockObject\MockObject */ - protected $templateEngineMock; + protected $permissionResolverMock; /** - * @return \PHPUnit\Framework\MockObject\MockObject + * @return \Ibexa\Contracts\Core\Repository\PermissionResolver&\PHPUnit\Framework\MockObject\MockObject */ - protected function getTemplateEngineMock() + protected function getPermissionResolverMock(): MockObject { - return $this->createMock(Environment::class); + return $this->createMock(PermissionResolver::class); } /** From a0bdbbbc86e157f8799edc361f0d36a8b7276f1f Mon Sep 17 00:00:00 2001 From: Bartek Wajda Date: Mon, 7 Aug 2023 18:34:46 +0200 Subject: [PATCH 5/9] IBX-6217: Removed comments --- src/lib/RichText/Renderer.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/RichText/Renderer.php b/src/lib/RichText/Renderer.php index 20a6928b..1ba5f621 100644 --- a/src/lib/RichText/Renderer.php +++ b/src/lib/RichText/Renderer.php @@ -444,7 +444,7 @@ protected function checkContentPermissions(Content $content) // Check both 'content/read' and 'content/view_embed'. if ( !$this->permissionResolver->canUser('content', 'read', $content) - && !$this->permissionResolver->canUser('content', 'view_embed', $content) // Shouldn't we have `||` here? + && !$this->permissionResolver->canUser('content', 'view_embed', $content) ) { throw new AccessDeniedException(); } @@ -484,7 +484,7 @@ static function (Repository $repository) use ($id) { $location->contentInfo, [$location] ) - && !$this->permissionResolver->canUser( // Shouldn't we have `||` here? + && !$this->permissionResolver->canUser( 'content', 'view_embed', $location->contentInfo, From 54c15c3110dae5a223c52d20fc63240cc293a23f Mon Sep 17 00:00:00 2001 From: Bartek Wajda Date: Tue, 8 Aug 2023 15:11:12 +0200 Subject: [PATCH 6/9] IBX-6217: CS --- phpstan-baseline.neon | 20 ------------- tests/lib/RichText/RendererTest.php | 45 ++++++++++++----------------- 2 files changed, 18 insertions(+), 47 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index df6533a2..8d8a5229 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -2965,26 +2965,6 @@ parameters: count: 1 path: tests/lib/RichText/RendererTest.php - - - message: "#^Property Ibexa\\\\Tests\\\\FieldTypeRichText\\\\RichText\\\\RendererTest\\:\\:\\$loaderMock \\(PHPUnit\\\\Framework\\\\MockObject\\\\MockObject&Twig\\\\Loader\\\\LoaderInterface\\) does not accept PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\.$#" - count: 1 - path: tests/lib/RichText/RendererTest.php - - - - message: "#^Property Ibexa\\\\Tests\\\\FieldTypeRichText\\\\RichText\\\\RendererTest\\:\\:\\$loggerMock \\(PHPUnit\\\\Framework\\\\MockObject\\\\MockObject&Psr\\\\Log\\\\LoggerInterface\\) does not accept PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\.$#" - count: 1 - path: tests/lib/RichText/RendererTest.php - - - - message: "#^Property Ibexa\\\\Tests\\\\FieldTypeRichText\\\\RichText\\\\RendererTest\\:\\:\\$repositoryMock \\(Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Repository&PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\) does not accept PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\.$#" - count: 1 - path: tests/lib/RichText/RendererTest.php - - - - message: "#^Property Ibexa\\\\Tests\\\\FieldTypeRichText\\\\RichText\\\\RendererTest\\:\\:\\$templateEngineMock \\(PHPUnit\\\\Framework\\\\MockObject\\\\MockObject&Symfony\\\\Component\\\\Templating\\\\EngineInterface\\) does not accept PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\.$#" - count: 1 - path: tests/lib/RichText/RendererTest.php - - message: "#^Method Ibexa\\\\Tests\\\\FieldTypeRichText\\\\RichText\\\\Validator\\\\CustomTagsValidatorTest\\:\\:providerForTestValidateDocument\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 diff --git a/tests/lib/RichText/RendererTest.php b/tests/lib/RichText/RendererTest.php index aa8ab462..ef9af418 100644 --- a/tests/lib/RichText/RendererTest.php +++ b/tests/lib/RichText/RendererTest.php @@ -17,7 +17,6 @@ use Ibexa\Core\Base\Exceptions\NotFoundException; use Ibexa\Core\Repository\Repository; use Ibexa\FieldTypeRichText\RichText\Renderer; -use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; @@ -1721,65 +1720,57 @@ protected function getMockedRenderer(array $methods = []) ->getMock(); } - /** - * @var \Ibexa\Contracts\Core\Repository\Repository|\PHPUnit\Framework\MockObject\MockObject - */ + /** @var \Ibexa\Contracts\Core\Repository\Repository&\PHPUnit\Framework\MockObject\MockObject */ protected $repositoryMock; /** - * @return \PHPUnit\Framework\MockObject\MockObject + * @return \Ibexa\Core\Repository\Repository&\PHPUnit\Framework\MockObject\MockObject */ - protected function getRepositoryMock() + protected function getRepositoryMock(): Repository { return $this->createMock(Repository::class); } /** @var \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface&\PHPUnit\Framework\MockObject\MockObject */ - protected $configResolverMock; + protected ConfigResolverInterface $configResolverMock; /** * @return \Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface&\PHPUnit\Framework\MockObject\MockObject */ - protected function getConfigResolverMock() + protected function getConfigResolverMock(): ConfigResolverInterface { return $this->createMock(ConfigResolverInterface::class); } - /** - * @var \Symfony\Component\Templating\EngineInterface|\PHPUnit\Framework\MockObject\MockObject - */ - protected $templateEngineMock; + /** @var \Twig\Environment&\PHPUnit\Framework\MockObject\MockObject */ + protected Environment $templateEngineMock; /** - * @return \PHPUnit\Framework\MockObject\MockObject + * @return \Twig\Environment&\PHPUnit\Framework\MockObject\MockObject */ - protected function getTemplateEngineMock() + protected function getTemplateEngineMock(): Environment { return $this->createMock(Environment::class); } - /** - * @var \Ibexa\Contracts\Core\Repository\PermissionResolver&\PHPUnit\Framework\MockObject\MockObject - */ - protected $permissionResolverMock; + /** @var \Ibexa\Contracts\Core\Repository\PermissionResolver&\PHPUnit\Framework\MockObject\MockObject */ + protected PermissionResolver $permissionResolverMock; /** * @return \Ibexa\Contracts\Core\Repository\PermissionResolver&\PHPUnit\Framework\MockObject\MockObject */ - protected function getPermissionResolverMock(): MockObject + protected function getPermissionResolverMock(): PermissionResolver { return $this->createMock(PermissionResolver::class); } - /** - * @var \Psr\Log\LoggerInterface|\PHPUnit\Framework\MockObject\MockObject - */ - protected $loggerMock; + /** @var \Psr\Log\LoggerInterface&\PHPUnit\Framework\MockObject\MockObject */ + protected LoggerInterface $loggerMock; /** - * @return \PHPUnit\Framework\MockObject\MockObject + * @return \Psr\Log\LoggerInterface&\PHPUnit\Framework\MockObject\MockObject */ - protected function getLoggerMock() + protected function getLoggerMock(): LoggerInterface { return $this->createMock(LoggerInterface::class); } @@ -1790,9 +1781,9 @@ protected function getLoggerMock() protected $loaderMock; /** - * @return \PHPUnit\Framework\MockObject\MockObject + * @return \Twig\Loader\LoaderInterface&\PHPUnit\Framework\MockObject\MockObject */ - protected function getLoaderMock() + protected function getLoaderMock(): LoaderInterface { return $this->createMock(LoaderInterface::class); } From 00dc12c1ca33c83f6a6c62da602e582cee559e90 Mon Sep 17 00:00:00 2001 From: Bartek Wajda Date: Mon, 14 Aug 2023 14:57:11 +0200 Subject: [PATCH 7/9] IBX-6217: Type-hinted property --- tests/lib/RichText/RendererTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lib/RichText/RendererTest.php b/tests/lib/RichText/RendererTest.php index ef9af418..935c234f 100644 --- a/tests/lib/RichText/RendererTest.php +++ b/tests/lib/RichText/RendererTest.php @@ -1721,7 +1721,7 @@ protected function getMockedRenderer(array $methods = []) } /** @var \Ibexa\Contracts\Core\Repository\Repository&\PHPUnit\Framework\MockObject\MockObject */ - protected $repositoryMock; + protected Repository $repositoryMock; /** * @return \Ibexa\Core\Repository\Repository&\PHPUnit\Framework\MockObject\MockObject From 934930aa5735d71f72f2b91441b48772dd035274 Mon Sep 17 00:00:00 2001 From: Bartek Wajda Date: Mon, 14 Aug 2023 15:03:10 +0200 Subject: [PATCH 8/9] IBX-6217: Fixup --- tests/lib/RichText/RendererTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/lib/RichText/RendererTest.php b/tests/lib/RichText/RendererTest.php index 935c234f..ab4de3cc 100644 --- a/tests/lib/RichText/RendererTest.php +++ b/tests/lib/RichText/RendererTest.php @@ -15,7 +15,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Ibexa\Core\Base\Exceptions\NotFoundException; -use Ibexa\Core\Repository\Repository; +use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\FieldTypeRichText\RichText\Renderer; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; @@ -1724,7 +1724,7 @@ protected function getMockedRenderer(array $methods = []) protected Repository $repositoryMock; /** - * @return \Ibexa\Core\Repository\Repository&\PHPUnit\Framework\MockObject\MockObject + * @return \Ibexa\Contracts\Core\Repository\Repository&\PHPUnit\Framework\MockObject\MockObject */ protected function getRepositoryMock(): Repository { From c4af85f58c44bc6e8af4c8b7f4c71b741a671d70 Mon Sep 17 00:00:00 2001 From: Bartek Wajda Date: Mon, 14 Aug 2023 15:04:23 +0200 Subject: [PATCH 9/9] IBX-6217: CS --- tests/lib/RichText/RendererTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lib/RichText/RendererTest.php b/tests/lib/RichText/RendererTest.php index ab4de3cc..a203bba0 100644 --- a/tests/lib/RichText/RendererTest.php +++ b/tests/lib/RichText/RendererTest.php @@ -10,12 +10,12 @@ use Exception; use Ibexa\Contracts\Core\Repository\PermissionResolver; +use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; use Ibexa\Core\Base\Exceptions\NotFoundException; -use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\FieldTypeRichText\RichText\Renderer; use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface;