Skip to content

Commit

Permalink
Merge pull request #376 from althaus/fix-formtypes
Browse files Browse the repository at this point in the history
Upgrade to Symfony 2.6 compatible form types (#374)
  • Loading branch information
Florian Eckerstorfer committed Jun 4, 2015
2 parents f166677 + d50c8bc commit ea8792c
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions Form/Type/BootstrapCollectionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Symfony\Component\Form\FormView;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
* BootstrapCollectionType
Expand Down Expand Up @@ -54,7 +54,7 @@ public function buildView(FormView $view, FormInterface $form, array $options)
/**
* {@inheritDoc}
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
public function configureOptions(OptionsResolver $resolver)
{
$optionsNormalizer = function (Options $options, $value) {
// @codeCoverageIgnoreStart
Expand All @@ -77,7 +77,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
'options' => array(),
));

$resolver->setNormalizers(array('options' => $optionsNormalizer));
$resolver->setNormalizer('options', $optionsNormalizer);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions Form/Type/FormActionsType.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
* Class FormActionsType
Expand Down Expand Up @@ -80,7 +80,7 @@ protected function validateButton(FormInterface $field)
/**
* {@inheritdoc}
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'buttons' => array(),
Expand Down
4 changes: 2 additions & 2 deletions Form/Type/FormStaticControlType.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace Braincrafted\Bundle\BootstrapBundle\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
* FormStaticControlType
Expand All @@ -23,7 +23,7 @@ class FormStaticControlType extends AbstractType
/**
* {@inheritdoc}
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
//'mapped' => false,
Expand Down
10 changes: 5 additions & 5 deletions Tests/Form/Type/BootstrapCollectionTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ public function testBuildView()
}

/**
* @covers Braincrafted\Bundle\BootstrapBundle\Form\Type\BootstrapCollectionType::setDefaultOptions()
* @covers Braincrafted\Bundle\BootstrapBundle\Form\Type\BootstrapCollectionType::configureOptions()
*/
public function testSetDefaultOptions()
public function testConfigureOptions()
{
$resolver = m::mock('Symfony\Component\OptionsResolver\OptionsResolverInterface');
$resolver = m::mock('Symfony\Component\OptionsResolver\OptionsResolver');
$resolver->shouldReceive('setDefaults');
$resolver->shouldReceive('setNormalizers');
$resolver->shouldReceive('setNormalizer');

$this->type->setDefaultOptions($resolver);
$this->type->configureOptions($resolver);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions Tests/Form/Type/FormActionsTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function testBuildViewWithBadField()
$this->type->buildView($view, $form, $options);
}

public function testSetDefaultOptions()
public function testConfigureOptions()
{

$defaults = array(
Expand All @@ -99,10 +99,10 @@ public function testSetDefaultOptions()
'mapped' => false,
);

$resolver = m::mock('Symfony\Component\OptionsResolver\OptionsResolverInterface');
$resolver = m::mock('Symfony\Component\OptionsResolver\OptionsResolver');
$resolver->shouldReceive('setDefaults')->with($defaults)->once();

$this->type->setDefaultOptions($resolver);
$this->type->configureOptions($resolver);
}

public function testGetName()
Expand Down

0 comments on commit ea8792c

Please sign in to comment.