Skip to content

Commit c5d9530

Browse files
committed
test functions
1 parent f56c445 commit c5d9530

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

test/FunctionsTest.php

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
3+
namespace PhpSchool\PhpWorkshopTest;
4+
5+
use PHPUnit_Framework_TestCase;
6+
7+
/**
8+
* @author Aydin Hassan <[email protected]>
9+
*/
10+
class FunctionsTest extends PHPUnit_Framework_TestCase
11+
{
12+
/**
13+
* @dataProvider mbStrPadProvider
14+
*
15+
* @param string $string
16+
* @param string $pad
17+
* @param string $expected
18+
*/
19+
public function testMbStrPad($string, $pad, $expected)
20+
{
21+
self::assertSame(mb_str_pad($string, $pad), $expected);
22+
}
23+
24+
/**
25+
* @return array
26+
*/
27+
public function mbStrPadProvider()
28+
{
29+
return [
30+
['hello', 10, 'hello '],
31+
['hello😂', 10, 'hello😂 '],
32+
];
33+
}
34+
35+
/**
36+
* @dataProvider camelCaseToKebabCaseProvider
37+
*
38+
* @param string $string
39+
* @param string $expected
40+
*/
41+
public function testCamelCaseToKebabCase($string, $expected)
42+
{
43+
self::assertSame(camel_case_to_kebab_case($string), $expected);
44+
}
45+
46+
/**
47+
* @return array
48+
*/
49+
public function camelCaseToKebabCaseProvider()
50+
{
51+
return [
52+
['camelCase', 'camel-case'],
53+
[
54+
'educationIsThePassportToTheFutureForTomorrowBelongsToThoseWhoPrepareForItToday',
55+
'education-is-the-passport-to-the-future-for-tomorrow-belongs-to-those-who-prepare-for-it-today'
56+
]
57+
];
58+
}
59+
}

0 commit comments

Comments
 (0)