Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -9349,7 +9349,7 @@ parameters:
path: src/lib/Base/Exceptions/ContentFieldValidationException.php

-
message: '#^PHPDoc tag @var with type callable\(Ibexa\\Contracts\\Core\\Repository\\Values\\Translation\|string\)\: string is not subtype of native type Closure\(mixed\)\: string\.$#'
message: '#^PHPDoc tag @var with type callable\(Ibexa\\Contracts\\Core\\Repository\\Values\\Translation\|string\)\: string is not subtype of native type static\-Closure\(mixed\)\: string\.$#'
identifier: varTag.nativeType
count: 1
path: src/lib/Base/Exceptions/ContentFieldValidationException.php
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Generator;
use Ibexa\Bundle\Core\Command\Indexer\ContentIdListGeneratorStrategyInterface;
use Ibexa\Contracts\Core\Repository\ContentService;
use Ibexa\Contracts\Core\Repository\Repository;
use Ibexa\Contracts\Core\Repository\Values\Content\ContentList;
use Ibexa\Contracts\Core\Repository\Values\Content\Query;
use Ibexa\Contracts\Core\Repository\Values\Filter\Filter;
Expand All @@ -24,9 +25,12 @@ final class ContentTypeInputGeneratorStrategy implements ContentIdListGeneratorS
{
private ContentService $contentService;

public function __construct(ContentService $contentService)
private Repository $repository;

public function __construct(ContentService $contentService, Repository $repository)
{
$this->contentService = $contentService;
$this->repository = $repository;
}

/**
Expand Down Expand Up @@ -74,6 +78,8 @@ private function getContentList(string $contentTypeIdentifier): ContentList
)
;

return $this->contentService->find($filter);
return $this->repository->sudo(
fn (): ContentList => $this->contentService->find($filter)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

use Ibexa\Bundle\Core\Command\Indexer\ContentIdList\ContentTypeInputGeneratorStrategy;
use Ibexa\Contracts\Core\Repository\ContentService;
use Ibexa\Contracts\Core\Repository\Repository;
use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo;
use Ibexa\Contracts\Core\Repository\Values\Content\ContentList;
use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo;
Expand All @@ -32,10 +33,20 @@ public function testGetGenerator(ContentList $contentList, int $batchSize, array
$contentServiceMock = $this->createMock(ContentService::class);
$contentServiceMock->method('find')->willReturn($contentList);

$repositoryMock = $this->createMock(Repository::class);
$repositoryMock
->method('sudo')
->willReturnCallback(
static fn (callable $callback) => $callback()
);

$inputMock = $this->createMock(InputInterface::class);
$inputMock->method('getOption')->with('content-type')->willReturn(uniqid('type', true));

$strategy = new ContentTypeInputGeneratorStrategy($contentServiceMock);
$strategy = new ContentTypeInputGeneratorStrategy(
$contentServiceMock,
$repositoryMock
);

self::assertSame(
$expectedBatches,
Expand Down
Loading