Skip to content

Commit 4a1bd8a

Browse files
mgamal92nicolas-grekas
authored andcommitted
[String] add test case for wordwrap method
1 parent 60091d7 commit 4a1bd8a

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

Tests/AbstractAsciiTestCase.php

+44
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,50 @@ public static function provideBytesAt(): array
5555
];
5656
}
5757

58+
/**
59+
* @dataProvider wordwrapProvider
60+
*/
61+
public function testWordwrap($expected, $actual, $length, $break, $cut = false)
62+
{
63+
$instance = static::createFromString($actual);
64+
$actual = $instance->wordwrap($length, $break, $cut);
65+
66+
$this->assertEquals($expected, $actual);
67+
}
68+
69+
public function wordwrapProvider()
70+
{
71+
return [
72+
[
73+
'Lo-re-m-Ip-su-m',
74+
'Lorem Ipsum',
75+
2,
76+
'-',
77+
true,
78+
],
79+
[
80+
'Lorem-Ipsum',
81+
'Lorem Ipsum',
82+
2,
83+
'-',
84+
],
85+
[
86+
'Lor-em-Ips-um',
87+
'Lorem Ipsum',
88+
3,
89+
'-',
90+
true,
91+
],
92+
[
93+
'L-o-r-e-m-I-p-s-u-m',
94+
'Lorem Ipsum',
95+
1,
96+
'-',
97+
true,
98+
],
99+
];
100+
}
101+
58102
/**
59103
* @dataProvider provideWrap
60104
*/

0 commit comments

Comments
 (0)