|
@@ -70,7 +70,7 @@ class EntityTypeTest extends TypeTestCase
|
|
|
protected function getExtensions()
|
|
|
{
|
|
|
return array_merge(parent::getExtensions(), array(
|
|
|
- new DoctrineOrmExtension($this->em),
|
|
|
+ new DoctrineOrmExtension($this->createRegistryMock('default', $this->em)),
|
|
|
));
|
|
|
}
|
|
|
|
|
@@ -93,7 +93,7 @@ class EntityTypeTest extends TypeTestCase
|
|
|
// $this->persist(array($entity1, $entity2));
|
|
|
//
|
|
|
// $field = $this->factory->createNamed('entity', 'name', null, array(
|
|
|
-// 'em' => $this->em,
|
|
|
+// 'em' => 'default',
|
|
|
// 'class' => self::SINGLE_IDENT_CLASS,
|
|
|
// 'required' => false,
|
|
|
// 'property' => 'name'
|
|
@@ -109,7 +109,7 @@ class EntityTypeTest extends TypeTestCase
|
|
|
public function testConfigureQueryBuilderWithNonQueryBuilderAndNonClosure()
|
|
|
{
|
|
|
$field = $this->factory->createNamed('entity', 'name', null, array(
|
|
|
- 'em' => $this->em,
|
|
|
+ 'em' => 'default',
|
|
|
'class' => self::SINGLE_IDENT_CLASS,
|
|
|
'query_builder' => new \stdClass(),
|
|
|
));
|
|
@@ -121,7 +121,7 @@ class EntityTypeTest extends TypeTestCase
|
|
|
public function testConfigureQueryBuilderWithClosureReturningNonQueryBuilder()
|
|
|
{
|
|
|
$field = $this->factory->createNamed('entity', 'name', null, array(
|
|
|
- 'em' => $this->em,
|
|
|
+ 'em' => 'default',
|
|
|
'class' => self::SINGLE_IDENT_CLASS,
|
|
|
'query_builder' => function () {
|
|
|
return new \stdClass();
|
|
@@ -135,7 +135,7 @@ class EntityTypeTest extends TypeTestCase
|
|
|
{
|
|
|
$field = $this->factory->createNamed('entity', 'name', null, array(
|
|
|
'multiple' => false,
|
|
|
- 'em' => $this->em,
|
|
|
+ 'em' => 'default',
|
|
|
'class' => self::SINGLE_IDENT_CLASS,
|
|
|
));
|
|
|
$field->setData(null);
|
|
@@ -149,7 +149,7 @@ class EntityTypeTest extends TypeTestCase
|
|
|
$field = $this->factory->createNamed('entity', 'name', null, array(
|
|
|
'multiple' => true,
|
|
|
'expanded' => true,
|
|
|
- 'em' => $this->em,
|
|
|
+ 'em' => 'default',
|
|
|
'class' => self::SINGLE_IDENT_CLASS,
|
|
|
));
|
|
|
$field->setData(null);
|
|
@@ -163,7 +163,7 @@ class EntityTypeTest extends TypeTestCase
|
|
|
$field = $this->factory->createNamed('entity', 'name', null, array(
|
|
|
'multiple' => true,
|
|
|
'expanded' => false,
|
|
|
- 'em' => $this->em,
|
|
|
+ 'em' => 'default',
|
|
|
'class' => self::SINGLE_IDENT_CLASS,
|
|
|
));
|
|
|
$field->setData(null);
|
|
@@ -177,7 +177,7 @@ class EntityTypeTest extends TypeTestCase
|
|
|
$field = $this->factory->createNamed('entity', 'name', null, array(
|
|
|
'multiple' => false,
|
|
|
'expanded' => true,
|
|
|
- 'em' => $this->em,
|
|
|
+ 'em' => 'default',
|
|
|
'class' => self::SINGLE_IDENT_CLASS,
|
|
|
));
|
|
|
$field->bind(null);
|
|
@@ -191,7 +191,7 @@ class EntityTypeTest extends TypeTestCase
|
|
|
$field = $this->factory->createNamed('entity', 'name', null, array(
|
|
|
'multiple' => false,
|
|
|
'expanded' => false,
|
|
|
- 'em' => $this->em,
|
|
|
+ 'em' => 'default',
|
|
|
'class' => self::SINGLE_IDENT_CLASS,
|
|
|
));
|
|
|
$field->bind(null);
|
|
@@ -204,7 +204,7 @@ class EntityTypeTest extends TypeTestCase
|
|
|
{
|
|
|
$field = $this->factory->createNamed('entity', 'name', null, array(
|
|
|
'multiple' => true,
|
|
|
- 'em' => $this->em,
|
|
|
+ 'em' => 'default',
|
|
|
'class' => self::SINGLE_IDENT_CLASS,
|
|
|
));
|
|
|
$field->bind(null);
|
|
@@ -223,7 +223,7 @@ class EntityTypeTest extends TypeTestCase
|
|
|
$field = $this->factory->createNamed('entity', 'name', null, array(
|
|
|
'multiple' => false,
|
|
|
'expanded' => false,
|
|
|
- 'em' => $this->em,
|
|
|
+ 'em' => 'default',
|
|
|
'class' => self::SINGLE_IDENT_CLASS,
|
|
|
'property' => 'name',
|
|
|
));
|
|
@@ -245,7 +245,7 @@ class EntityTypeTest extends TypeTestCase
|
|
|
$field = $this->factory->createNamed('entity', 'name', null, array(
|
|
|
'multiple' => false,
|
|
|
'expanded' => false,
|
|
|
- 'em' => $this->em,
|
|
|
+ 'em' => 'default',
|
|
|
'class' => self::COMPOSITE_IDENT_CLASS,
|
|
|
'property' => 'name',
|
|
|
));
|
|
@@ -269,7 +269,7 @@ class EntityTypeTest extends TypeTestCase
|
|
|
$field = $this->factory->createNamed('entity', 'name', null, array(
|
|
|
'multiple' => true,
|
|
|
'expanded' => false,
|
|
|
- 'em' => $this->em,
|
|
|
+ 'em' => 'default',
|
|
|
'class' => self::SINGLE_IDENT_CLASS,
|
|
|
'property' => 'name',
|
|
|
));
|
|
@@ -294,7 +294,7 @@ class EntityTypeTest extends TypeTestCase
|
|
|
$field = $this->factory->createNamed('entity', 'name', null, array(
|
|
|
'multiple' => true,
|
|
|
'expanded' => false,
|
|
|
- 'em' => $this->em,
|
|
|
+ 'em' => 'default',
|
|
|
'class' => self::SINGLE_IDENT_CLASS,
|
|
|
'property' => 'name',
|
|
|
));
|
|
@@ -325,7 +325,7 @@ class EntityTypeTest extends TypeTestCase
|
|
|
$field = $this->factory->createNamed('entity', 'name', null, array(
|
|
|
'multiple' => true,
|
|
|
'expanded' => false,
|
|
|
- 'em' => $this->em,
|
|
|
+ 'em' => 'default',
|
|
|
'class' => self::COMPOSITE_IDENT_CLASS,
|
|
|
'property' => 'name',
|
|
|
));
|
|
@@ -351,7 +351,7 @@ class EntityTypeTest extends TypeTestCase
|
|
|
$field = $this->factory->createNamed('entity', 'name', null, array(
|
|
|
'multiple' => true,
|
|
|
'expanded' => false,
|
|
|
- 'em' => $this->em,
|
|
|
+ 'em' => 'default',
|
|
|
'class' => self::COMPOSITE_IDENT_CLASS,
|
|
|
'property' => 'name',
|
|
|
));
|
|
@@ -381,7 +381,7 @@ class EntityTypeTest extends TypeTestCase
|
|
|
$field = $this->factory->createNamed('entity', 'name', null, array(
|
|
|
'multiple' => false,
|
|
|
'expanded' => true,
|
|
|
- 'em' => $this->em,
|
|
|
+ 'em' => 'default',
|
|
|
'class' => self::SINGLE_IDENT_CLASS,
|
|
|
'property' => 'name',
|
|
|
));
|
|
@@ -407,7 +407,7 @@ class EntityTypeTest extends TypeTestCase
|
|
|
$field = $this->factory->createNamed('entity', 'name', null, array(
|
|
|
'multiple' => true,
|
|
|
'expanded' => true,
|
|
|
- 'em' => $this->em,
|
|
|
+ 'em' => 'default',
|
|
|
'class' => self::SINGLE_IDENT_CLASS,
|
|
|
'property' => 'name',
|
|
|
));
|
|
@@ -437,7 +437,7 @@ class EntityTypeTest extends TypeTestCase
|
|
|
$this->persist(array($entity1, $entity2, $entity3));
|
|
|
|
|
|
$field = $this->factory->createNamed('entity', 'name', null, array(
|
|
|
- 'em' => $this->em,
|
|
|
+ 'em' => 'default',
|
|
|
'class' => self::SINGLE_IDENT_CLASS,
|
|
|
// not all persisted entities should be displayed
|
|
|
'choices' => array($entity1, $entity2),
|
|
@@ -461,7 +461,7 @@ class EntityTypeTest extends TypeTestCase
|
|
|
$this->persist(array($entity1, $entity2, $entity3));
|
|
|
|
|
|
$field = $this->factory->createNamed('entity', 'name', null, array(
|
|
|
- 'em' => $this->em,
|
|
|
+ 'em' => 'default',
|
|
|
'class' => self::SINGLE_IDENT_CLASS,
|
|
|
'choices' => array($entity1, $entity2),
|
|
|
'property' => 'name',
|
|
@@ -482,7 +482,7 @@ class EntityTypeTest extends TypeTestCase
|
|
|
$this->persist(array($entity1, $entity2, $entity3));
|
|
|
|
|
|
$field = $this->factory->createNamed('entity', 'name', null, array(
|
|
|
- 'em' => $this->em,
|
|
|
+ 'em' => 'default',
|
|
|
'class' => self::COMPOSITE_IDENT_CLASS,
|
|
|
'choices' => array($entity1, $entity2),
|
|
|
'property' => 'name',
|
|
@@ -505,7 +505,7 @@ class EntityTypeTest extends TypeTestCase
|
|
|
$repository = $this->em->getRepository(self::SINGLE_IDENT_CLASS);
|
|
|
|
|
|
$field = $this->factory->createNamed('entity', 'name', null, array(
|
|
|
- 'em' => $this->em,
|
|
|
+ 'em' => 'default',
|
|
|
'class' => self::SINGLE_IDENT_CLASS,
|
|
|
'query_builder' => $repository->createQueryBuilder('e')
|
|
|
->where('e.id IN (1, 2)'),
|
|
@@ -527,7 +527,7 @@ class EntityTypeTest extends TypeTestCase
|
|
|
$this->persist(array($entity1, $entity2, $entity3));
|
|
|
|
|
|
$field = $this->factory->createNamed('entity', 'name', null, array(
|
|
|
- 'em' => $this->em,
|
|
|
+ 'em' => 'default',
|
|
|
'class' => self::SINGLE_IDENT_CLASS,
|
|
|
'query_builder' => function ($repository) {
|
|
|
return $repository->createQueryBuilder('e')
|
|
@@ -551,7 +551,7 @@ class EntityTypeTest extends TypeTestCase
|
|
|
$this->persist(array($entity1, $entity2, $entity3));
|
|
|
|
|
|
$field = $this->factory->createNamed('entity', 'name', null, array(
|
|
|
- 'em' => $this->em,
|
|
|
+ 'em' => 'default',
|
|
|
'class' => self::COMPOSITE_IDENT_CLASS,
|
|
|
'query_builder' => function ($repository) {
|
|
|
return $repository->createQueryBuilder('e')
|
|
@@ -575,7 +575,7 @@ class EntityTypeTest extends TypeTestCase
|
|
|
$field = $this->factory->createNamed('entity', 'name', null, array(
|
|
|
'multiple' => false,
|
|
|
'expanded' => false,
|
|
|
- 'em' => $this->em,
|
|
|
+ 'em' => 'default',
|
|
|
'class' => self::SINGLE_STRING_IDENT_CLASS,
|
|
|
'property' => 'name',
|
|
|
));
|
|
@@ -596,7 +596,7 @@ class EntityTypeTest extends TypeTestCase
|
|
|
$field = $this->factory->createNamed('entity', 'name', null, array(
|
|
|
'multiple' => false,
|
|
|
'expanded' => false,
|
|
|
- 'em' => $this->em,
|
|
|
+ 'em' => 'default',
|
|
|
'class' => self::COMPOSITE_STRING_IDENT_CLASS,
|
|
|
'property' => 'name',
|
|
|
));
|
|
@@ -608,4 +608,15 @@ class EntityTypeTest extends TypeTestCase
|
|
|
$this->assertEquals($entity1, $field->getData());
|
|
|
$this->assertEquals(0, $field->getClientData());
|
|
|
}
|
|
|
+
|
|
|
+ protected function createRegistryMock($name, $em)
|
|
|
+ {
|
|
|
+ $registry = $this->getMock('Symfony\Bridge\Doctrine\RegistryInterface');
|
|
|
+ $registry->expects($this->any())
|
|
|
+ ->method('getEntityManager')
|
|
|
+ ->with($this->equalTo($name))
|
|
|
+ ->will($this->returnValue($em));
|
|
|
+
|
|
|
+ return $registry;
|
|
|
+ }
|
|
|
}
|