Adjust SheetRange
& GoogleSheetExtractor
with to low values
#100
Annotations
10 warnings
Mutation Tests:
src/adapter/etl-adapter-avro/src/Flow/ETL/Adapter/Avro/FlixTech/ValueConverter.php#L38
Escaped Mutant for Mutator "Identical":
--- Original
+++ New
@@ @@
foreach ($data as $entry => $value) {
$avroType = $this->type($entry);
if ($avroType !== null && \is_array($avroType[\AvroSchema::TYPE_ATTR])) {
- if (($avroType[\AvroSchema::TYPE_ATTR][\AvroSchema::TYPE_ATTR] ?? null) === \AvroSchema::LONG_TYPE && \array_key_exists(\AvroSchema::LOGICAL_TYPE_ATTR, $avroType) && $avroType[\AvroSchema::LOGICAL_TYPE_ATTR] === 'timestamp-micros') {
+ if (($avroType[\AvroSchema::TYPE_ATTR][\AvroSchema::TYPE_ATTR] ?? null) !== \AvroSchema::LONG_TYPE && \array_key_exists(\AvroSchema::LOGICAL_TYPE_ATTR, $avroType) && $avroType[\AvroSchema::LOGICAL_TYPE_ATTR] === 'timestamp-micros') {
$convertedData[$entry] = \DateTimeImmutable::createFromFormat('U.u', \implode('.', \str_split((string) $value, 10)));
} elseif (($avroType[\AvroSchema::TYPE_ATTR][\AvroSchema::TYPE_ATTR] ?? null) === \AvroSchema::ARRAY_SCHEMA && \array_key_exists(\AvroSchema::LOGICAL_TYPE_ATTR, $avroType[\AvroSchema::TYPE_ATTR]) && $avroType[\AvroSchema::TYPE_ATTR][\AvroSchema::LOGICAL_TYPE_ATTR] === 'timestamp-micros') {
$convertedData[$entry] = \array_map(static fn(int $timestamp): \DateTimeImmutable => \DateTimeImmutable::createFromFormat('U.u', \implode('.', \str_split((string) $timestamp, 10))), $value);
|
Mutation Tests:
src/adapter/etl-adapter-avro/src/Flow/ETL/Adapter/Avro/FlixTech/ValueConverter.php#L38
Escaped Mutant for Mutator "LogicalAnd":
--- Original
+++ New
@@ @@
foreach ($data as $entry => $value) {
$avroType = $this->type($entry);
if ($avroType !== null && \is_array($avroType[\AvroSchema::TYPE_ATTR])) {
- if (($avroType[\AvroSchema::TYPE_ATTR][\AvroSchema::TYPE_ATTR] ?? null) === \AvroSchema::LONG_TYPE && \array_key_exists(\AvroSchema::LOGICAL_TYPE_ATTR, $avroType) && $avroType[\AvroSchema::LOGICAL_TYPE_ATTR] === 'timestamp-micros') {
+ if ((($avroType[\AvroSchema::TYPE_ATTR][\AvroSchema::TYPE_ATTR] ?? null) === \AvroSchema::LONG_TYPE || \array_key_exists(\AvroSchema::LOGICAL_TYPE_ATTR, $avroType)) && $avroType[\AvroSchema::LOGICAL_TYPE_ATTR] === 'timestamp-micros') {
$convertedData[$entry] = \DateTimeImmutable::createFromFormat('U.u', \implode('.', \str_split((string) $value, 10)));
} elseif (($avroType[\AvroSchema::TYPE_ATTR][\AvroSchema::TYPE_ATTR] ?? null) === \AvroSchema::ARRAY_SCHEMA && \array_key_exists(\AvroSchema::LOGICAL_TYPE_ATTR, $avroType[\AvroSchema::TYPE_ATTR]) && $avroType[\AvroSchema::TYPE_ATTR][\AvroSchema::LOGICAL_TYPE_ATTR] === 'timestamp-micros') {
$convertedData[$entry] = \array_map(static fn(int $timestamp): \DateTimeImmutable => \DateTimeImmutable::createFromFormat('U.u', \implode('.', \str_split((string) $timestamp, 10))), $value);
|
Mutation Tests:
src/adapter/etl-adapter-avro/src/Flow/ETL/Adapter/Avro/FlixTech/ValueConverter.php#L40
Escaped Mutant for Mutator "Identical":
--- Original
+++ New
@@ @@
foreach ($data as $entry => $value) {
$avroType = $this->type($entry);
if ($avroType !== null && \is_array($avroType[\AvroSchema::TYPE_ATTR])) {
- if (($avroType[\AvroSchema::TYPE_ATTR][\AvroSchema::TYPE_ATTR] ?? null) === \AvroSchema::LONG_TYPE && \array_key_exists(\AvroSchema::LOGICAL_TYPE_ATTR, $avroType) && $avroType[\AvroSchema::LOGICAL_TYPE_ATTR] === 'timestamp-micros') {
+ if (($avroType[\AvroSchema::TYPE_ATTR][\AvroSchema::TYPE_ATTR] ?? null) === \AvroSchema::LONG_TYPE && \array_key_exists(\AvroSchema::LOGICAL_TYPE_ATTR, $avroType) && $avroType[\AvroSchema::LOGICAL_TYPE_ATTR] !== 'timestamp-micros') {
$convertedData[$entry] = \DateTimeImmutable::createFromFormat('U.u', \implode('.', \str_split((string) $value, 10)));
} elseif (($avroType[\AvroSchema::TYPE_ATTR][\AvroSchema::TYPE_ATTR] ?? null) === \AvroSchema::ARRAY_SCHEMA && \array_key_exists(\AvroSchema::LOGICAL_TYPE_ATTR, $avroType[\AvroSchema::TYPE_ATTR]) && $avroType[\AvroSchema::TYPE_ATTR][\AvroSchema::LOGICAL_TYPE_ATTR] === 'timestamp-micros') {
$convertedData[$entry] = \array_map(static fn(int $timestamp): \DateTimeImmutable => \DateTimeImmutable::createFromFormat('U.u', \implode('.', \str_split((string) $timestamp, 10))), $value);
|
Mutation Tests:
src/adapter/etl-adapter-avro/src/Flow/ETL/Adapter/Avro/FlixTech/ValueConverter.php#L58
Escaped Mutant for Mutator "LogicalAnd":
--- Original
+++ New
@@ @@
$convertedData[$entry] = $value;
}
} else {
- if ($avroType[\AvroSchema::TYPE_ATTR] === \AvroSchema::LONG_TYPE && \array_key_exists(\AvroSchema::LOGICAL_TYPE_ATTR, $avroType) && $avroType[\AvroSchema::LOGICAL_TYPE_ATTR] === 'timestamp-micros') {
+ if (($avroType[\AvroSchema::TYPE_ATTR] === \AvroSchema::LONG_TYPE || \array_key_exists(\AvroSchema::LOGICAL_TYPE_ATTR, $avroType)) && $avroType[\AvroSchema::LOGICAL_TYPE_ATTR] === 'timestamp-micros') {
$convertedData[$entry] = \DateTimeImmutable::createFromFormat('U.u', \implode('.', \str_split((string) $value, 10)));
} else {
$convertedData[$entry] = $value;
|
Mutation Tests:
src/adapter/etl-adapter-avro/src/Flow/ETL/Adapter/Avro/FlixTech/ValueConverter.php#L72
Escaped Mutant for Mutator "ArrayOneItem":
--- Original
+++ New
@@ @@
}
}
}
- return $convertedData;
+ return count($convertedData) > 1 ? array_slice($convertedData, 0, 1, true) : $convertedData;
}
private function type(string $entry) : ?array
{
|
Mutation Tests:
src/adapter/etl-adapter-chartjs/src/Flow/ETL/Adapter/ChartJS/Chart/BarChart.php#L51
Escaped Mutant for Mutator "CastString":
--- Original
+++ New
@@ @@
{
foreach ($rows as $row) {
/** @phpstan-ignore-next-line */
- $this->data['labels'][] = (string) $row->valueOf($this->label);
+ $this->data['labels'][] = $row->valueOf($this->label);
foreach ($this->datasets as $dataset) {
if (!\array_key_exists($dataset->name(), $this->data['datasets'])) {
$this->data['datasets'][$dataset->name()] = ['label' => $dataset->name(), 'data' => [$row->valueOf($dataset)]];
|
Mutation Tests:
src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/Pages.php#L15
Escaped Mutant for Mutator "RoundingFamily":
--- Original
+++ New
@@ @@
}
public function pages() : int
{
- return (int) \ceil($this->total / $this->pageSize);
+ return (int) round($this->total / $this->pageSize);
}
}
|
Mutation Tests:
src/adapter/etl-adapter-google-sheet/src/Flow/ETL/Adapter/GoogleSheet/GoogleSheetExtractor.php#L28
Escaped Mutant for Mutator "LessThan":
--- Original
+++ New
@@ @@
*/
public function __construct(private readonly Sheets $service, private readonly string $spreadsheetId, private readonly Columns $columnRange, private readonly bool $withHeader, private readonly int $rowsInBatch, private readonly array $options = [])
{
- if ($this->rowsInBatch < 1) {
+ if ($this->rowsInBatch <= 1) {
throw new InvalidArgumentException('Rows in batch must be greater than 0');
}
}
|
Mutation Tests:
src/adapter/etl-adapter-google-sheet/src/Flow/ETL/Adapter/GoogleSheet/GoogleSheetExtractor.php#L39
Escaped Mutant for Mutator "IncrementInteger":
--- Original
+++ New
@@ @@
*/
public function extract(FlowContext $context) : \Generator
{
- $cellsRange = new SheetRange($this->columnRange, 1, $this->rowsInBatch);
+ $cellsRange = new SheetRange($this->columnRange, 2, $this->rowsInBatch);
$headers = [];
$totalRows = 0;
/** @var Sheets\ValueRange $response */
|
Mutation Tests:
src/adapter/etl-adapter-google-sheet/src/Flow/ETL/Adapter/GoogleSheet/GoogleSheetExtractor.php#L42
Escaped Mutant for Mutator "DecrementInteger":
--- Original
+++ New
@@ @@
{
$cellsRange = new SheetRange($this->columnRange, 1, $this->rowsInBatch);
$headers = [];
- $totalRows = 0;
+ $totalRows = -1;
/** @var Sheets\ValueRange $response */
$response = $this->service->spreadsheets_values->get($this->spreadsheetId, $cellsRange->toString(), $this->options);
/** @var array[] $values */
|
The logs for this run have expired and are no longer available.
Loading