Skip to content

Commit 00061dd

Browse files
Merge branch '10.5' into 11.1
2 parents 5b215d0 + 835df17 commit 00061dd

File tree

5 files changed

+58
-1
lines changed

5 files changed

+58
-1
lines changed

.php-cs-fixer.dist.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
->in(__DIR__ . '/tests/end-to-end')
1616
->in(__DIR__ . '/tests/unit')
1717
->notName('DeprecatedPhpFeatureTest.php')
18+
// don't mangle whitespaces in this test, which are required for the error reproduce
19+
->notName('Issue5795Test.php')
1820
->notName('ReadonlyClass.php')
1921
->notName('*.phpt');
2022

ChangeLog-11.1.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ All notable changes of the PHPUnit 11.1 release series are documented in this fi
66

77
### Fixed
88

9+
* [#5795](https://github.com/sebastianbergmann/phpunit/issues/5795): Using `@testWith` annotation may generate `PHP Warning: Uninitialized string offset 0`
910
* [#5807](https://github.com/sebastianbergmann/phpunit/issues/5807): The `#[CoversMethod]` attribute is not considered for risky test check
1011

1112
## [11.1.1] - 2024-04-06

src/Metadata/Api/DataProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ private function dataProvidedByTestWithAnnotation(string $className, string $met
252252
foreach (explode("\n", $annotationContent) as $candidateRow) {
253253
$candidateRow = trim($candidateRow);
254254

255-
if ($candidateRow[0] !== '[') {
255+
if ($candidateRow === '' || $candidateRow[0] !== '[') {
256256
break;
257257
}
258258

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
--TEST--
2+
https://github.com/sebastianbergmann/phpunit/issues/5795
3+
--FILE--
4+
<?php declare(strict_types=1);
5+
$_SERVER['argv'][] = '--do-not-cache-result';
6+
$_SERVER['argv'][] = '--no-configuration';
7+
$_SERVER['argv'][] = '--testdox';
8+
$_SERVER['argv'][] = __DIR__ . '/5795/Issue5795Test.php';
9+
10+
require_once __DIR__ . '/../../bootstrap.php';
11+
12+
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
13+
--EXPECTF--
14+
PHPUnit %s by Sebastian Bergmann and contributors.
15+
16+
Runtime: %s
17+
18+
... 3 / 3 (100%)
19+
20+
Time: %s, Memory: %s
21+
22+
Issue5795 (PHPUnit\TestFixture\Issue5795\Issue5795)
23+
✔ This test should make phpunit spit a PHP Warning ! with data set #0
24+
✔ This test should make phpunit spit a PHP Warning ! with data set #1
25+
✔ This test should make phpunit spit a PHP Warning ! with data set #2
26+
27+
OK (3 tests, 3 assertions)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php declare(strict_types=1);
2+
/*
3+
* This file is part of PHPUnit.
4+
*
5+
* (c) Sebastian Bergmann <sebastian@phpunit.de>
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\Issue5795;
11+
12+
use PHPUnit\Framework\TestCase;
13+
14+
final class Issue5795Test extends TestCase
15+
{
16+
/**
17+
* @testWith [1]
18+
* [2]
19+
* [3]
20+
*
21+
* @testdox This test should make phpunit spit a PHP Warning !
22+
*/
23+
public function testExample($arg): void
24+
{
25+
$this->assertIsInt($arg);
26+
}
27+
}

0 commit comments

Comments
 (0)