minor #16905 [Form] Add missing tests for StringUtil::fqcnToBlockPrefix() (jakzal)

This PR was merged into the 2.8 branch.

Discussion
----------

[Form] Add missing tests for StringUtil::fqcnToBlockPrefix()

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #16762
| License       | MIT
| Doc PR        | -

Commits
-------

862b460 [Form] Add missing tests for StringUtil::fqcnToBlockPrefix()
This commit is contained in:
Fabien Potencier 2015-12-08 19:15:12 +01:00
commit bbe72f90a0

View File

@ -74,4 +74,31 @@ class StringUtilTest extends \PHPUnit_Framework_TestCase
// array('200B'),
);
}
/**
* @dataProvider fqcnToBlockPrefixProvider
*/
public function testFqcnToBlockPrefix($fqcn, $expectedBlockPrefix)
{
$blockPrefix = StringUtil::fqcnToBlockPrefix($fqcn);
$this->assertSame($expectedBlockPrefix, $blockPrefix);
}
public function fqcnToBlockPrefixProvider()
{
return array(
array('TYPE', 'type'),
array('\Type', 'type'),
array('\UserType', 'user'),
array('UserType', 'user'),
array('Vendor\Name\Space\Type', 'type'),
array('Vendor\Name\Space\UserForm', 'user_form'),
array('Vendor\Name\Space\UserType', 'user'),
array('Vendor\Name\Space\usertype', 'user'),
array('Symfony\Component\Form\Form', 'form'),
array('Vendor\Name\Space\BarTypeBazType', 'bar_type_baz'),
array('FooBarBazType', 'foo_bar_baz'),
);
}
}