Skip to content

Commit

Permalink
[String] add test case for wordwrap method
Browse files Browse the repository at this point in the history
  • Loading branch information
mgamal92 authored and nicolas-grekas committed Jan 9, 2020
1 parent 8031b86 commit c314598
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions src/Symfony/Component/String/Tests/AbstractAsciiTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,50 @@ public static function provideBytesAt(): array
];
}

/**
* @dataProvider wordwrapProvider
*/
public function testWordwrap($expected, $actual, $length, $break, $cut = false)
{
$instance = static::createFromString($actual);
$actual = $instance->wordwrap($length, $break, $cut);

$this->assertEquals($expected, $actual);
}

public function wordwrapProvider()
{
return [
[
'Lo-re-m-Ip-su-m',
'Lorem Ipsum',
2,
'-',
true,
],
[
'Lorem-Ipsum',
'Lorem Ipsum',
2,
'-',
],
[
'Lor-em-Ips-um',
'Lorem Ipsum',
3,
'-',
true,
],
[
'L-o-r-e-m-I-p-s-u-m',
'Lorem Ipsum',
1,
'-',
true,
],
];
}

/**
* @dataProvider provideWrap
*/
Expand Down

0 comments on commit c314598

Please sign in to comment.