Skip to content

Commit 8ff0504

Browse files
committed
Merged branch '5.0' into 6.0
2 parents 52ddd32 + c62638d commit 8ff0504

2 files changed

Lines changed: 20 additions & 3 deletions

File tree

src/bundle/Core/Command/Indexer/ContentIdList/ContentTypeInputGeneratorStrategy.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Generator;
1212
use Ibexa\Bundle\Core\Command\Indexer\ContentIdListGeneratorStrategyInterface;
1313
use Ibexa\Contracts\Core\Repository\ContentService;
14+
use Ibexa\Contracts\Core\Repository\Repository;
1415
use Ibexa\Contracts\Core\Repository\Values\Content\ContentList;
1516
use Ibexa\Contracts\Core\Repository\Values\Content\Query;
1617
use Ibexa\Contracts\Core\Repository\Values\Filter\Filter;
@@ -24,9 +25,12 @@ final class ContentTypeInputGeneratorStrategy implements ContentIdListGeneratorS
2425
{
2526
private ContentService $contentService;
2627

27-
public function __construct(ContentService $contentService)
28+
private Repository $repository;
29+
30+
public function __construct(ContentService $contentService, Repository $repository)
2831
{
2932
$this->contentService = $contentService;
33+
$this->repository = $repository;
3034
}
3135

3236
/**
@@ -74,6 +78,8 @@ private function getContentList(string $contentTypeIdentifier): ContentList
7478
)
7579
;
7680

77-
return $this->contentService->find($filter);
81+
return $this->repository->sudo(
82+
fn (): ContentList => $this->contentService->find($filter)
83+
);
7884
}
7985
}

tests/bundle/Core/Command/Indexer/ContentIdList/ContentTypeInputGeneratorStrategyTest.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

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

36+
$repositoryMock = $this->createMock(Repository::class);
37+
$repositoryMock
38+
->method('sudo')
39+
->willReturnCallback(
40+
static fn (callable $callback) => $callback()
41+
);
42+
3543
$inputMock = $this->createMock(InputInterface::class);
3644
$inputMock->method('getOption')->with('content-type')->willReturn(uniqid('type', true));
3745

38-
$strategy = new ContentTypeInputGeneratorStrategy($contentServiceMock);
46+
$strategy = new ContentTypeInputGeneratorStrategy(
47+
$contentServiceMock,
48+
$repositoryMock
49+
);
3950

4051
self::assertSame(
4152
$expectedBatches,

0 commit comments

Comments
 (0)