|
@@ 98-124 (lines=27) @@
|
| 95 |
|
/** |
| 96 |
|
* @dataProvider providerForFindContentValidatesLocationCriteriaAndSortClauses |
| 97 |
|
*/ |
| 98 |
|
public function testFindContentValidatesLocationCriteriaAndSortClauses($query, $exceptionMessage) |
| 99 |
|
{ |
| 100 |
|
$this->expectException(\eZ\Publish\API\Repository\Exceptions\InvalidArgumentException::class); |
| 101 |
|
|
| 102 |
|
$repositoryMock = $this->getRepositoryMock(); |
| 103 |
|
/** @var \eZ\Publish\SPI\Search\Handler $searchHandlerMock */ |
| 104 |
|
$searchHandlerMock = $this->getSPIMockHandler('Search\\Handler'); |
| 105 |
|
$permissionsCriterionResolverMock = $this->getPermissionCriterionResolverMock(); |
| 106 |
|
|
| 107 |
|
$service = new SearchService( |
| 108 |
|
$repositoryMock, |
| 109 |
|
$searchHandlerMock, |
| 110 |
|
$this->getContentDomainMapperMock(), |
| 111 |
|
$permissionsCriterionResolverMock, |
| 112 |
|
new NullIndexer(), |
| 113 |
|
[] |
| 114 |
|
); |
| 115 |
|
|
| 116 |
|
try { |
| 117 |
|
$service->findContent($query); |
| 118 |
|
} catch (InvalidArgumentException $e) { |
| 119 |
|
$this->assertEquals($exceptionMessage, $e->getMessage()); |
| 120 |
|
throw $e; |
| 121 |
|
} |
| 122 |
|
|
| 123 |
|
$this->fail('Expected exception was not thrown'); |
| 124 |
|
} |
| 125 |
|
|
| 126 |
|
public function providerForFindSingleValidatesLocationCriteria() |
| 127 |
|
{ |
|
@@ 147-172 (lines=26) @@
|
| 144 |
|
/** |
| 145 |
|
* @dataProvider providerForFindSingleValidatesLocationCriteria |
| 146 |
|
*/ |
| 147 |
|
public function testFindSingleValidatesLocationCriteria($criterion, $exceptionMessage) |
| 148 |
|
{ |
| 149 |
|
$this->expectException(\eZ\Publish\API\Repository\Exceptions\InvalidArgumentException::class); |
| 150 |
|
|
| 151 |
|
$repositoryMock = $this->getRepositoryMock(); |
| 152 |
|
/** @var \eZ\Publish\SPI\Search\Handler $searchHandlerMock */ |
| 153 |
|
$searchHandlerMock = $this->getSPIMockHandler('Search\\Handler'); |
| 154 |
|
$permissionsCriterionResolverMock = $this->getPermissionCriterionResolverMock(); |
| 155 |
|
$service = new SearchService( |
| 156 |
|
$repositoryMock, |
| 157 |
|
$searchHandlerMock, |
| 158 |
|
$this->getContentDomainMapperMock(), |
| 159 |
|
$permissionsCriterionResolverMock, |
| 160 |
|
new NullIndexer(), |
| 161 |
|
[] |
| 162 |
|
); |
| 163 |
|
|
| 164 |
|
try { |
| 165 |
|
$service->findSingle($criterion); |
| 166 |
|
} catch (InvalidArgumentException $e) { |
| 167 |
|
$this->assertEquals($exceptionMessage, $e->getMessage()); |
| 168 |
|
throw $e; |
| 169 |
|
} |
| 170 |
|
|
| 171 |
|
$this->fail('Expected exception was not thrown'); |
| 172 |
|
} |
| 173 |
|
|
| 174 |
|
/** |
| 175 |
|
* Test for the findContent() method. |