|
@@ 211-240 (lines=30) @@
|
| 208 |
|
* @expectedException \Exception |
| 209 |
|
* @expectedExceptionMessage Handler threw an exception |
| 210 |
|
*/ |
| 211 |
|
public function testFindContentThrowsHandlerException() |
| 212 |
|
{ |
| 213 |
|
$repositoryMock = $this->getRepositoryMock(); |
| 214 |
|
/** @var \eZ\Publish\SPI\Search\Handler $searchHandlerMock */ |
| 215 |
|
$searchHandlerMock = $this->getSPIMockHandler('Search\\Handler'); |
| 216 |
|
$permissionsCriterionResolverMock = $this->getPermissionCriterionResolverMock(); |
| 217 |
|
|
| 218 |
|
$service = new SearchService( |
| 219 |
|
$repositoryMock, |
| 220 |
|
$searchHandlerMock, |
| 221 |
|
$this->getDomainMapperMock(), |
| 222 |
|
$permissionsCriterionResolverMock, |
| 223 |
|
new NullIndexer(), |
| 224 |
|
array() |
| 225 |
|
); |
| 226 |
|
|
| 227 |
|
/** @var \eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterionMock */ |
| 228 |
|
$criterionMock = $this |
| 229 |
|
->getMockBuilder('eZ\\Publish\\API\\Repository\\Values\\Content\\Query\\Criterion') |
| 230 |
|
->disableOriginalConstructor() |
| 231 |
|
->getMock(); |
| 232 |
|
$query = new Query(array('filter' => $criterionMock)); |
| 233 |
|
|
| 234 |
|
$permissionsCriterionResolverMock->expects($this->once()) |
| 235 |
|
->method('getPermissionsCriterion') |
| 236 |
|
->with('content', 'read') |
| 237 |
|
->will($this->throwException(new Exception('Handler threw an exception'))); |
| 238 |
|
|
| 239 |
|
$service->findContent($query, array(), true); |
| 240 |
|
} |
| 241 |
|
|
| 242 |
|
public function providerForFindContentWhenContentLoadThrowsException() |
| 243 |
|
{ |
|
@@ 920-949 (lines=30) @@
|
| 917 |
|
* @expectedException \Exception |
| 918 |
|
* @expectedExceptionMessage Handler threw an exception |
| 919 |
|
*/ |
| 920 |
|
public function testFindLocationsThrowsHandlerException() |
| 921 |
|
{ |
| 922 |
|
$repositoryMock = $this->getRepositoryMock(); |
| 923 |
|
/** @var \eZ\Publish\SPI\Search\Handler $searchHandlerMock */ |
| 924 |
|
$searchHandlerMock = $this->getSPIMockHandler('Search\\Handler'); |
| 925 |
|
$permissionsCriterionResolverMock = $this->getPermissionCriterionResolverMock(); |
| 926 |
|
|
| 927 |
|
$service = new SearchService( |
| 928 |
|
$repositoryMock, |
| 929 |
|
$searchHandlerMock, |
| 930 |
|
$this->getDomainMapperMock(), |
| 931 |
|
$permissionsCriterionResolverMock, |
| 932 |
|
new NullIndexer(), |
| 933 |
|
array() |
| 934 |
|
); |
| 935 |
|
|
| 936 |
|
/** @var \eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterionMock */ |
| 937 |
|
$criterionMock = $this |
| 938 |
|
->getMockBuilder('eZ\\Publish\\API\\Repository\\Values\\Content\\Query\\Criterion') |
| 939 |
|
->disableOriginalConstructor() |
| 940 |
|
->getMock(); |
| 941 |
|
$query = new LocationQuery(array('filter' => $criterionMock)); |
| 942 |
|
|
| 943 |
|
$permissionsCriterionResolverMock->expects($this->once()) |
| 944 |
|
->method('getPermissionsCriterion') |
| 945 |
|
->with('content', 'read') |
| 946 |
|
->will($this->throwException(new Exception('Handler threw an exception'))); |
| 947 |
|
|
| 948 |
|
$service->findLocations($query, array(), true); |
| 949 |
|
} |
| 950 |
|
|
| 951 |
|
/** |
| 952 |
|
* Test for the findLocations() method. |