Skip to content

Fix #7: Validate that DataReader is not both sortable and limited for GridView #542

Fix #7: Validate that DataReader is not both sortable and limited for GridView

Fix #7: Validate that DataReader is not both sortable and limited for GridView #542

Triggered via pull request November 8, 2024 20:36
Status Success
Total duration 2m 13s
Artifacts

mutation.yml

on: pull_request
Matrix: mutation / roave-infection
Fit to window
Zoom out
Zoom in

Annotations

10 warnings
mutation / PHP 8.2-ubuntu-latest: src/BaseListView.php#L274
Escaped Mutant for Mutator "ProtectedVisibility": --- Original +++ New @@ @@ * * @psalm-return list{FilterInterface[]|null,ValidationResult} */ - protected function makeFilters() : array + private function makeFilters() : array { return [[], new ValidationResult()]; }
mutation / PHP 8.2-ubuntu-latest: src/BaseListView.php#L350
Escaped Mutant for Mutator "NotIdentical": --- Original +++ New @@ @@ private function prepareDataReaderByParams(?string $page, ?string $previousPage, ?string $pageSize, ?string $sort, array $filters) : ReadableDataInterface { $dataReader = $this->getDataReader(); - if ($dataReader instanceof LimitableDataInterface && $dataReader->getLimit() !== null) { + if ($dataReader instanceof LimitableDataInterface && $dataReader->getLimit() === null) { // Disable sorting for data reader with pre-defined limit. $sort = null; }
mutation / PHP 8.2-ubuntu-latest: src/BaseListView.php#L350
Escaped Mutant for Mutator "LogicalAndNegation": --- Original +++ New @@ @@ private function prepareDataReaderByParams(?string $page, ?string $previousPage, ?string $pageSize, ?string $sort, array $filters) : ReadableDataInterface { $dataReader = $this->getDataReader(); - if ($dataReader instanceof LimitableDataInterface && $dataReader->getLimit() !== null) { + if (!($dataReader instanceof LimitableDataInterface && $dataReader->getLimit() !== null)) { // Disable sorting for data reader with pre-defined limit. $sort = null; }
mutation / PHP 8.2-ubuntu-latest: src/BaseListView.php#L357
Escaped Mutant for Mutator "LogicalAnd": --- Original +++ New @@ @@ $sort = null; } if (!$dataReader instanceof PaginatorInterface) { - if ($dataReader instanceof OffsetableDataInterface && $dataReader instanceof CountableDataInterface && $dataReader instanceof LimitableDataInterface) { + if (($dataReader instanceof OffsetableDataInterface || $dataReader instanceof CountableDataInterface) && $dataReader instanceof LimitableDataInterface) { $dataReader = new OffsetPaginator($dataReader); } elseif ($dataReader instanceof FilterableDataInterface && $dataReader instanceof SortableDataInterface && $dataReader instanceof LimitableDataInterface) { if ($dataReader->getSort() !== null) {
mutation / PHP 8.2-ubuntu-latest: src/BaseListView.php#L377
Escaped Mutant for Mutator "IfNegation": --- Original +++ New @@ @@ return $dataReader; } } - if ($dataReader->isPaginationRequired()) { + if (!$dataReader->isPaginationRequired()) { if ($pageSize !== null) { $dataReader = $dataReader->withPageSize((int) $pageSize); }
mutation / PHP 8.2-ubuntu-latest: src/BaseListView.php#L389
Escaped Mutant for Mutator "LogicalAndSingleSubExprNegation": --- Original +++ New @@ @@ $dataReader = $dataReader->withToken(PageToken::previous($previousPage)); } } - if (!empty($sort) && $dataReader->isSortable()) { + if (!empty($sort) && !$dataReader->isSortable()) { $sortObject = $dataReader->getSort(); if ($sortObject !== null) { $order = OrderHelper::stringToArray($sort);
mutation / PHP 8.2-ubuntu-latest: src/BaseListView.php#L401
Escaped Mutant for Mutator "LogicalAnd": --- Original +++ New @@ @@ $dataReader = $dataReader->withSort($sortObject->withOrder($order)); } } - if (!empty($filters) && $dataReader->isFilterable()) { + if (!empty($filters) || $dataReader->isFilterable()) { $dataReader = $dataReader->withFilter(new All(...$filters)); } return $dataReader;
mutation / PHP 8.2-ubuntu-latest: src/BaseListView.php#L401
Escaped Mutant for Mutator "LogicalAndNegation": --- Original +++ New @@ @@ $dataReader = $dataReader->withSort($sortObject->withOrder($order)); } } - if (!empty($filters) && $dataReader->isFilterable()) { + if (!(!empty($filters) && $dataReader->isFilterable())) { $dataReader = $dataReader->withFilter(new All(...$filters)); } return $dataReader;
mutation / PHP 8.2-ubuntu-latest: src/BaseListView.php#L401
Escaped Mutant for Mutator "LogicalAndSingleSubExprNegation": --- Original +++ New @@ @@ $dataReader = $dataReader->withSort($sortObject->withOrder($order)); } } - if (!empty($filters) && $dataReader->isFilterable()) { + if (!empty($filters) && !$dataReader->isFilterable()) { $dataReader = $dataReader->withFilter(new All(...$filters)); } return $dataReader;
mutation / PHP 8.2-ubuntu-latest: src/BaseListView.php#L489
Escaped Mutant for Mutator "CloneRemoval": --- Original +++ New @@ @@ */ public function offsetPaginationConfig(array $config) : static { - $new = clone $this; + $new = $this; $new->offsetPaginationConfig = $config; return $new; }