Skip to content

Commit

Permalink
minor #35236 [String] add test case for wordwrap method (mgamal92)
Browse files Browse the repository at this point in the history
This PR was submitted for the master branch but it was squashed and merged into the 5.0 branch instead.

Discussion
----------

[String] add test case for wordwrap method

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| License       | MIT

Just test case for ```wordwrap``` method

Commits
-------

c314598 [String] add test case for wordwrap method
  • Loading branch information
nicolas-grekas committed Jan 9, 2020
2 parents 8031b86 + c314598 commit 3b3cbb9
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions src/Symfony/Component/String/Tests/AbstractAsciiTestCase.php
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 3b3cbb9

Please sign in to comment.