Skip to content

Commit

Permalink
Merge pull request #78 from boekkooi/patch-2
Browse files Browse the repository at this point in the history
Added getBlockPrefix to avoid deprecation in SF2.8
  • Loading branch information
thewilkybarkid committed Mar 12, 2016
2 parents 8b89d78 + 169359d commit 3112a16
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Form/Type/PhoneNumberType.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,14 @@ public function configureOptions(OptionsResolver $resolver)
* {@inheritdoc}
*/
public function getName()
{
return $this->getBlockPrefix();
}

/**
* {@inheritdoc}
*/
public function getBlockPrefix()
{
return 'tel';
}
Expand Down
8 changes: 8 additions & 0 deletions Tests/Form/Type/PhoneNumberTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,14 @@ public function testInvalidWidget()
$this->factory->create($type, null, array('widget' => 'foo'));
}

public function testGetNameAndBlockPrefixAreTel()
{
$type = new PhoneNumberType();

$this->assertSame('tel', $type->getBlockPrefix());
$this->assertSame($type->getBlockPrefix(), $type->getName());
}

private function createChoiceView($label, $code)
{
if (class_exists('Symfony\Component\Form\ChoiceList\View\ChoiceView')) {
Expand Down

0 comments on commit 3112a16

Please sign in to comment.