|
@@ 213-242 (lines=30) @@
|
| 210 |
|
* @expectedException \Exception |
| 211 |
|
* @expectedExceptionMessage Handler threw an exception |
| 212 |
|
*/ |
| 213 |
|
public function testFindContentThrowsHandlerException() |
| 214 |
|
{ |
| 215 |
|
$repositoryMock = $this->getRepositoryMock(); |
| 216 |
|
/** @var \eZ\Publish\SPI\Search\Handler $searchHandlerMock */ |
| 217 |
|
$searchHandlerMock = $this->getSPIMockHandler('Search\\Handler'); |
| 218 |
|
$permissionsCriterionResolverMock = $this->getPermissionCriterionResolverMock(); |
| 219 |
|
|
| 220 |
|
$service = new SearchService( |
| 221 |
|
$repositoryMock, |
| 222 |
|
$searchHandlerMock, |
| 223 |
|
$this->getDomainMapperMock(), |
| 224 |
|
$permissionsCriterionResolverMock, |
| 225 |
|
new NullIndexer(), |
| 226 |
|
array() |
| 227 |
|
); |
| 228 |
|
|
| 229 |
|
/** @var \eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterionMock */ |
| 230 |
|
$criterionMock = $this |
| 231 |
|
->getMockBuilder(Criterion::class) |
| 232 |
|
->disableOriginalConstructor() |
| 233 |
|
->getMock(); |
| 234 |
|
$query = new Query(array('filter' => $criterionMock)); |
| 235 |
|
|
| 236 |
|
$permissionsCriterionResolverMock->expects($this->once()) |
| 237 |
|
->method('getPermissionsCriterion') |
| 238 |
|
->with('content', 'read') |
| 239 |
|
->will($this->throwException(new Exception('Handler threw an exception'))); |
| 240 |
|
|
| 241 |
|
$service->findContent($query, array(), true); |
| 242 |
|
} |
| 243 |
|
|
| 244 |
|
/** |
| 245 |
|
* Test for the findContent() method when search is out of sync with persistence. |
|
@@ 876-905 (lines=30) @@
|
| 873 |
|
* @expectedException \Exception |
| 874 |
|
* @expectedExceptionMessage Handler threw an exception |
| 875 |
|
*/ |
| 876 |
|
public function testFindLocationsThrowsHandlerException() |
| 877 |
|
{ |
| 878 |
|
$repositoryMock = $this->getRepositoryMock(); |
| 879 |
|
/** @var \eZ\Publish\SPI\Search\Handler $searchHandlerMock */ |
| 880 |
|
$searchHandlerMock = $this->getSPIMockHandler('Search\\Handler'); |
| 881 |
|
$permissionsCriterionResolverMock = $this->getPermissionCriterionResolverMock(); |
| 882 |
|
|
| 883 |
|
$service = new SearchService( |
| 884 |
|
$repositoryMock, |
| 885 |
|
$searchHandlerMock, |
| 886 |
|
$this->getDomainMapperMock(), |
| 887 |
|
$permissionsCriterionResolverMock, |
| 888 |
|
new NullIndexer(), |
| 889 |
|
array() |
| 890 |
|
); |
| 891 |
|
|
| 892 |
|
/** @var \eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterionMock */ |
| 893 |
|
$criterionMock = $this |
| 894 |
|
->getMockBuilder(Criterion::class) |
| 895 |
|
->disableOriginalConstructor() |
| 896 |
|
->getMock(); |
| 897 |
|
$query = new LocationQuery(array('filter' => $criterionMock)); |
| 898 |
|
|
| 899 |
|
$permissionsCriterionResolverMock->expects($this->once()) |
| 900 |
|
->method('getPermissionsCriterion') |
| 901 |
|
->with('content', 'read') |
| 902 |
|
->will($this->throwException(new Exception('Handler threw an exception'))); |
| 903 |
|
|
| 904 |
|
$service->findLocations($query, array(), true); |
| 905 |
|
} |
| 906 |
|
|
| 907 |
|
/** |
| 908 |
|
* Test for the findLocations() method. |