Skip to content

Fix some issues in Statement class #584

Fix some issues in Statement class

Fix some issues in Statement class #584

Triggered via pull request February 8, 2024 15:02
Status Failure
Total duration 4m 2s
Artifacts

mutation-tests.yml

on: pull_request
Matrix: tests
Fit to window
Zoom out
Zoom in

Annotations

1 error and 12 warnings
Mutation tests with PHP 8.1
Process completed with exit code 1.
Mutation tests with PHP 8.1
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/.
Mutation tests with PHP 8.1: src/Statement.php#L92
Escaped Mutant for Mutator "LogicalOr": --- Original +++ New @@ @@ */ public function __construct(Parser|null $parser = null, TokensList|null $list = null) { - if ($parser === null || $list === null) { + if ($parser === null && $list === null) { return; } $this->parse($parser, $list);
Mutation tests with PHP 8.1: src/Statement.php#L144
Escaped Mutant for Mutator "UnwrapTrim": --- Original +++ New @@ @@ } // Checking if the name of the clause should be added. if ($type & self::ADD_KEYWORD) { - $query = trim($query) . ' ' . $name; + $query = $query . ' ' . $name; } // Checking if the result of the builder should be added. if (!($type & self::ADD_CLAUSE)) {
Mutation tests with PHP 8.1: src/Statement.php#L156
Escaped Mutant for Mutator "UnwrapTrim": --- Original +++ New @@ @@ $class = Parser::KEYWORD_PARSERS[$name]['class']; $query = trim($query) . ' ' . $class::buildAll($this->{$field}); } else { - $query = trim($query) . ' ' . $this->{$field}->build(); + $query = $query . ' ' . $this->{$field}->build(); } } return $query;
Mutation tests with PHP 8.1: src/Statement.php#L171
Escaped Mutant for Mutator "PublicVisibility": --- Original +++ New @@ @@ * * @throws ParserException */ - public function parse(Parser $parser, TokensList $list) : void + protected function parse(Parser $parser, TokensList $list) : void { /** * Array containing all list of clauses parsed.
Mutation tests with PHP 8.1: src/Statement.php#L234
Escaped Mutant for Mutator "InstanceOf_": --- Original +++ New @@ @@ // ON DUPLICATE KEY UPDATE ... // has to be parsed in parent statement (INSERT or REPLACE) // so look for it and break - if ($this instanceof SelectStatement && $token->value === 'ON') { + if (true && $token->value === 'ON') { ++$list->idx; // Skip ON // look for ON DUPLICATE KEY UPDATE
Mutation tests with PHP 8.1: src/Statement.php#L234
Escaped Mutant for Mutator "LogicalAnd": --- Original +++ New @@ @@ // ON DUPLICATE KEY UPDATE ... // has to be parsed in parent statement (INSERT or REPLACE) // so look for it and break - if ($this instanceof SelectStatement && $token->value === 'ON') { + if ($this instanceof SelectStatement || $token->value === 'ON') { ++$list->idx; // Skip ON // look for ON DUPLICATE KEY UPDATE
Mutation tests with PHP 8.1: src/Statement.php#L243
Escaped Mutant for Mutator "LogicalAnd": --- Original +++ New @@ @@ $first = $list->getNextOfType(TokenType::Keyword); $second = $list->getNextOfType(TokenType::Keyword); $third = $list->getNextOfType(TokenType::Keyword); - if ($first && $second && $third && $first->value === 'DUPLICATE' && $second->value === 'KEY' && $third->value === 'UPDATE') { + if (($first || $second) && $third && $first->value === 'DUPLICATE' && $second->value === 'KEY' && $third->value === 'UPDATE') { $list->idx = $lastIdx; break; }
Mutation tests with PHP 8.1: src/Statement.php#L243
Escaped Mutant for Mutator "LogicalAnd": --- Original +++ New @@ @@ $first = $list->getNextOfType(TokenType::Keyword); $second = $list->getNextOfType(TokenType::Keyword); $third = $list->getNextOfType(TokenType::Keyword); - if ($first && $second && $third && $first->value === 'DUPLICATE' && $second->value === 'KEY' && $third->value === 'UPDATE') { + if (($first && $second || $third) && $first->value === 'DUPLICATE' && $second->value === 'KEY' && $third->value === 'UPDATE') { $list->idx = $lastIdx; break; }
Mutation tests with PHP 8.1: src/Statement.php#L243
Escaped Mutant for Mutator "LogicalAnd": --- Original +++ New @@ @@ $first = $list->getNextOfType(TokenType::Keyword); $second = $list->getNextOfType(TokenType::Keyword); $third = $list->getNextOfType(TokenType::Keyword); - if ($first && $second && $third && $first->value === 'DUPLICATE' && $second->value === 'KEY' && $third->value === 'UPDATE') { + if (($first && $second && $third || $first->value === 'DUPLICATE') && $second->value === 'KEY' && $third->value === 'UPDATE') { $list->idx = $lastIdx; break; }
Mutation tests with PHP 8.1: src/Statement.php#L243
Escaped Mutant for Mutator "LogicalAnd": --- Original +++ New @@ @@ $first = $list->getNextOfType(TokenType::Keyword); $second = $list->getNextOfType(TokenType::Keyword); $third = $list->getNextOfType(TokenType::Keyword); - if ($first && $second && $third && $first->value === 'DUPLICATE' && $second->value === 'KEY' && $third->value === 'UPDATE') { + if (($first && $second && $third && $first->value === 'DUPLICATE' || $second->value === 'KEY') && $third->value === 'UPDATE') { $list->idx = $lastIdx; break; }
Mutation tests with PHP 8.1
The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/