[Form] Added test case for 4759e062ed004749dbdc2ba31aef0f8ac2601895
This commit is contained in:
parent
7bc7a8a6ec
commit
b44e07b7f6
@ -11,6 +11,7 @@ CHANGELOG
|
||||
* [BC BREAK] added two optional parameters to FormInterface::getErrors() and
|
||||
changed the method to return a Symfony\Component\Form\FormErrorIterator
|
||||
instance instead of an array
|
||||
* you can now pass interface names in the "data_class" option
|
||||
|
||||
2.4.0
|
||||
-----
|
||||
|
@ -146,6 +146,37 @@ class FormTypeTest extends BaseTypeTest
|
||||
$this->assertSame(10, $view->vars['attr']['maxlength']);
|
||||
}
|
||||
|
||||
public function testDataClassMayBeNull()
|
||||
{
|
||||
$this->factory->createBuilder('form', null, array(
|
||||
'data_class' => null,
|
||||
));
|
||||
}
|
||||
|
||||
public function testDataClassMayBeAbstractClass()
|
||||
{
|
||||
$this->factory->createBuilder('form', null, array(
|
||||
'data_class' => 'Symfony\Component\Form\Tests\Fixtures\AbstractAuthor',
|
||||
));
|
||||
}
|
||||
|
||||
public function testDataClassMayBeInterface()
|
||||
{
|
||||
$this->factory->createBuilder('form', null, array(
|
||||
'data_class' => 'Symfony\Component\Form\Tests\Fixtures\AuthorInterface',
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Form\Exception\InvalidArgumentException
|
||||
*/
|
||||
public function testDataClassMustBeValidClassOrInterface()
|
||||
{
|
||||
$this->factory->createBuilder('form', null, array(
|
||||
'data_class' => 'foobar',
|
||||
));
|
||||
}
|
||||
|
||||
public function testSubmitWithEmptyDataCreatesObjectIfClassAvailable()
|
||||
{
|
||||
$builder = $this->factory->createBuilder('form', null, array(
|
||||
|
16
src/Symfony/Component/Form/Tests/Fixtures/AbstractAuthor.php
Normal file
16
src/Symfony/Component/Form/Tests/Fixtures/AbstractAuthor.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Form\Tests\Fixtures;
|
||||
|
||||
abstract class AbstractAuthor
|
||||
{
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Form\Tests\Fixtures;
|
||||
|
||||
interface AuthorInterface
|
||||
{
|
||||
}
|
Reference in New Issue
Block a user