Skip to content

Commit 386eb5e

Browse files
Merge branch '11.0'
2 parents 8b0fe9e + a8a28e9 commit 386eb5e

File tree

5 files changed

+111
-0
lines changed

5 files changed

+111
-0
lines changed

src/Framework/TestRunner.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ public function run(TestCase $test): void
164164
$test->valueObjectForEvents(),
165165
$cce->getMessage(),
166166
);
167+
168+
$append = false;
167169
}
168170
}
169171

tests/end-to-end/regression/5351.phpt

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
--TEST--
2+
https://github.com/sebastianbergmann/phpunit/issues/5351
3+
--INI--
4+
pcov.directory=tests/end-to-end/regression/5351/src/
5+
--SKIPIF--
6+
<?php declare(strict_types=1);
7+
require __DIR__ . '/../../_files/skip-if-requires-code-coverage-driver.php';
8+
--FILE--
9+
<?php declare(strict_types=1);
10+
$_SERVER['argv'][] = '--do-not-cache-result';
11+
$_SERVER['argv'][] = '--colors=never';
12+
$_SERVER['argv'][] = '--coverage-text';
13+
$_SERVER['argv'][] = '--configuration';
14+
$_SERVER['argv'][] = __DIR__ . '/5351/phpunit.xml';
15+
16+
require_once __DIR__ . '/../../bootstrap.php';
17+
18+
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
19+
--EXPECTF--
20+
PHPUnit %s by Sebastian Bergmann and contributors.
21+
22+
Runtime: %s
23+
Configuration: %s
24+
25+
W 1 / 1 (100%)
26+
27+
Time: %s, Memory: %s MB
28+
29+
1 test triggered 1 PHPUnit warning:
30+
31+
1) PHPUnit\TestFixture\Issue5351\GreeterTest::testGreets
32+
Class "PHPUnit\TestFixture\Issue5351\DoesNotExist" is not a valid target for code coverage
33+
34+
%sGreeterTest.php:18
35+
36+
WARNINGS!
37+
Tests: 1, Assertions: 1, Warnings: 1.
38+
39+
40+
Code Coverage Report:
41+
%s
42+
43+
Summary:
44+
Classes: 0.00% (0/1)
45+
Methods: 0.00% (0/1)
46+
Lines: 0.00% (0/1)
47+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="../../../../phpunit.xsd"
4+
bootstrap="src/Greeter.php"
5+
executionOrder="depends,defects"
6+
requireCoverageMetadata="true"
7+
beStrictAboutCoverageMetadata="true"
8+
beStrictAboutOutputDuringTests="true"
9+
failOnRisky="true"
10+
failOnWarning="true">
11+
<testsuites>
12+
<testsuite name="default">
13+
<directory>tests</directory>
14+
</testsuite>
15+
</testsuites>
16+
17+
<source restrictDeprecations="true" restrictNotices="true" restrictWarnings="true">
18+
<include>
19+
<directory>src</directory>
20+
</include>
21+
</source>
22+
</phpunit>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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\Issue5351;
11+
12+
final class Greeter
13+
{
14+
public function greet(): string
15+
{
16+
return 'Hello world!';
17+
}
18+
}
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\Issue5351;
11+
12+
use PHPUnit\Framework\Attributes\CoversClass;
13+
use PHPUnit\Framework\TestCase;
14+
15+
#[CoversClass('PHPUnit\TestFixture\Issue5351\DoesNotExist')]
16+
final class GreeterTest extends TestCase
17+
{
18+
public function testGreets(): void
19+
{
20+
$this->assertSame('Hello world!', (new Greeter)->greet());
21+
}
22+
}

0 commit comments

Comments
 (0)