diff --git a/be/src/Controller/UsersController.php b/be/src/Controller/UsersController.php index 76238037..a2623f36 100644 --- a/be/src/Controller/UsersController.php +++ b/be/src/Controller/UsersController.php @@ -51,7 +51,7 @@ function (array $acc, $paramValue, string $paramName) use ($paramConstraints): a )[1]->orderBy('t.uid', 'DESC'); ['result' => $result, 'hasMorePages' => $hasMorePages] = - QueryResult::hasQueryResultMorePages($queries, $this->perPageItems); + QueryResult::hasMorePages($queries, $this->perPageItems); $resultCount = count($result); Helper::abortAPIIf(40402, $resultCount === 0); diff --git a/be/src/PostsQuery/QueryResult.php b/be/src/PostsQuery/QueryResult.php index 4842833a..b9f32a8b 100644 --- a/be/src/PostsQuery/QueryResult.php +++ b/be/src/PostsQuery/QueryResult.php @@ -36,7 +36,7 @@ public function __construct( ) {} /** @return array{result: Collection, hasMorePages: bool} */ - public static function hasQueryResultMorePages(QueryBuilder $query, int $limit): array + public static function hasMorePages(QueryBuilder $query, int $limit): array { $results = collect($query->setMaxResults($limit + 1)->getQuery()->getResult()); if ($results->count() === $limit + 1) { @@ -91,7 +91,7 @@ public function setResult( }); $resultsAndHasMorePages = $queries->map(fn(QueryBuilder $query) => - self::hasQueryResultMorePages($query, $this->perPageItems)); + self::hasMorePages($query, $this->perPageItems)); /** @var PostsKeyByTypePluralName $postsKeyByTypePluralName */ $postsKeyByTypePluralName = $resultsAndHasMorePages ->mapWithKeys(fn(array $resultAndHasMorePages, string $postType) => diff --git a/be/tests/EventListener/PrettyJsonResponseTest.php b/be/tests/EventListener/PrettyJsonResponseTest.php index bcbd550a..9a5aef0d 100644 --- a/be/tests/EventListener/PrettyJsonResponseTest.php +++ b/be/tests/EventListener/PrettyJsonResponseTest.php @@ -19,8 +19,7 @@ protected function setUp(): void { parent::setUp(); self::bootKernel(); - $container = static::getContainer(); - $this->sut = $container->get(PrettyJsonResponse::class); + $this->sut = static::getContainer()->get(PrettyJsonResponse::class); } public function test(): void diff --git a/be/tests/EventListener/ShowReactJsonViewTest.php b/be/tests/EventListener/ShowReactJsonViewTest.php index c75a6289..91c37820 100644 --- a/be/tests/EventListener/ShowReactJsonViewTest.php +++ b/be/tests/EventListener/ShowReactJsonViewTest.php @@ -19,13 +19,7 @@ protected function setUp(): void { parent::setUp(); self::bootKernel(); - $container = static::getContainer(); - $this->sut = $container->get(ShowReactJsonView::class); - } - - protected function tearDown(): void - { - parent::tearDown(); + $this->sut = static::getContainer()->get(ShowReactJsonView::class); } public function testShowing(): void diff --git a/be/tests/PostsQuery/PostsTreeTest.php b/be/tests/PostsQuery/PostsTreeTest.php index 64f8224a..dffdd9eb 100644 --- a/be/tests/PostsQuery/PostsTreeTest.php +++ b/be/tests/PostsQuery/PostsTreeTest.php @@ -20,8 +20,7 @@ protected function setUp(): void { parent::setUp(); self::bootKernel(); - $container = self::getContainer(); - $this->sut = $container->get(PostsTree::class); + $this->sut = self::getContainer()->get(PostsTree::class); } #[DataProvider('provideReOrderNestedPostsData')] diff --git a/be/tests/Repository/Post/PostRepositoryFactoryTest.php b/be/tests/Repository/Post/PostRepositoryFactoryTest.php index 475c2f97..1e113347 100644 --- a/be/tests/Repository/Post/PostRepositoryFactoryTest.php +++ b/be/tests/Repository/Post/PostRepositoryFactoryTest.php @@ -18,8 +18,7 @@ protected function setUp(): void { parent::setUp(); self::bootKernel(); - $container = static::getContainer(); - $this->sut = $container->get(PostRepositoryFactory::class); + $this->sut = static::getContainer()->get(PostRepositoryFactory::class); } #[DataProvider('providePostModelFid')]