[Form] Fix declaration of legacy tests
This commit is contained in:
parent
fc0dd83c17
commit
4a74aba4e8
@ -131,10 +131,8 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testLegacyEnctype()
|
||||
public function testEnctype()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$form = $this->factory->createNamedBuilder('name', 'form')
|
||||
->add('file', 'file')
|
||||
->getForm();
|
||||
@ -145,10 +143,8 @@ abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormInteg
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testLegacyNoEnctype()
|
||||
public function testNoEnctype()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$form = $this->factory->createNamedBuilder('name', 'form')
|
||||
->add('text', 'text')
|
||||
->getForm();
|
||||
|
@ -810,10 +810,8 @@ class CompoundFormTest extends AbstractFormTest
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testLegacyGetErrorsAsStringDeep()
|
||||
public function testGetErrorsAsStringDeep()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$parent = $this->getBuilder()
|
||||
->setCompound(true)
|
||||
->setDataMapper($this->getDataMapper())
|
||||
@ -834,10 +832,8 @@ class CompoundFormTest extends AbstractFormTest
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testLegacyGetErrorsAsStringDeepWithIndentation()
|
||||
public function testGetErrorsAsStringDeepWithIndentation()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$parent = $this->getBuilder()
|
||||
->setCompound(true)
|
||||
->setDataMapper($this->getDataMapper())
|
||||
|
@ -13,6 +13,8 @@ namespace Symfony\Component\Form\Tests\Extension\Core\ChoiceList;
|
||||
|
||||
/**
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*
|
||||
* @group legacy
|
||||
*/
|
||||
abstract class AbstractChoiceListTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
@ -123,8 +125,6 @@ abstract class AbstractChoiceListTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
parent::setUp();
|
||||
|
||||
$this->list = $this->createChoiceList();
|
||||
@ -153,151 +153,131 @@ abstract class AbstractChoiceListTest extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
}
|
||||
|
||||
public function testLegacyGetChoices()
|
||||
public function testGetChoices()
|
||||
{
|
||||
$this->assertSame($this->choices, $this->list->getChoices());
|
||||
}
|
||||
|
||||
public function testLegacyGetValues()
|
||||
public function testGetValues()
|
||||
{
|
||||
$this->assertSame($this->values, $this->list->getValues());
|
||||
}
|
||||
|
||||
public function testLegacyGetIndicesForChoices()
|
||||
public function testGetIndicesForChoices()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$choices = array($this->choice1, $this->choice2);
|
||||
$this->assertSame(array($this->index1, $this->index2), $this->list->getIndicesForChoices($choices));
|
||||
}
|
||||
|
||||
public function testLegacyGetIndicesForChoicesPreservesKeys()
|
||||
public function testGetIndicesForChoicesPreservesKeys()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$choices = array(5 => $this->choice1, 8 => $this->choice2);
|
||||
$this->assertSame(array(5 => $this->index1, 8 => $this->index2), $this->list->getIndicesForChoices($choices));
|
||||
}
|
||||
|
||||
public function testLegacyGetIndicesForChoicesPreservesOrder()
|
||||
public function testGetIndicesForChoicesPreservesOrder()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$choices = array($this->choice2, $this->choice1);
|
||||
$this->assertSame(array($this->index2, $this->index1), $this->list->getIndicesForChoices($choices));
|
||||
}
|
||||
|
||||
public function testLegacyGetIndicesForChoicesIgnoresNonExistingChoices()
|
||||
public function testGetIndicesForChoicesIgnoresNonExistingChoices()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$choices = array($this->choice1, $this->choice2, 'foobar');
|
||||
$this->assertSame(array($this->index1, $this->index2), $this->list->getIndicesForChoices($choices));
|
||||
}
|
||||
|
||||
public function testLegacyGetIndicesForChoicesEmpty()
|
||||
public function testGetIndicesForChoicesEmpty()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$this->assertSame(array(), $this->list->getIndicesForChoices(array()));
|
||||
}
|
||||
|
||||
public function testLegacyGetIndicesForValues()
|
||||
public function testGetIndicesForValues()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
// values and indices are always the same
|
||||
$values = array($this->value1, $this->value2);
|
||||
$this->assertSame(array($this->index1, $this->index2), $this->list->getIndicesForValues($values));
|
||||
}
|
||||
|
||||
public function testLegacyGetIndicesForValuesPreservesKeys()
|
||||
public function testGetIndicesForValuesPreservesKeys()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
// values and indices are always the same
|
||||
$values = array(5 => $this->value1, 8 => $this->value2);
|
||||
$this->assertSame(array(5 => $this->index1, 8 => $this->index2), $this->list->getIndicesForValues($values));
|
||||
}
|
||||
|
||||
public function testLegacyGetIndicesForValuesPreservesOrder()
|
||||
public function testGetIndicesForValuesPreservesOrder()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$values = array($this->value2, $this->value1);
|
||||
$this->assertSame(array($this->index2, $this->index1), $this->list->getIndicesForValues($values));
|
||||
}
|
||||
|
||||
public function testLegacyGetIndicesForValuesIgnoresNonExistingValues()
|
||||
public function testGetIndicesForValuesIgnoresNonExistingValues()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$values = array($this->value1, $this->value2, 'foobar');
|
||||
$this->assertSame(array($this->index1, $this->index2), $this->list->getIndicesForValues($values));
|
||||
}
|
||||
|
||||
public function testLegacyGetIndicesForValuesEmpty()
|
||||
public function testGetIndicesForValuesEmpty()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$this->assertSame(array(), $this->list->getIndicesForValues(array()));
|
||||
}
|
||||
|
||||
public function testLegacyGetChoicesForValues()
|
||||
public function testGetChoicesForValues()
|
||||
{
|
||||
$values = array($this->value1, $this->value2);
|
||||
$this->assertSame(array($this->choice1, $this->choice2), $this->list->getChoicesForValues($values));
|
||||
}
|
||||
|
||||
public function testLegacyGetChoicesForValuesPreservesKeys()
|
||||
public function testGetChoicesForValuesPreservesKeys()
|
||||
{
|
||||
$values = array(5 => $this->value1, 8 => $this->value2);
|
||||
$this->assertSame(array(5 => $this->choice1, 8 => $this->choice2), $this->list->getChoicesForValues($values));
|
||||
}
|
||||
|
||||
public function testLegacyGetChoicesForValuesPreservesOrder()
|
||||
public function testGetChoicesForValuesPreservesOrder()
|
||||
{
|
||||
$values = array($this->value2, $this->value1);
|
||||
$this->assertSame(array($this->choice2, $this->choice1), $this->list->getChoicesForValues($values));
|
||||
}
|
||||
|
||||
public function testLegacyGetChoicesForValuesIgnoresNonExistingValues()
|
||||
public function testGetChoicesForValuesIgnoresNonExistingValues()
|
||||
{
|
||||
$values = array($this->value1, $this->value2, 'foobar');
|
||||
$this->assertSame(array($this->choice1, $this->choice2), $this->list->getChoicesForValues($values));
|
||||
}
|
||||
|
||||
// https://github.com/symfony/symfony/issues/3446
|
||||
public function testLegacyGetChoicesForValuesEmpty()
|
||||
public function testGetChoicesForValuesEmpty()
|
||||
{
|
||||
$this->assertSame(array(), $this->list->getChoicesForValues(array()));
|
||||
}
|
||||
|
||||
public function testLegacyGetValuesForChoices()
|
||||
public function testGetValuesForChoices()
|
||||
{
|
||||
$choices = array($this->choice1, $this->choice2);
|
||||
$this->assertSame(array($this->value1, $this->value2), $this->list->getValuesForChoices($choices));
|
||||
}
|
||||
|
||||
public function testLegacyGetValuesForChoicesPreservesKeys()
|
||||
public function testGetValuesForChoicesPreservesKeys()
|
||||
{
|
||||
$choices = array(5 => $this->choice1, 8 => $this->choice2);
|
||||
$this->assertSame(array(5 => $this->value1, 8 => $this->value2), $this->list->getValuesForChoices($choices));
|
||||
}
|
||||
|
||||
public function testLegacyGetValuesForChoicesPreservesOrder()
|
||||
public function testGetValuesForChoicesPreservesOrder()
|
||||
{
|
||||
$choices = array($this->choice2, $this->choice1);
|
||||
$this->assertSame(array($this->value2, $this->value1), $this->list->getValuesForChoices($choices));
|
||||
}
|
||||
|
||||
public function testLegacyGetValuesForChoicesIgnoresNonExistingChoices()
|
||||
public function testGetValuesForChoicesIgnoresNonExistingChoices()
|
||||
{
|
||||
$choices = array($this->choice1, $this->choice2, 'foobar');
|
||||
$this->assertSame(array($this->value1, $this->value2), $this->list->getValuesForChoices($choices));
|
||||
}
|
||||
|
||||
public function testLegacyGetValuesForChoicesEmpty()
|
||||
public function testGetValuesForChoicesEmpty()
|
||||
{
|
||||
$this->assertSame(array(), $this->list->getValuesForChoices(array()));
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ class ChoiceListTest extends AbstractChoiceListTest
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
public function testLegacyInitArray()
|
||||
public function testInitArray()
|
||||
{
|
||||
$this->list = new ChoiceList(
|
||||
array($this->obj1, $this->obj2, $this->obj3, $this->obj4),
|
||||
@ -56,7 +56,7 @@ class ChoiceListTest extends AbstractChoiceListTest
|
||||
* choices parameter. A choice itself that is an object implementing \Traversable
|
||||
* is not treated as hierarchical structure, but as-is.
|
||||
*/
|
||||
public function testLegacyInitNestedTraversable()
|
||||
public function testInitNestedTraversable()
|
||||
{
|
||||
$traversableChoice = new \ArrayIterator(array($this->obj3, $this->obj4));
|
||||
|
||||
@ -83,7 +83,7 @@ class ChoiceListTest extends AbstractChoiceListTest
|
||||
), $this->list->getRemainingViews());
|
||||
}
|
||||
|
||||
public function testLegacyInitNestedArray()
|
||||
public function testInitNestedArray()
|
||||
{
|
||||
$this->assertSame(array($this->obj1, $this->obj2, $this->obj3, $this->obj4), $this->list->getChoices());
|
||||
$this->assertSame(array('0', '1', '2', '3'), $this->list->getValues());
|
||||
@ -100,7 +100,7 @@ class ChoiceListTest extends AbstractChoiceListTest
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testLegacyInitWithInsufficientLabels()
|
||||
public function testInitWithInsufficientLabels()
|
||||
{
|
||||
$this->list = new ChoiceList(
|
||||
array($this->obj1, $this->obj2),
|
||||
@ -108,7 +108,7 @@ class ChoiceListTest extends AbstractChoiceListTest
|
||||
);
|
||||
}
|
||||
|
||||
public function testLegacyInitWithLabelsContainingNull()
|
||||
public function testInitWithLabelsContainingNull()
|
||||
{
|
||||
$this->list = new ChoiceList(
|
||||
array($this->obj1, $this->obj2),
|
||||
|
@ -43,55 +43,45 @@ class LazyChoiceListTest extends \PHPUnit_Framework_TestCase
|
||||
$this->list = null;
|
||||
}
|
||||
|
||||
public function testLegacyGetChoices()
|
||||
public function testGetChoices()
|
||||
{
|
||||
$this->assertSame(array(0 => 'a', 1 => 'b', 2 => 'c'), $this->list->getChoices());
|
||||
}
|
||||
|
||||
public function testLegacyGetValues()
|
||||
public function testGetValues()
|
||||
{
|
||||
$this->assertSame(array(0 => 'a', 1 => 'b', 2 => 'c'), $this->list->getValues());
|
||||
}
|
||||
|
||||
public function testLegacyGetPreferredViews()
|
||||
public function testGetPreferredViews()
|
||||
{
|
||||
$this->assertEquals(array(1 => new ChoiceView('b', 'b', 'B')), $this->list->getPreferredViews());
|
||||
}
|
||||
|
||||
public function testLegacyGetRemainingViews()
|
||||
public function testGetRemainingViews()
|
||||
{
|
||||
$this->assertEquals(array(0 => new ChoiceView('a', 'a', 'A'), 2 => new ChoiceView('c', 'c', 'C')), $this->list->getRemainingViews());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testLegacyGetIndicesForChoices()
|
||||
public function testGetIndicesForChoices()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$choices = array('b', 'c');
|
||||
$this->assertSame(array(1, 2), $this->list->getIndicesForChoices($choices));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testLegacyGetIndicesForValues()
|
||||
public function testGetIndicesForValues()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$values = array('b', 'c');
|
||||
$this->assertSame(array(1, 2), $this->list->getIndicesForValues($values));
|
||||
}
|
||||
|
||||
public function testLegacyGetChoicesForValues()
|
||||
public function testGetChoicesForValues()
|
||||
{
|
||||
$values = array('b', 'c');
|
||||
$this->assertSame(array('b', 'c'), $this->list->getChoicesForValues($values));
|
||||
}
|
||||
|
||||
public function testLegacyGetValuesForChoices()
|
||||
public function testGetValuesForChoices()
|
||||
{
|
||||
$choices = array('b', 'c');
|
||||
$this->assertSame(array('b', 'c'), $this->list->getValuesForChoices($choices));
|
||||
@ -100,7 +90,7 @@ class LazyChoiceListTest extends \PHPUnit_Framework_TestCase
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Form\Exception\InvalidArgumentException
|
||||
*/
|
||||
public function testLegacyLoadChoiceListShouldReturnChoiceList()
|
||||
public function testLoadChoiceListShouldReturnChoiceList()
|
||||
{
|
||||
$list = new LazyChoiceListTest_InvalidImpl();
|
||||
|
||||
|
@ -52,7 +52,7 @@ class ObjectChoiceListTest extends AbstractChoiceListTest
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
public function testLegacyInitArray()
|
||||
public function testInitArray()
|
||||
{
|
||||
$this->list = new ObjectChoiceList(
|
||||
array($this->obj1, $this->obj2, $this->obj3, $this->obj4),
|
||||
@ -66,7 +66,7 @@ class ObjectChoiceListTest extends AbstractChoiceListTest
|
||||
$this->assertEquals(array(0 => new ChoiceView($this->obj1, '0', 'A'), 2 => new ChoiceView($this->obj3, '2', 'C'), 3 => new ChoiceView($this->obj4, '3', 'D')), $this->list->getRemainingViews());
|
||||
}
|
||||
|
||||
public function testLegacyInitNestedArray()
|
||||
public function testInitNestedArray()
|
||||
{
|
||||
$this->assertSame(array($this->obj1, $this->obj2, $this->obj3, $this->obj4), $this->list->getChoices());
|
||||
$this->assertSame(array('0', '1', '2', '3'), $this->list->getValues());
|
||||
@ -80,7 +80,7 @@ class ObjectChoiceListTest extends AbstractChoiceListTest
|
||||
), $this->list->getRemainingViews());
|
||||
}
|
||||
|
||||
public function testLegacyInitArrayWithGroupPath()
|
||||
public function testInitArrayWithGroupPath()
|
||||
{
|
||||
$this->obj1 = (object) array('name' => 'A', 'category' => 'Group 1');
|
||||
$this->obj2 = (object) array('name' => 'B', 'category' => 'Group 1');
|
||||
@ -118,7 +118,7 @@ class ObjectChoiceListTest extends AbstractChoiceListTest
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testLegacyInitArrayWithGroupPathThrowsExceptionIfNestedArray()
|
||||
public function testInitArrayWithGroupPathThrowsExceptionIfNestedArray()
|
||||
{
|
||||
$this->obj1 = (object) array('name' => 'A', 'category' => 'Group 1');
|
||||
$this->obj2 = (object) array('name' => 'B', 'category' => 'Group 1');
|
||||
@ -136,7 +136,7 @@ class ObjectChoiceListTest extends AbstractChoiceListTest
|
||||
);
|
||||
}
|
||||
|
||||
public function testLegacyInitArrayWithValuePath()
|
||||
public function testInitArrayWithValuePath()
|
||||
{
|
||||
$this->obj1 = (object) array('name' => 'A', 'id' => 10);
|
||||
$this->obj2 = (object) array('name' => 'B', 'id' => 20);
|
||||
@ -157,7 +157,7 @@ class ObjectChoiceListTest extends AbstractChoiceListTest
|
||||
$this->assertEquals(array(0 => new ChoiceView($this->obj1, '10', 'A'), 3 => new ChoiceView($this->obj4, '40', 'D')), $this->list->getRemainingViews());
|
||||
}
|
||||
|
||||
public function testLegacyInitArrayUsesToString()
|
||||
public function testInitArrayUsesToString()
|
||||
{
|
||||
$this->obj1 = new ObjectChoiceListTest_EntityWithToString('A');
|
||||
$this->obj2 = new ObjectChoiceListTest_EntityWithToString('B');
|
||||
@ -176,7 +176,7 @@ class ObjectChoiceListTest extends AbstractChoiceListTest
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Form\Exception\StringCastException
|
||||
*/
|
||||
public function testLegacyInitArrayThrowsExceptionIfToStringNotFound()
|
||||
public function testInitArrayThrowsExceptionIfToStringNotFound()
|
||||
{
|
||||
$this->obj1 = new ObjectChoiceListTest_EntityWithToString('A');
|
||||
$this->obj2 = new ObjectChoiceListTest_EntityWithToString('B');
|
||||
@ -188,13 +188,8 @@ class ObjectChoiceListTest extends AbstractChoiceListTest
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testLegacyGetIndicesForChoicesWithValuePath()
|
||||
public function testGetIndicesForChoicesWithValuePath()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$this->list = new ObjectChoiceList(
|
||||
array($this->obj1, $this->obj2, $this->obj3, $this->obj4),
|
||||
'name',
|
||||
@ -208,13 +203,8 @@ class ObjectChoiceListTest extends AbstractChoiceListTest
|
||||
$this->assertSame(array($this->index1, $this->index2), $this->list->getIndicesForChoices($choices));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testLegacyGetIndicesForChoicesWithValuePathPreservesKeys()
|
||||
public function testGetIndicesForChoicesWithValuePathPreservesKeys()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$this->list = new ObjectChoiceList(
|
||||
array($this->obj1, $this->obj2, $this->obj3, $this->obj4),
|
||||
'name',
|
||||
@ -227,13 +217,8 @@ class ObjectChoiceListTest extends AbstractChoiceListTest
|
||||
$this->assertSame(array(5 => $this->index1, 8 => $this->index2), $this->list->getIndicesForChoices($choices));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testLegacyGetIndicesForChoicesWithValuePathPreservesOrder()
|
||||
public function testGetIndicesForChoicesWithValuePathPreservesOrder()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$this->list = new ObjectChoiceList(
|
||||
array($this->obj1, $this->obj2, $this->obj3, $this->obj4),
|
||||
'name',
|
||||
@ -246,13 +231,8 @@ class ObjectChoiceListTest extends AbstractChoiceListTest
|
||||
$this->assertSame(array($this->index2, $this->index1), $this->list->getIndicesForChoices($choices));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testLegacyGetIndicesForChoicesWithValuePathIgnoresNonExistingChoices()
|
||||
public function testGetIndicesForChoicesWithValuePathIgnoresNonExistingChoices()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$this->list = new ObjectChoiceList(
|
||||
array($this->obj1, $this->obj2, $this->obj3, $this->obj4),
|
||||
'name',
|
||||
@ -265,7 +245,7 @@ class ObjectChoiceListTest extends AbstractChoiceListTest
|
||||
$this->assertSame(array($this->index1, $this->index2), $this->list->getIndicesForChoices($choices));
|
||||
}
|
||||
|
||||
public function testLegacyGetValuesForChoicesWithValuePath()
|
||||
public function testGetValuesForChoicesWithValuePath()
|
||||
{
|
||||
$this->list = new ObjectChoiceList(
|
||||
array($this->obj1, $this->obj2, $this->obj3, $this->obj4),
|
||||
@ -279,7 +259,7 @@ class ObjectChoiceListTest extends AbstractChoiceListTest
|
||||
$this->assertSame(array('A', 'B'), $this->list->getValuesForChoices($choices));
|
||||
}
|
||||
|
||||
public function testLegacyGetValuesForChoicesWithValuePathPreservesKeys()
|
||||
public function testGetValuesForChoicesWithValuePathPreservesKeys()
|
||||
{
|
||||
$this->list = new ObjectChoiceList(
|
||||
array($this->obj1, $this->obj2, $this->obj3, $this->obj4),
|
||||
@ -293,7 +273,7 @@ class ObjectChoiceListTest extends AbstractChoiceListTest
|
||||
$this->assertSame(array(5 => 'A', 8 => 'B'), $this->list->getValuesForChoices($choices));
|
||||
}
|
||||
|
||||
public function testLegacyGetValuesForChoicesWithValuePathPreservesOrder()
|
||||
public function testGetValuesForChoicesWithValuePathPreservesOrder()
|
||||
{
|
||||
$this->list = new ObjectChoiceList(
|
||||
array($this->obj1, $this->obj2, $this->obj3, $this->obj4),
|
||||
@ -307,7 +287,7 @@ class ObjectChoiceListTest extends AbstractChoiceListTest
|
||||
$this->assertSame(array('B', 'A'), $this->list->getValuesForChoices($choices));
|
||||
}
|
||||
|
||||
public function testLegacyGetValuesForChoicesWithValuePathIgnoresNonExistingChoices()
|
||||
public function testGetValuesForChoicesWithValuePathIgnoresNonExistingChoices()
|
||||
{
|
||||
$this->list = new ObjectChoiceList(
|
||||
array($this->obj1, $this->obj2, $this->obj3, $this->obj4),
|
||||
|
@ -19,7 +19,7 @@ use Symfony\Component\Form\Extension\Core\View\ChoiceView;
|
||||
*/
|
||||
class SimpleChoiceListTest extends AbstractChoiceListTest
|
||||
{
|
||||
public function testLegacyInitArray()
|
||||
public function testInitArray()
|
||||
{
|
||||
$choices = array('a' => 'A', 'b' => 'B', 'c' => 'C');
|
||||
$this->list = new SimpleChoiceList($choices, array('b'));
|
||||
@ -30,7 +30,7 @@ class SimpleChoiceListTest extends AbstractChoiceListTest
|
||||
$this->assertEquals(array(0 => new ChoiceView('a', 'a', 'A'), 2 => new ChoiceView('c', 'c', 'C')), $this->list->getRemainingViews());
|
||||
}
|
||||
|
||||
public function testLegacyInitNestedArray()
|
||||
public function testInitNestedArray()
|
||||
{
|
||||
$this->assertSame(array(0 => 'a', 1 => 'b', 2 => 'c', 3 => 'd'), $this->list->getChoices());
|
||||
$this->assertSame(array(0 => 'a', 1 => 'b', 2 => 'c', 3 => 'd'), $this->list->getValues());
|
||||
@ -47,7 +47,7 @@ class SimpleChoiceListTest extends AbstractChoiceListTest
|
||||
/**
|
||||
* @dataProvider dirtyValuesProvider
|
||||
*/
|
||||
public function testLegacyGetValuesForChoicesDealsWithDirtyValues($choice, $value)
|
||||
public function testGetValuesForChoicesDealsWithDirtyValues($choice, $value)
|
||||
{
|
||||
$choices = array(
|
||||
'0' => 'Zero',
|
||||
|
@ -18,32 +18,28 @@ use Symfony\Component\Form\Extension\Core\ChoiceList\SimpleChoiceList;
|
||||
*/
|
||||
class SimpleNumericChoiceListTest extends AbstractChoiceListTest
|
||||
{
|
||||
public function testLegacyGetIndicesForChoicesDealsWithNumericChoices()
|
||||
public function testGetIndicesForChoicesDealsWithNumericChoices()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
// Pass choices as strings although they are integers
|
||||
$choices = array('0', '1');
|
||||
$this->assertSame(array(0, 1), $this->list->getIndicesForChoices($choices));
|
||||
}
|
||||
|
||||
public function testLegacyGetIndicesForValuesDealsWithNumericValues()
|
||||
public function testGetIndicesForValuesDealsWithNumericValues()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
// Pass values as strings although they are integers
|
||||
$values = array('0', '1');
|
||||
$this->assertSame(array(0, 1), $this->list->getIndicesForValues($values));
|
||||
}
|
||||
|
||||
public function testLegacyGetChoicesForValuesDealsWithNumericValues()
|
||||
public function testGetChoicesForValuesDealsWithNumericValues()
|
||||
{
|
||||
// Pass values as strings although they are integers
|
||||
$values = array('0', '1');
|
||||
$this->assertSame(array(0, 1), $this->list->getChoicesForValues($values));
|
||||
}
|
||||
|
||||
public function testLegacyGetValuesForChoicesDealsWithNumericValues()
|
||||
public function testGetValuesForChoicesDealsWithNumericValues()
|
||||
{
|
||||
// Pass values as strings although they are integers
|
||||
$values = array('0', '1');
|
||||
|
@ -24,8 +24,6 @@ class FixRadioInputListenerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
parent::setUp();
|
||||
|
||||
$this->choiceList = new SimpleChoiceList(array('' => 'Empty', 0 => 'A', 1 => 'B'));
|
||||
@ -38,7 +36,7 @@ class FixRadioInputListenerTest extends \PHPUnit_Framework_TestCase
|
||||
$listener = null;
|
||||
}
|
||||
|
||||
public function testLegacyFixRadio()
|
||||
public function testFixRadio()
|
||||
{
|
||||
$data = '1';
|
||||
$form = $this->getMock('Symfony\Component\Form\Test\FormInterface');
|
||||
@ -51,7 +49,7 @@ class FixRadioInputListenerTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals(array(2 => '1'), $event->getData());
|
||||
}
|
||||
|
||||
public function testLegacyFixZero()
|
||||
public function testFixZero()
|
||||
{
|
||||
$data = '0';
|
||||
$form = $this->getMock('Symfony\Component\Form\Test\FormInterface');
|
||||
@ -64,7 +62,7 @@ class FixRadioInputListenerTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals(array(1 => '0'), $event->getData());
|
||||
}
|
||||
|
||||
public function testLegacyFixEmptyString()
|
||||
public function testFixEmptyString()
|
||||
{
|
||||
$data = '';
|
||||
$form = $this->getMock('Symfony\Component\Form\Test\FormInterface');
|
||||
@ -77,7 +75,7 @@ class FixRadioInputListenerTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals(array(0 => ''), $event->getData());
|
||||
}
|
||||
|
||||
public function testLegacyConvertEmptyStringToPlaceholderIfNotFound()
|
||||
public function testConvertEmptyStringToPlaceholderIfNotFound()
|
||||
{
|
||||
$list = new SimpleChoiceList(array(0 => 'A', 1 => 'B'));
|
||||
|
||||
@ -91,7 +89,7 @@ class FixRadioInputListenerTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals(array('placeholder' => ''), $event->getData());
|
||||
}
|
||||
|
||||
public function testLegacyDontConvertEmptyStringToPlaceholderIfNoPlaceholderUsed()
|
||||
public function testDontConvertEmptyStringToPlaceholderIfNoPlaceholderUsed()
|
||||
{
|
||||
$list = new SimpleChoiceList(array(0 => 'A', 1 => 'B'));
|
||||
|
||||
|
@ -373,8 +373,6 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
|
||||
*/
|
||||
public function testLegacySubmitSingleNonExpandedObjectChoices()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$form = $this->factory->create('choice', null, array(
|
||||
'multiple' => false,
|
||||
'expanded' => false,
|
||||
@ -493,8 +491,6 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
|
||||
*/
|
||||
public function testLegacySubmitMultipleNonExpandedObjectChoices()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$form = $this->factory->create('choice', null, array(
|
||||
'multiple' => true,
|
||||
'expanded' => false,
|
||||
@ -974,8 +970,6 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
|
||||
*/
|
||||
public function testLegacySubmitSingleExpandedObjectChoices()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$form = $this->factory->create('choice', null, array(
|
||||
'multiple' => false,
|
||||
'expanded' => true,
|
||||
@ -1202,8 +1196,6 @@ class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
|
||||
*/
|
||||
public function testLegacySubmitMultipleExpandedObjectChoices()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$form = $this->factory->create('choice', null, array(
|
||||
'multiple' => true,
|
||||
'expanded' => true,
|
||||
|
@ -640,10 +640,8 @@ class FormTypeTest extends BaseTypeTest
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testLegacyCanGetErrorsWhenButtonInForm()
|
||||
public function testCanGetErrorsWhenButtonInForm()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$builder = $this->factory->createBuilder('form', null, array(
|
||||
'data_class' => 'Symfony\Component\Form\Tests\Fixtures\Author',
|
||||
'required' => false,
|
||||
|
@ -736,10 +736,8 @@ class SimpleFormTest extends AbstractFormTest
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testLegacyGetErrorsAsString()
|
||||
public function testGetErrorsAsString()
|
||||
{
|
||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||
|
||||
$this->form->addError(new FormError('Error!'));
|
||||
|
||||
$this->assertEquals("ERROR: Error!\n", $this->form->getErrorsAsString());
|
||||
|
Reference in New Issue
Block a user