Skip to content

Commit a5c7191

Browse files
kubawerlossebastianbergmann
authored andcommitted
Add test showing current behaviour
1 parent 864ab32 commit a5c7191

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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;
11+
12+
use PHPUnit\Framework\Attributes\DataProvider;
13+
use PHPUnit\Framework\Attributes\Depends;
14+
use PHPUnit\Framework\TestCase;
15+
16+
final class DataProviderDependencyVoidTest extends TestCase
17+
{
18+
public static function provider(): iterable
19+
{
20+
return [
21+
[0, 0],
22+
[1, 'b' => 1],
23+
['a' => 2, 'b' => 2],
24+
['b' => 3, 'a' => 3],
25+
];
26+
}
27+
28+
#[DataProvider('provider')]
29+
#[Depends('testDependency')]
30+
public function testEquality($a, $b): void
31+
{
32+
$this->assertSame($a, $b);
33+
}
34+
35+
public function testDependency(): void
36+
{
37+
$this->assertTrue(true);
38+
}
39+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
--TEST--
2+
phpunit ../../_files/DataProviderDependencyVoidTest.php
3+
--FILE--
4+
<?php declare(strict_types=1);
5+
$_SERVER['argv'][] = '--do-not-cache-result';
6+
$_SERVER['argv'][] = '--no-configuration';
7+
$_SERVER['argv'][] = __DIR__ . '/../../_files/DataProviderDependencyVoidTest.php';
8+
9+
require_once __DIR__ . '/../../bootstrap.php';
10+
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
11+
--EXPECTF--
12+
PHPUnit %s by Sebastian Bergmann and contributors.
13+
14+
Runtime: %s
15+
16+
..EEE 5 / 5 (100%)
17+
18+
Time: %s, Memory: %s
19+
20+
There were 3 errors:
21+
22+
1) PHPUnit\TestFixture\DataProviderDependencyVoidTest::testEquality with data set #1 (1, 1)
23+
Error: Cannot use positional argument after named argument during unpacking
24+
25+
2) PHPUnit\TestFixture\DataProviderDependencyVoidTest::testEquality with data set #2 (2, 2)
26+
Error: Cannot use positional argument after named argument during unpacking
27+
28+
3) PHPUnit\TestFixture\DataProviderDependencyVoidTest::testEquality with data set #3 (3, 3)
29+
Error: Cannot use positional argument after named argument during unpacking
30+
31+
ERRORS!
32+
Tests: 5, Assertions: 2, Errors: 3.

0 commit comments

Comments
 (0)