Skip to content

Commit 3a0babe

Browse files
committed
[CodeQuality] Skip test method via #[Test] Attribute
1 parent 1aedbbc commit 3a0babe

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
namespace Rector\PHPUnit\Tests\CodeQuality\Rector\ClassMethod\DataProviderArrayItemsNewlinedRector\Fixture;
4+
5+
use PHPUnit\Framework\Attributes\Test;
6+
use PHPUnit\Framework\TestCase;
7+
8+
final class SkipTestMethod extends TestCase
9+
{
10+
#[Test]
11+
public function run(): void
12+
{
13+
$importer = self::createMock(Importer::class);
14+
$importer->expects($invokedCount)
15+
->method('processFiles')
16+
->willReturnCallback(function (array $parameters) use ($invokedCount): array {
17+
switch ($invokedCount->numberOfInvocations()) {
18+
case 1:
19+
self::assertSame(range(1, 250), $parameters);
20+
21+
return [233, [], []];
22+
case 2:
23+
self::assertSame(range(251, 500), $parameters);
24+
25+
return [15, [], []];
26+
27+
default:
28+
throw new \OutOfBoundsException('Did not expect this to run thrice.');
29+
}
30+
});
31+
}
32+
}

0 commit comments

Comments
 (0)