-
-
Notifications
You must be signed in to change notification settings - Fork 439
Expand file tree
/
Copy pathInflectorSingularResolverTest.php
More file actions
46 lines (37 loc) · 1.37 KB
/
InflectorSingularResolverTest.php
File metadata and controls
46 lines (37 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
declare(strict_types=1);
namespace Rector\Tests\Naming\ExpectedNameResolver;
use Iterator;
use PHPUnit\Framework\Attributes\DataProvider;
use Rector\Naming\ExpectedNameResolver\InflectorSingularResolver;
use Rector\Testing\PHPUnit\AbstractLazyTestCase;
final class InflectorSingularResolverTest extends AbstractLazyTestCase
{
private InflectorSingularResolver $inflectorSingularResolver;
protected function setUp(): void
{
parent::setUp();
$this->inflectorSingularResolver = $this->make(InflectorSingularResolver::class);
}
#[DataProvider('provideData')]
public function testResolveForForeach(string $currentName, string $expectedSingularName): void
{
$singularValue = $this->inflectorSingularResolver->resolve($currentName);
$this->assertSame($expectedSingularName, $singularValue);
}
/**
* @return Iterator<array<int, string>>
*/
public static function provideData(): Iterator
{
yield ['psr4NamespacesToPaths', 'psr4NamespaceToPath'];
yield ['nestedNews', 'nestedNew'];
yield ['news', 'new'];
yield ['property', 'property'];
yield ['argsOrOptions', 'argOrOption'];
// news and plural
yield ['staticCallsToNews', 'staticCallToNew'];
yield ['newsToMethodCalls', 'newToMethodCall'];
yield ['hasFilters', 'hasFilter'];
}
}