Skip to content

Fix http_build_query in OTP class (#215) #4

Fix http_build_query in OTP class (#215)

Fix http_build_query in OTP class (#215) #4

Triggered via push April 15, 2024 07:35
Status Success
Total duration 55s
Artifacts

infection.yml

on: push
5️⃣ Mutation Testing
46s
5️⃣ Mutation Testing
Fit to window
Zoom out
Zoom in

Annotations

11 warnings
5️⃣ Mutation Testing
Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: actions/checkout@v3, actions/cache@v3. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.
5️⃣ Mutation Testing: src/Factory.php#L23
Escaped Mutant for Mutator "Throw_": --- Original +++ New @@ @@ { try { $parsed_url = Url::fromString($uri); - $parsed_url->getScheme() === 'otpauth' || throw new InvalidArgumentException('Invalid scheme.'); + $parsed_url->getScheme() === 'otpauth' || new InvalidArgumentException('Invalid scheme.'); } catch (Throwable $throwable) { throw new InvalidArgumentException('Not a valid OTP provisioning URI', $throwable->getCode(), $throwable); }
5️⃣ Mutation Testing: src/Factory.php#L23
Escaped Mutant for Mutator "LogicalOrNegation": --- Original +++ New @@ @@ { try { $parsed_url = Url::fromString($uri); - $parsed_url->getScheme() === 'otpauth' || throw new InvalidArgumentException('Invalid scheme.'); + !($parsed_url->getScheme() === 'otpauth' || throw new InvalidArgumentException('Invalid scheme.')); } catch (Throwable $throwable) { throw new InvalidArgumentException('Not a valid OTP provisioning URI', $throwable->getCode(), $throwable); }
5️⃣ Mutation Testing: src/Factory.php#L54
Escaped Mutant for Mutator "LogicalOrNegation": --- Original +++ New @@ @@ return; } if ($otp->getIssuer() !== null) { - $result[0] === $otp->getIssuer() || throw new InvalidArgumentException('Invalid OTP: invalid issuer in parameter'); + !($result[0] === $otp->getIssuer() || throw new InvalidArgumentException('Invalid OTP: invalid issuer in parameter')); $otp->setIssuerIncludedAsParameter(true); } assert($result[0] !== '');
5️⃣ Mutation Testing: src/Factory.php#L57
Escaped Mutant for Mutator "MethodCallRemoval": --- Original +++ New @@ @@ } if ($otp->getIssuer() !== null) { $result[0] === $otp->getIssuer() || throw new InvalidArgumentException('Invalid OTP: invalid issuer in parameter'); - $otp->setIssuerIncludedAsParameter(true); + } assert($result[0] !== ''); $otp->setIssuer($result[0]);
5️⃣ Mutation Testing: src/Factory.php#L62
Escaped Mutant for Mutator "MethodCallRemoval": --- Original +++ New @@ @@ $otp->setIssuerIncludedAsParameter(true); } assert($result[0] !== ''); - $otp->setIssuer($result[0]); + } private static function createOTP(Url $parsed_url): OTPInterface {
5️⃣ Mutation Testing: src/HOTP.php#L39
Escaped Mutant for Mutator "MethodCallRemoval": --- Original +++ New @@ @@ $htop = new self($secret); $htop->setCounter(self::DEFAULT_COUNTER); $htop->setDigest(self::DEFAULT_DIGEST); - $htop->setDigits(self::DEFAULT_DIGITS); + return $htop; } public static function generate(): self
5️⃣ Mutation Testing: src/HOTP.php#L52
Escaped Mutant for Mutator "LogicalAnd": --- Original +++ New @@ @@ public function getCounter(): int { $value = $this->getParameter('counter'); - is_int($value) && $value >= 0 || throw new InvalidArgumentException('Invalid "counter" parameter.'); + is_int($value) || $value >= 0 || throw new InvalidArgumentException('Invalid "counter" parameter.'); return $value; } public function getProvisioningUri(): string
5️⃣ Mutation Testing: src/HOTP.php#L52
Escaped Mutant for Mutator "Throw_": --- Original +++ New @@ @@ public function getCounter(): int { $value = $this->getParameter('counter'); - is_int($value) && $value >= 0 || throw new InvalidArgumentException('Invalid "counter" parameter.'); + is_int($value) && $value >= 0 || new InvalidArgumentException('Invalid "counter" parameter.'); return $value; } public function getProvisioningUri(): string
5️⃣ Mutation Testing: src/HOTP.php#L52
Escaped Mutant for Mutator "LogicalOrNegation": --- Original +++ New @@ @@ public function getCounter(): int { $value = $this->getParameter('counter'); - is_int($value) && $value >= 0 || throw new InvalidArgumentException('Invalid "counter" parameter.'); + !(is_int($value) && $value >= 0 || throw new InvalidArgumentException('Invalid "counter" parameter.')); return $value; } public function getProvisioningUri(): string
5️⃣ Mutation Testing: src/HOTP.php#L59
Escaped Mutant for Mutator "ArrayItemRemoval": --- Original +++ New @@ @@ } public function getProvisioningUri(): string { - return $this->generateURI('hotp', ['counter' => $this->getCounter()]); + return $this->generateURI('hotp', []); } /** * If the counter is not provided, the OTP is verified at the actual counter.