|
@@ 206-235 (lines=30) @@
|
| 203 |
|
* @expectedException \Exception |
| 204 |
|
* @expectedExceptionMessage Handler threw an exception |
| 205 |
|
*/ |
| 206 |
|
public function testFindContentThrowsHandlerException() |
| 207 |
|
{ |
| 208 |
|
$repositoryMock = $this->getRepositoryMock(); |
| 209 |
|
/** @var \eZ\Publish\SPI\Search\Handler $searchHandlerMock */ |
| 210 |
|
$searchHandlerMock = $this->getSPIMockHandler('Search\\Handler'); |
| 211 |
|
$permissionsCriterionHandlerMock = $this->getPermissionsCriterionHandlerMock(); |
| 212 |
|
|
| 213 |
|
$service = new SearchService( |
| 214 |
|
$repositoryMock, |
| 215 |
|
$searchHandlerMock, |
| 216 |
|
$this->getDomainMapperMock(), |
| 217 |
|
$permissionsCriterionHandlerMock, |
| 218 |
|
new NullIndexer(), |
| 219 |
|
array() |
| 220 |
|
); |
| 221 |
|
|
| 222 |
|
/** @var \eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterionMock */ |
| 223 |
|
$criterionMock = $this |
| 224 |
|
->getMockBuilder('eZ\\Publish\\API\\Repository\\Values\\Content\\Query\\Criterion') |
| 225 |
|
->disableOriginalConstructor() |
| 226 |
|
->getMock(); |
| 227 |
|
$query = new Query(array('filter' => $criterionMock)); |
| 228 |
|
|
| 229 |
|
$permissionsCriterionHandlerMock->expects($this->once()) |
| 230 |
|
->method('addPermissionsCriterion') |
| 231 |
|
->with($criterionMock) |
| 232 |
|
->will($this->throwException(new Exception('Handler threw an exception'))); |
| 233 |
|
|
| 234 |
|
$service->findContent($query, array(), true); |
| 235 |
|
} |
| 236 |
|
|
| 237 |
|
/** |
| 238 |
|
* Test for the findContent() method. |
|
@@ 788-817 (lines=30) @@
|
| 785 |
|
* @expectedException \Exception |
| 786 |
|
* @expectedExceptionMessage Handler threw an exception |
| 787 |
|
*/ |
| 788 |
|
public function testFindLocationsThrowsHandlerException() |
| 789 |
|
{ |
| 790 |
|
$repositoryMock = $this->getRepositoryMock(); |
| 791 |
|
/** @var \eZ\Publish\SPI\Search\Handler $searchHandlerMock */ |
| 792 |
|
$searchHandlerMock = $this->getSPIMockHandler('Search\\Handler'); |
| 793 |
|
$permissionsCriterionHandlerMock = $this->getPermissionsCriterionHandlerMock(); |
| 794 |
|
|
| 795 |
|
$service = new SearchService( |
| 796 |
|
$repositoryMock, |
| 797 |
|
$searchHandlerMock, |
| 798 |
|
$this->getDomainMapperMock(), |
| 799 |
|
$permissionsCriterionHandlerMock, |
| 800 |
|
new NullIndexer(), |
| 801 |
|
array() |
| 802 |
|
); |
| 803 |
|
|
| 804 |
|
/** @var \eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterionMock */ |
| 805 |
|
$criterionMock = $this |
| 806 |
|
->getMockBuilder('eZ\\Publish\\API\\Repository\\Values\\Content\\Query\\Criterion') |
| 807 |
|
->disableOriginalConstructor() |
| 808 |
|
->getMock(); |
| 809 |
|
$query = new LocationQuery(array('filter' => $criterionMock)); |
| 810 |
|
|
| 811 |
|
$permissionsCriterionHandlerMock->expects($this->once()) |
| 812 |
|
->method('addPermissionsCriterion') |
| 813 |
|
->with($criterionMock) |
| 814 |
|
->will($this->throwException(new Exception('Handler threw an exception'))); |
| 815 |
|
|
| 816 |
|
$service->findLocations($query, array(), true); |
| 817 |
|
} |
| 818 |
|
|
| 819 |
|
/** |
| 820 |
|
* Test for the findLocations() method. |