mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
56 lines
1.4 KiB
PHP
56 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace Alchemy\Tests\Phrasea\Utilities\String;
|
|
|
|
use Alchemy\Phrasea\Utilities\StringHelper;
|
|
|
|
/**
|
|
* @group unit
|
|
*/
|
|
class StringHelperTest extends \PhraseanetTestCase
|
|
{
|
|
/**
|
|
* @dataProvider provideStringsForCamelize
|
|
* @covers Alchemy\Phrasea\Utilities\StringHelper::camelize
|
|
*/
|
|
public function testCamelize($string, $separator, $expected, $pascalize)
|
|
{
|
|
$result = StringHelper::camelize($string, $separator, $pascalize);
|
|
|
|
$this->assertEquals($expected, $result);
|
|
}
|
|
|
|
public function provideStringsForCamelize()
|
|
{
|
|
return [
|
|
['string-test', '-', 'stringTest', false],
|
|
['string test', ' ', 'stringTest', false],
|
|
['string_test', '_', 'stringTest', false],
|
|
['string#test', '#', 'StringTest', true],
|
|
];
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
* @dataProvider provideStringsForCrLfNormalize
|
|
* @covers Alchemy\Phrasea\Utilities\StringHelper::crlfNormalize
|
|
*/
|
|
public function testCrLfNormalize($string, $expected)
|
|
{
|
|
$result = StringHelper::crlfNormalize($string);
|
|
|
|
$this->assertEquals($expected, $result);
|
|
}
|
|
|
|
public function provideStringsForCrLfNormalize()
|
|
{
|
|
return [
|
|
["ABC\rDEF", "ABC\nDEF"],
|
|
["ABC\nDEF", "ABC\nDEF"],
|
|
["ABC\r\nDEF", "ABC\nDEF"],
|
|
["ABC\n\rDEF", "ABC\n\nDEF"],
|
|
];
|
|
}
|
|
}
|