Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add compser test:coverage to script section #1110

Merged
merged 2 commits into from
Oct 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@ infection.log
/Infection/
/LOGGER-HTML
reports/
report/
tools/

# Devbox
7 changes: 7 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -40,6 +40,7 @@
"codeception/module-webdriver": "^4.0",
"infection/infection": "^0.26",
"nikic/php-parser": "^4.13",
"nimut/phpunit-merger": "^2.0",
"phpspec/prophecy-phpunit": "^2.0",
"phpstan/extension-installer": "^1.2",
"phpstan/phpstan": "^1.9",
@@ -180,6 +181,12 @@
"@test:functional-sqlite",
"@test:acceptance"
],
"test:coverage": [
"mkdir -p .Logs/coverage",
"XDEBUG_MODE=coverage .Build/bin/phpunit --coverage-filter Classes --coverage-php .Logs/coverage/unit_clover.cov -c Tests/UnitTests.xml Tests/Unit ",
"XDEBUG_MODE=coverage .Build/bin/phpunit --coverage-filter Classes --coverage-php .Logs/coverage/functional_clover.cov -c Tests/FunctionalTests.xml Tests/Functional ",
"XDEBUG_MODE=coverage .Build/bin/phpunit-merger coverage .Logs/coverage/ --html=report .Logs/coverage.xml;"
],
"test:functional": [
"@test:reset-vars",
"@extension-create-libs",

Unchanged files with check annotations Beta

{
$decoded = '';
try {
$decoded = json_decode($dataString, true, 512, JSON_THROW_ON_ERROR);

Check warning on line 43 in Classes/Converter/JsonCompatibilityConverter.php

GitHub Actions / Mutation tests (8.1, ubuntu-latest)

Escaped Mutant for Mutator "DecrementInteger": --- Original +++ New @@ @@ { $decoded = ''; try { - $decoded = json_decode($dataString, true, 512, JSON_THROW_ON_ERROR); + $decoded = json_decode($dataString, true, 511, JSON_THROW_ON_ERROR); } catch (\JsonException) { // Do nothing as we want to continue with unserialize as a test. }

Check warning on line 43 in Classes/Converter/JsonCompatibilityConverter.php

GitHub Actions / Mutation tests (8.1, ubuntu-latest)

Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ { $decoded = ''; try { - $decoded = json_decode($dataString, true, 512, JSON_THROW_ON_ERROR); + $decoded = json_decode($dataString, true, 513, JSON_THROW_ON_ERROR); } catch (\JsonException) { // Do nothing as we want to continue with unserialize as a test. }
} catch (\JsonException) {
// Do nothing as we want to continue with unserialize as a test.
}
{
$reqHeaders = $this->buildRequestHeaders($crawlerId);
$options = [

Check warning on line 49 in Classes/CrawlStrategy/GuzzleExecutionStrategy.php

GitHub Actions / Mutation tests (8.1, ubuntu-latest)

Escaped Mutant for Mutator "ArrayItemRemoval": --- Original +++ New @@ @@ public function fetchUrlContents(UriInterface $url, string $crawlerId) { $reqHeaders = $this->buildRequestHeaders($crawlerId); - $options = ['headers' => $reqHeaders]; + $options = []; if ($url->getUserInfo()) { $options['auth'] = explode(':', $url->getUserInfo()); }
'headers' => $reqHeaders,
];
if ($url->getUserInfo()) {
$options['auth'] = explode(':', $url->getUserInfo());
}
try {

Check warning on line 55 in Classes/CrawlStrategy/GuzzleExecutionStrategy.php

GitHub Actions / Mutation tests (8.1, ubuntu-latest)

Escaped Mutant for Mutator "CatchBlockRemoval": --- Original +++ New @@ @@ $url = (string) $url; $response = $this->getResponse($url, $options); return unserialize($response->getHeaderLine('X-T3Crawler-Meta')); - } catch (RequestException $e) { - $response = $e->getResponse(); - $message = ($response ? $response->getStatusCode() : 0) . chr(32) . ($response ? $response->getReasonPhrase() : $e->getMessage()); - $this->logger->debug(sprintf('Error while opening "%s" - ' . $message, $url), ['crawlerId' => $crawlerId]); - return $message; } catch (ConnectException $e) { $message = $e->getCode() . chr(32) . $e->getMessage(); $this->logger->debug(sprintf('Error while opening "%s" - ' . $message, $url), ['crawlerId' => $crawlerId]);
$url = (string) $url;
$response = $this->getResponse($url, $options);
return unserialize($response->getHeaderLine('X-T3Crawler-Meta'));
*/
private function buildRequestHeaders(string $crawlerId): array
{
return [

Check warning on line 97 in Classes/CrawlStrategy/GuzzleExecutionStrategy.php

GitHub Actions / Mutation tests (8.1, ubuntu-latest)

Escaped Mutant for Mutator "ArrayItemRemoval": --- Original +++ New @@ @@ */ private function buildRequestHeaders(string $crawlerId) : array { - return ['Connection' => 'close', 'X-T3Crawler' => $crawlerId, 'User-Agent' => 'TYPO3 crawler']; + return ['X-T3Crawler' => $crawlerId, 'User-Agent' => 'TYPO3 crawler']; } }
'Connection' => 'close',
'X-T3Crawler' => $crawlerId,
'User-Agent' => 'TYPO3 crawler',
{
$configurationProvider ??= GeneralUtility::makeInstance(ExtensionConfigurationProvider::class);
$settings = $configurationProvider->getExtensionConfiguration();
$this->extensionSettings = is_array($settings) ? $settings : [];

Check warning on line 47 in Classes/CrawlStrategy/SubProcessExecutionStrategy.php

GitHub Actions / Mutation tests (8.1, ubuntu-latest)

Escaped Mutant for Mutator "Ternary": --- Original +++ New @@ @@ { $configurationProvider ??= GeneralUtility::makeInstance(ExtensionConfigurationProvider::class); $settings = $configurationProvider->getExtensionConfiguration(); - $this->extensionSettings = is_array($settings) ? $settings : []; + $this->extensionSettings = is_array($settings) ? [] : $settings; } /** * Fetches a URL by calling a shell script.
}
/**
$url = (string) $url;
$parsedUrl = parse_url($url);
if (!isset($parsedUrl['scheme']) || !in_array($parsedUrl['scheme'], ['', 'http', 'https'], true)) {

Check warning on line 60 in Classes/CrawlStrategy/SubProcessExecutionStrategy.php

GitHub Actions / Mutation tests (8.1, ubuntu-latest)

Escaped Mutant for Mutator "LogicalOr": --- Original +++ New @@ @@ { $url = (string) $url; $parsedUrl = parse_url($url); - if (!isset($parsedUrl['scheme']) || !in_array($parsedUrl['scheme'], ['', 'http', 'https'], true)) { + if (!isset($parsedUrl['scheme']) && !in_array($parsedUrl['scheme'], ['', 'http', 'https'], true)) { $this->logger?->debug(sprintf('Scheme does not match for url "%s"', $url), ['crawlerId' => $crawlerId]); return false; }

Check warning on line 60 in Classes/CrawlStrategy/SubProcessExecutionStrategy.php

GitHub Actions / Mutation tests (8.1, ubuntu-latest)

Escaped Mutant for Mutator "ArrayItemRemoval": --- Original +++ New @@ @@ { $url = (string) $url; $parsedUrl = parse_url($url); - if (!isset($parsedUrl['scheme']) || !in_array($parsedUrl['scheme'], ['', 'http', 'https'], true)) { + if (!isset($parsedUrl['scheme']) || !in_array($parsedUrl['scheme'], ['http', 'https'], true)) { $this->logger?->debug(sprintf('Scheme does not match for url "%s"', $url), ['crawlerId' => $crawlerId]); return false; }

Check warning on line 60 in Classes/CrawlStrategy/SubProcessExecutionStrategy.php

GitHub Actions / Mutation tests (8.1, ubuntu-latest)

Escaped Mutant for Mutator "LogicalNot": --- Original +++ New @@ @@ { $url = (string) $url; $parsedUrl = parse_url($url); - if (!isset($parsedUrl['scheme']) || !in_array($parsedUrl['scheme'], ['', 'http', 'https'], true)) { + if (isset($parsedUrl['scheme']) || !in_array($parsedUrl['scheme'], ['', 'http', 'https'], true)) { $this->logger?->debug(sprintf('Scheme does not match for url "%s"', $url), ['crawlerId' => $crawlerId]); return false; }

Check warning on line 60 in Classes/CrawlStrategy/SubProcessExecutionStrategy.php

GitHub Actions / Mutation tests (8.1, ubuntu-latest)

Escaped Mutant for Mutator "LogicalNot": --- Original +++ New @@ @@ { $url = (string) $url; $parsedUrl = parse_url($url); - if (!isset($parsedUrl['scheme']) || !in_array($parsedUrl['scheme'], ['', 'http', 'https'], true)) { + if (!isset($parsedUrl['scheme']) || in_array($parsedUrl['scheme'], ['', 'http', 'https'], true)) { $this->logger?->debug(sprintf('Scheme does not match for url "%s"', $url), ['crawlerId' => $crawlerId]); return false; }
$this->logger?->debug(sprintf('Scheme does not match for url "%s"', $url), [
'crawlerId' => $crawlerId,
]);