|
@@ 38-49 (lines=12) @@
|
| 35 |
|
new PagerPersisterRegistry([]); |
| 36 |
|
} |
| 37 |
|
|
| 38 |
|
public function testThrowsIfThereIsNoSuchEntryInNameToServiceIdMap() |
| 39 |
|
{ |
| 40 |
|
$container = new Container(); |
| 41 |
|
|
| 42 |
|
$registry = new PagerPersisterRegistry([ |
| 43 |
|
'the_name' => 'the_service_id', |
| 44 |
|
]); |
| 45 |
|
$registry->setContainer($container); |
| 46 |
|
|
| 47 |
|
$this->setExpectedException(\InvalidArgumentException::class, 'No pager persister was registered for the give name "the_other_name".'); |
| 48 |
|
$registry->getPagerPersister('the_other_name'); |
| 49 |
|
} |
| 50 |
|
|
| 51 |
|
public function testThrowsIfRelatedServiceDoesNotImplementPagerPersisterInterface() |
| 52 |
|
{ |
|
@@ 51-63 (lines=13) @@
|
| 48 |
|
$registry->getPagerPersister('the_other_name'); |
| 49 |
|
} |
| 50 |
|
|
| 51 |
|
public function testThrowsIfRelatedServiceDoesNotImplementPagerPersisterInterface() |
| 52 |
|
{ |
| 53 |
|
$container = new Container(); |
| 54 |
|
$container->set('the_service_id', new \stdClass()); |
| 55 |
|
|
| 56 |
|
$registry = new PagerPersisterRegistry([ |
| 57 |
|
'the_name' => 'the_service_id', |
| 58 |
|
]); |
| 59 |
|
$registry->setContainer($container); |
| 60 |
|
|
| 61 |
|
$this->setExpectedException(\LogicException::class, 'The pager provider service "the_service_id" must implement "FOS\ElasticaBundle\Persister\PagerPersisterInterface" interface but it is an instance of "stdClass" class.'); |
| 62 |
|
$registry->getPagerPersister('the_name'); |
| 63 |
|
} |
| 64 |
|
|
| 65 |
|
public function testThrowsIfThereIsServiceWithSuchId() |
| 66 |
|
{ |
|
@@ 65-76 (lines=12) @@
|
| 62 |
|
$registry->getPagerPersister('the_name'); |
| 63 |
|
} |
| 64 |
|
|
| 65 |
|
public function testThrowsIfThereIsServiceWithSuchId() |
| 66 |
|
{ |
| 67 |
|
$container = new Container(); |
| 68 |
|
|
| 69 |
|
$registry = new PagerPersisterRegistry([ |
| 70 |
|
'the_name' => 'the_service_id', |
| 71 |
|
]); |
| 72 |
|
$registry->setContainer($container); |
| 73 |
|
|
| 74 |
|
$this->setExpectedException(\LogicException::class, 'You have requested a non-existent service "the_service_id".'); |
| 75 |
|
$registry->getPagerPersister('the_name'); |
| 76 |
|
} |
| 77 |
|
|
| 78 |
|
public function testShouldReturnPagerPersisterByGivenName() |
| 79 |
|
{ |