Skip to content

Commit e92077d

Browse files
Move test to correct location
1 parent f4532ef commit e92077d

File tree

2 files changed

+29
-38
lines changed

2 files changed

+29
-38
lines changed

tests/unit/Framework/Attributes/DependencyTest.php

Lines changed: 0 additions & 38 deletions
This file was deleted.

tests/unit/Framework/TestCaseTest.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
use function sprintf;
1313
use PHPUnit\Framework\Attributes\CoversClass;
14+
use PHPUnit\Framework\Attributes\DataProvider;
15+
use PHPUnit\Framework\Attributes\Depends;
1416
use PHPUnit\Framework\Attributes\ExcludeGlobalVariableFromBackup;
1517
use PHPUnit\TestFixture\TestWithDifferentNames;
1618

@@ -21,6 +23,18 @@ class TestCaseTest extends TestCase
2123
{
2224
protected static int $testStatic = 456;
2325

26+
/**
27+
* @return array<non-empty-string, array<non-empty-string, string>>
28+
*/
29+
public static function provider(): array
30+
{
31+
return [
32+
'case 1' => [
33+
'fromProvider' => 'value from provider',
34+
],
35+
];
36+
}
37+
2438
public static function setUpBeforeClass(): void
2539
{
2640
$GLOBALS['a'] = 'a';
@@ -83,4 +97,19 @@ public function testGetNameReturnsMethodName(): void
8397

8498
$this->assertSame($methodName, $testCase->nameWithDataSet());
8599
}
100+
101+
public function testDependedUponTest(): string
102+
{
103+
$this->assertTrue(true);
104+
105+
return 'value from depended-upon test';
106+
}
107+
108+
#[DataProvider('provider')]
109+
#[Depends('testDependedUponTest')]
110+
public function testTestDataFromProviderAndDependedUponTest(string $fromProvider, string $fromDependency): void
111+
{
112+
$this->assertSame('value from provider', $fromProvider);
113+
$this->assertSame('value from depended-upon test', $fromDependency);
114+
}
86115
}

0 commit comments

Comments
 (0)