Skip to content

Commit 862b460

Browse files
committed
[Form] Add missing tests for StringUtil::fqcnToBlockPrefix()
1 parent c658539 commit 862b460

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/Symfony/Component/Form/Tests/Util/StringUtilTest.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,31 @@ public function spaceProvider()
7474
// array('200B'),
7575
);
7676
}
77+
78+
/**
79+
* @dataProvider fqcnToBlockPrefixProvider
80+
*/
81+
public function testFqcnToBlockPrefix($fqcn, $expectedBlockPrefix)
82+
{
83+
$blockPrefix = StringUtil::fqcnToBlockPrefix($fqcn);
84+
85+
$this->assertSame($expectedBlockPrefix, $blockPrefix);
86+
}
87+
88+
public function fqcnToBlockPrefixProvider()
89+
{
90+
return array(
91+
array('TYPE', 'type'),
92+
array('\Type', 'type'),
93+
array('\UserType', 'user'),
94+
array('UserType', 'user'),
95+
array('Vendor\Name\Space\Type', 'type'),
96+
array('Vendor\Name\Space\UserForm', 'user_form'),
97+
array('Vendor\Name\Space\UserType', 'user'),
98+
array('Vendor\Name\Space\usertype', 'user'),
99+
array('Symfony\Component\Form\Form', 'form'),
100+
array('Vendor\Name\Space\BarTypeBazType', 'bar_type_baz'),
101+
array('FooBarBazType', 'foo_bar_baz'),
102+
);
103+
}
77104
}

0 commit comments

Comments
 (0)