|
@@ 202-230 (lines=29) @@
|
| 199 |
|
* @expectedException \Exception |
| 200 |
|
* @expectedExceptionMessage Handler threw an exception |
| 201 |
|
*/ |
| 202 |
|
public function testFindContentThrowsHandlerException() |
| 203 |
|
{ |
| 204 |
|
$repositoryMock = $this->getRepositoryMock(); |
| 205 |
|
/** @var \eZ\Publish\SPI\Search\Handler $searchHandlerMock */ |
| 206 |
|
$searchHandlerMock = $this->getSPIMockHandler('Search\\Handler'); |
| 207 |
|
$permissionsCriterionResolverMock = $this->getPermissionCriterionResolverMock(); |
| 208 |
|
|
| 209 |
|
$service = new SearchService( |
| 210 |
|
$repositoryMock, |
| 211 |
|
$searchHandlerMock, |
| 212 |
|
$this->getDomainMapperMock(), |
| 213 |
|
$permissionsCriterionResolverMock, |
| 214 |
|
array() |
| 215 |
|
); |
| 216 |
|
|
| 217 |
|
/** @var \eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterionMock */ |
| 218 |
|
$criterionMock = $this |
| 219 |
|
->getMockBuilder('eZ\\Publish\\API\\Repository\\Values\\Content\\Query\\Criterion') |
| 220 |
|
->disableOriginalConstructor() |
| 221 |
|
->getMock(); |
| 222 |
|
$query = new Query(array('filter' => $criterionMock)); |
| 223 |
|
|
| 224 |
|
$permissionsCriterionResolverMock->expects($this->once()) |
| 225 |
|
->method('getPermissionsCriterion') |
| 226 |
|
->with('content', 'read') |
| 227 |
|
->will($this->throwException(new Exception('Handler threw an exception'))); |
| 228 |
|
|
| 229 |
|
$service->findContent($query, array(), true); |
| 230 |
|
} |
| 231 |
|
|
| 232 |
|
/** |
| 233 |
|
* Test for the findContent() method. |
|
@@ 773-801 (lines=29) @@
|
| 770 |
|
* @expectedException \Exception |
| 771 |
|
* @expectedExceptionMessage Handler threw an exception |
| 772 |
|
*/ |
| 773 |
|
public function testFindLocationsThrowsHandlerException() |
| 774 |
|
{ |
| 775 |
|
$repositoryMock = $this->getRepositoryMock(); |
| 776 |
|
/** @var \eZ\Publish\SPI\Search\Handler $searchHandlerMock */ |
| 777 |
|
$searchHandlerMock = $this->getSPIMockHandler('Search\\Handler'); |
| 778 |
|
$permissionsCriterionResolverMock = $this->getPermissionCriterionResolverMock(); |
| 779 |
|
|
| 780 |
|
$service = new SearchService( |
| 781 |
|
$repositoryMock, |
| 782 |
|
$searchHandlerMock, |
| 783 |
|
$this->getDomainMapperMock(), |
| 784 |
|
$permissionsCriterionResolverMock, |
| 785 |
|
array() |
| 786 |
|
); |
| 787 |
|
|
| 788 |
|
/** @var \eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterionMock */ |
| 789 |
|
$criterionMock = $this |
| 790 |
|
->getMockBuilder('eZ\\Publish\\API\\Repository\\Values\\Content\\Query\\Criterion') |
| 791 |
|
->disableOriginalConstructor() |
| 792 |
|
->getMock(); |
| 793 |
|
$query = new LocationQuery(array('filter' => $criterionMock)); |
| 794 |
|
|
| 795 |
|
$permissionsCriterionResolverMock->expects($this->once()) |
| 796 |
|
->method('getPermissionsCriterion') |
| 797 |
|
->with('content', 'read') |
| 798 |
|
->will($this->throwException(new Exception('Handler threw an exception'))); |
| 799 |
|
|
| 800 |
|
$service->findLocations($query, array(), true); |
| 801 |
|
} |
| 802 |
|
|
| 803 |
|
/** |
| 804 |
|
* Test for the findLocations() method. |