Skip to content

Commit c526be5

Browse files
Merge branch '12.2'
2 parents 14e20a7 + 85e33ba commit c526be5

14 files changed

+74
-3
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@
106106
"tests/unit/Framework/Assert/assertSameTest.php",
107107
"tests/_files/CoveredFunction.php",
108108
"tests/_files/Generator.php",
109-
"tests/_files/NamespaceCoveredFunction.php"
109+
"tests/_files/NamespaceCoveredFunction.php",
110+
"tests/end-to-end/_files/listing-tests-and-groups/ExampleAbstractTestCase.php"
110111
]
111112
},
112113
"extra": {

src/TextUI/Command/Commands/ListTestsAsXmlCommand.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@
1010
namespace PHPUnit\TextUI\Command;
1111

1212
use const PHP_EOL;
13+
use function assert;
1314
use function file_put_contents;
1415
use function ksort;
1516
use function sprintf;
1617
use PHPUnit\Framework\TestCase;
1718
use PHPUnit\Runner\Phpt\TestCase as PhptTestCase;
19+
use ReflectionClass;
1820
use XMLWriter;
1921

2022
/**
@@ -70,9 +72,13 @@ public function execute(): Result
7072
$writer->endElement();
7173
}
7274

75+
$file = (new ReflectionClass($test))->getFileName();
76+
77+
assert($file !== false);
78+
7379
$writer->startElement('testClass');
7480
$writer->writeAttribute('name', $test::class);
75-
$writer->writeAttribute('file', $test->valueObjectForEvents()->file());
81+
$writer->writeAttribute('file', $file);
7682

7783
$currentTestClass = $test::class;
7884
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php declare(strict_types=1);
2+
/*
3+
* This file is part of PHPUnit.
4+
*
5+
* (c) Sebastian Bergmann <[email protected]>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
namespace PHPUnit\TestFixture\ListingTestsAndGroups;
11+
12+
use PHPUnit\Framework\Attributes\Group;
13+
use PHPUnit\Framework\TestCase;
14+
15+
abstract class ExampleAbstractTestCase extends TestCase
16+
{
17+
#[Group('abstract-one')]
18+
public function testOne(): void
19+
{
20+
$this->assertTrue(true);
21+
}
22+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php declare(strict_types=1);
2+
/*
3+
* This file is part of PHPUnit.
4+
*
5+
* (c) Sebastian Bergmann <[email protected]>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
namespace PHPUnit\TestFixture\ListingTestsAndGroups;
11+
12+
final class ExampleExtendingAbstractTest extends ExampleAbstractTestCase
13+
{
14+
}

tests/end-to-end/cli/list-test-files/list-test-files-exclude-group.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ require_once __DIR__ . '/../../../bootstrap.php';
1414
PHPUnit %s by Sebastian Bergmann and contributors.
1515

1616
Available test files:
17+
- %slisting-tests-and-groups%sExampleExtendingAbstractTest.php
1718
- %slisting-tests-and-groups%sExampleTest.php
1819
- %slisting-tests-and-groups%sexample.phpt

tests/end-to-end/cli/list-test-files/list-test-files.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ require_once __DIR__ . '/../../../bootstrap.php';
1212
PHPUnit %s by Sebastian Bergmann and contributors.
1313

1414
Available test files:
15+
- %slisting-tests-and-groups%sExampleExtendingAbstractTest.php
1516
- %slisting-tests-and-groups%sExampleTest.php
1617
- %slisting-tests-and-groups%sexample.phpt

tests/end-to-end/cli/listing-tests-and-groups/list-groups-exclude-group.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@ PHPUnit %s by Sebastian Bergmann and contributors.
1717

1818
Available test groups:
1919
- 3 (1 test)
20+
- abstract-one (1 test)
2021
- default (1 test)
2122
- two (1 test)

tests/end-to-end/cli/listing-tests-and-groups/list-groups.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ PHPUnit %s by Sebastian Bergmann and contributors.
1515

1616
Available test groups:
1717
- 3 (1 test)
18+
- abstract-one (1 test)
1819
- default (1 test)
1920
- one (1 test)
2021
- two (1 test)

tests/end-to-end/cli/listing-tests-and-groups/list-tests-exclude-group.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ require_once __DIR__ . '/../../../bootstrap.php';
1616
PHPUnit %s by Sebastian Bergmann and contributors.
1717

1818
Available tests:
19+
- PHPUnit\TestFixture\ListingTestsAndGroups\ExampleExtendingAbstractTest::testOne
1920
- PHPUnit\TestFixture\ListingTestsAndGroups\ExampleTest::testTwo
2021
- PHPUnit\TestFixture\ListingTestsAndGroups\ExampleTest::testThree
2122
- %sexample.phpt

tests/end-to-end/cli/listing-tests-and-groups/list-tests-include-filter.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ require_once __DIR__ . '/../../../bootstrap.php';
1515
--EXPECTF--
1616
PHPUnit %s by Sebastian Bergmann and contributors.
1717

18-
Available test:
18+
Available tests:
19+
- PHPUnit\TestFixture\ListingTestsAndGroups\ExampleExtendingAbstractTest::testOne
1920
- PHPUnit\TestFixture\ListingTestsAndGroups\ExampleTest::testOne

0 commit comments

Comments
 (0)