Skip to content

Commit

Permalink
increase coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
joke2k committed Jan 4, 2024
1 parent dd0a485 commit afd7b7d
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 7 deletions.
10 changes: 6 additions & 4 deletions src/TextUI/Command/Commands/ListTestFilesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ public function execute(): Result
if ($test instanceof TestCase) {
$name = (new ReflectionClass($test))->getFileName();

// @codeCoverageIgnoreStart
if ($name === false) {
continue;
}
// @codeCoverageIgnoreEnd

if ($configuration->hasGroups() && empty(array_intersect($configuration->groups(), $test->groups()))) {
continue;
}
Expand All @@ -60,10 +66,6 @@ public function execute(): Result
continue;

Check warning on line 66 in src/TextUI/Command/Commands/ListTestFilesCommand.php

View check run for this annotation

Codecov / codecov/patch

src/TextUI/Command/Commands/ListTestFilesCommand.php#L66

Added line #L66 was not covered by tests
}

if (!$name) {
continue;
}

$results[] = $name;
}

Expand Down
15 changes: 15 additions & 0 deletions tests/end-to-end/cli/list-file-tests/list-phpt-test-files.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
--TEST--
phpunit --list-test-files list-phpt-test-files.phpt
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][] = '--do-not-cache-result';
$_SERVER['argv'][] = '--list-test-files';
$_SERVER['argv'][] = __DIR__.'/list-phpt-test-files.phpt';

require_once __DIR__ . '/../../../bootstrap.php';
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.

Available test files:
- %send-to-end%slist-phpt-test-files.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
--TEST--
phpunit --list-tests --exclude-group group ../../../_files/Metadata/Annotation/tests/GroupTest.php
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][] = '--do-not-cache-result';
$_SERVER['argv'][] = '--list-test-files';
$_SERVER['argv'][] = '--exclude-group';
$_SERVER['argv'][] = 'group';
$_SERVER['argv'][] = __DIR__.'/../../../_files/Metadata/Annotation/tests/GroupTest.php';

require_once __DIR__ . '/../../../bootstrap.php';
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.

Available test files:
17 changes: 17 additions & 0 deletions tests/end-to-end/cli/list-file-tests/list-test-files-group.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--TEST--
phpunit --list-tests --group group ../../../_files/Metadata/Annotation/tests/
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][] = '--do-not-cache-result';
$_SERVER['argv'][] = '--list-test-files';
$_SERVER['argv'][] = '--group';
$_SERVER['argv'][] = 'group';
$_SERVER['argv'][] = __DIR__.'/../../../_files/Metadata/Annotation/tests/';

require_once __DIR__ . '/../../../bootstrap.php';
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.

Available test files:
- %Annotation%sGroupTest.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
--TEST--
phpunit --list-tests ../../../_files/DataProviderTest.php
phpunit --list-test-files --configuration ../../../_files/basic/configuration.basic.xml
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][] = '--do-not-cache-result';
$_SERVER['argv'][] = '--list-test-files';
$_SERVER['argv'][] = '--configuration';
$_SERVER['argv'][] = __DIR__.'/../_files/basic/configuration.basic.xml';
$_SERVER['argv'][] = __DIR__.'/../../_files/basic/configuration.basic.xml';

require_once __DIR__ . '/../../bootstrap.php';
require_once __DIR__ . '/../../../bootstrap.php';
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.
Expand Down

0 comments on commit afd7b7d

Please sign in to comment.