|
@@ 33-55 (lines=23) @@
|
| 30 |
|
* Tests that the Transformer uses the query_builder_method configuration option |
| 31 |
|
* allowing configuration of createQueryBuilder call. |
| 32 |
|
*/ |
| 33 |
|
public function testTransformUsesQueryBuilderMethodConfiguration() |
| 34 |
|
{ |
| 35 |
|
$qb = $this->getMockBuilder('Doctrine\ORM\QueryBuilder') |
| 36 |
|
->disableOriginalConstructor() |
| 37 |
|
->getMock(); |
| 38 |
|
|
| 39 |
|
$this->repository->expects($this->once()) |
| 40 |
|
->method('customQueryBuilderCreator') |
| 41 |
|
->with($this->equalTo(ElasticaToModelTransformer::ENTITY_ALIAS)) |
| 42 |
|
->will($this->returnValue($qb)); |
| 43 |
|
$this->repository->expects($this->never()) |
| 44 |
|
->method('createQueryBuilder'); |
| 45 |
|
|
| 46 |
|
$transformer = new ElasticaToModelTransformer($this->registry, $this->objectClass, array( |
| 47 |
|
'query_builder_method' => 'customQueryBuilderCreator', |
| 48 |
|
)); |
| 49 |
|
|
| 50 |
|
$class = new \ReflectionClass('FOS\ElasticaBundle\Doctrine\ORM\ElasticaToModelTransformer'); |
| 51 |
|
$method = $class->getMethod('getEntityQueryBuilder'); |
| 52 |
|
$method->setAccessible(true); |
| 53 |
|
|
| 54 |
|
$method->invokeArgs($transformer, array()); |
| 55 |
|
} |
| 56 |
|
|
| 57 |
|
/** |
| 58 |
|
* Tests that the Transformer uses the query_builder_method configuration option |
|
@@ 61-81 (lines=21) @@
|
| 58 |
|
* Tests that the Transformer uses the query_builder_method configuration option |
| 59 |
|
* allowing configuration of createQueryBuilder call. |
| 60 |
|
*/ |
| 61 |
|
public function testTransformUsesDefaultQueryBuilderMethodConfiguration() |
| 62 |
|
{ |
| 63 |
|
$qb = $this->getMockBuilder('Doctrine\ORM\QueryBuilder') |
| 64 |
|
->disableOriginalConstructor() |
| 65 |
|
->getMock(); |
| 66 |
|
|
| 67 |
|
$this->repository->expects($this->never()) |
| 68 |
|
->method('customQueryBuilderCreator'); |
| 69 |
|
$this->repository->expects($this->once()) |
| 70 |
|
->method('createQueryBuilder') |
| 71 |
|
->with($this->equalTo(ElasticaToModelTransformer::ENTITY_ALIAS)) |
| 72 |
|
->will($this->returnValue($qb)); |
| 73 |
|
|
| 74 |
|
$transformer = new ElasticaToModelTransformer($this->registry, $this->objectClass); |
| 75 |
|
|
| 76 |
|
$class = new \ReflectionClass('FOS\ElasticaBundle\Doctrine\ORM\ElasticaToModelTransformer'); |
| 77 |
|
$method = $class->getMethod('getEntityQueryBuilder'); |
| 78 |
|
$method->setAccessible(true); |
| 79 |
|
|
| 80 |
|
$method->invokeArgs($transformer, array()); |
| 81 |
|
} |
| 82 |
|
|
| 83 |
|
|
| 84 |
|
/** |