forked from WordPress/WordPress-Coding-Standards
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIsFormattingFunctionUnitTest.php
More file actions
64 lines (59 loc) · 1.58 KB
/
Copy pathIsFormattingFunctionUnitTest.php
File metadata and controls
64 lines (59 loc) · 1.58 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/**
* WordPress Coding Standard.
*
* @package WPCS\WordPressCodingStandards
* @link https://github.com/WordPress/WordPress-Coding-Standards
* @license https://opensource.org/licenses/MIT MIT
*/
namespace WordPressCS\WordPress\Tests\Helpers\FormattingFunctionsHelper;
use PHPUnit\Framework\TestCase;
use WordPressCS\WordPress\Helpers\FormattingFunctionsHelper;
/**
* Tests for the `FormattingFunctionsHelper::is_formatting_function()` method.
*
* @since 3.4.0
*
* @covers \WordPressCS\WordPress\Helpers\FormattingFunctionsHelper::is_formatting_function
*/
final class IsFormattingFunctionUnitTest extends TestCase {
/**
* Test is_formatting_function().
*
* @dataProvider dataIsFormattingFunction
*
* @param string $functionName The function name to test.
* @param bool $expectedResult The expected return value.
*
* @return void
*/
public function testIsFormattingFunction( $functionName, $expectedResult ) {
$this->assertSame(
$expectedResult,
FormattingFunctionsHelper::is_formatting_function( $functionName )
);
}
/**
* Data provider.
*
* @see testIsFormattingFunction()
*
* @return array<string, array<string, bool|string>>
*/
public static function dataIsFormattingFunction() {
return array(
'lowercase_name' => array(
'functionName' => 'sprintf',
'expectedResult' => true,
),
'mixedcase_name' => array(
'functionName' => 'iMpLoDe',
'expectedResult' => true,
),
'not_a_formatting_function' => array(
'functionName' => 'printf',
'expectedResult' => false,
),
);
}
}