-
Notifications
You must be signed in to change notification settings - Fork 1k
Expand file tree
/
Copy pathInflectorTest.php
More file actions
40 lines (34 loc) · 1.16 KB
/
InflectorTest.php
File metadata and controls
40 lines (34 loc) · 1.16 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
<?php
use WP_CLI\Inflector;
use WP_CLI\Tests\TestCase;
use PHPUnit\Framework\Attributes\DataProvider;
class InflectorTest extends TestCase {
/**
* @dataProvider dataProviderPluralize
*/
#[DataProvider( 'dataProviderPluralize' )] // phpcs:ignore PHPCompatibility.Attributes.NewAttributes.PHPUnitAttributeFound
public function testPluralize( $singular, $expected ): void {
$this->assertEquals( $expected, Inflector::pluralize( $singular ) );
}
public static function dataProviderPluralize(): array {
return [
[ 'string', 'strings' ], // Regular.
[ 'person', 'people' ], // Irregular.
[ 'scissors', 'scissors' ], // Uncountable.
];
}
/**
* @dataProvider dataProviderSingularize
*/
#[DataProvider( 'dataProviderSingularize' )] // phpcs:ignore PHPCompatibility.Attributes.NewAttributes.PHPUnitAttributeFound
public function testSingularize( $singular, $expected ): void {
$this->assertEquals( $expected, Inflector::singularize( $singular ) );
}
public static function dataProviderSingularize(): array {
return [
[ 'strings', 'string' ], // Regular.
[ 'people', 'person' ], // Irregular.
[ 'scissors', 'scissors' ], // Uncountable.
];
}
}