[DoctrineBridge] fixed a unit test after the 2.0 merge

This commit is contained in:
Fabien Potencier 2012-02-04 08:08:27 +01:00
parent b1148e334f
commit 6e60967827
2 changed files with 27 additions and 3 deletions

View File

@ -0,0 +1,22 @@
<?php
namespace Symfony\Tests\Bridge\Doctrine\Fixtures;
use Doctrine\ORM\Mapping\Id;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
/** @Entity */
class NoToStringSingleIdentEntity
{
/** @Id @Column(type="integer") */
protected $id;
/** @Column(type="string", nullable=true) */
public $name;
public function __construct($id, $name) {
$this->id = $id;
$this->name = $name;
}
}

View File

@ -14,10 +14,12 @@ namespace Symfony\Tests\Bridge\Doctrine\Form\ChoiceList;
require_once __DIR__.'/../../DoctrineOrmTestCase.php';
require_once __DIR__.'/../../Fixtures/ItemGroupEntity.php';
require_once __DIR__.'/../../Fixtures/SingleIdentEntity.php';
require_once __DIR__.'/../../Fixtures/NoToStringSingleIdentEntity.php';
use Symfony\Tests\Bridge\Doctrine\DoctrineOrmTestCase;
use Symfony\Tests\Bridge\Doctrine\Fixtures\ItemGroupEntity;
use Symfony\Tests\Bridge\Doctrine\Fixtures\SingleIdentEntity;
use Symfony\Tests\Bridge\Doctrine\Fixtures\NoToStringSingleIdentEntity;
use Symfony\Bridge\Doctrine\Form\ChoiceList\EntityChoiceList;
use Symfony\Component\Form\Extension\Core\View\ChoiceView;
@ -51,8 +53,8 @@ class EntityChoiceListTest extends DoctrineOrmTestCase
*/
public function testEntitesMustHaveAToStringMethod()
{
$entity1 = new SingleIdentEntity(1, 'Foo');
$entity2 = new SingleIdentEntity(2, 'Bar');
$entity1 = new NoToStringSingleIdentEntity(1, 'Foo');
$entity2 = new NoToStringSingleIdentEntity(2, 'Bar');
// Persist for managed state
$this->em->persist($entity1);
@ -69,7 +71,7 @@ class EntityChoiceListTest extends DoctrineOrmTestCase
)
);
$choiceList->getEntities();
$choiceList->getValues();
}
/**