@@ 122-145 (lines=24) @@ | ||
119 | * @dataProvider providerForFindContentValidatesLocationCriteriaAndSortClauses |
|
120 | * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException |
|
121 | */ |
|
122 | public function testFindContentValidatesLocationCriteriaAndSortClauses($query, $exceptionMessage) |
|
123 | { |
|
124 | $repositoryMock = $this->getRepositoryMock(); |
|
125 | /** @var \eZ\Publish\SPI\Search\Handler $searchHandlerMock */ |
|
126 | $searchHandlerMock = $this->getSPIMockHandler('Search\\Handler'); |
|
127 | $permissionsCriterionHandlerMock = $this->getPermissionsCriterionHandlerMock(); |
|
128 | ||
129 | $service = new SearchService( |
|
130 | $repositoryMock, |
|
131 | $searchHandlerMock, |
|
132 | $this->getDomainMapperMock(), |
|
133 | $permissionsCriterionHandlerMock, |
|
134 | array() |
|
135 | ); |
|
136 | ||
137 | try { |
|
138 | $service->findContent($query); |
|
139 | } catch (InvalidArgumentException $e) { |
|
140 | $this->assertEquals($exceptionMessage, $e->getMessage()); |
|
141 | throw $e; |
|
142 | } |
|
143 | ||
144 | $this->fail('Expected exception was not thrown'); |
|
145 | } |
|
146 | ||
147 | public function providerForFindSingleValidatesLocationCriteria() |
|
148 | { |
|
@@ 169-191 (lines=23) @@ | ||
166 | * @dataProvider providerForFindSingleValidatesLocationCriteria |
|
167 | * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException |
|
168 | */ |
|
169 | public function testFindSingleValidatesLocationCriteria($criterion, $exceptionMessage) |
|
170 | { |
|
171 | $repositoryMock = $this->getRepositoryMock(); |
|
172 | /** @var \eZ\Publish\SPI\Search\Handler $searchHandlerMock */ |
|
173 | $searchHandlerMock = $this->getSPIMockHandler('Search\\Handler'); |
|
174 | $permissionsCriterionHandlerMock = $this->getPermissionsCriterionHandlerMock(); |
|
175 | $service = new SearchService( |
|
176 | $repositoryMock, |
|
177 | $searchHandlerMock, |
|
178 | $this->getDomainMapperMock(), |
|
179 | $permissionsCriterionHandlerMock, |
|
180 | array() |
|
181 | ); |
|
182 | ||
183 | try { |
|
184 | $service->findSingle($criterion); |
|
185 | } catch (InvalidArgumentException $e) { |
|
186 | $this->assertEquals($exceptionMessage, $e->getMessage()); |
|
187 | throw $e; |
|
188 | } |
|
189 | ||
190 | $this->fail('Expected exception was not thrown'); |
|
191 | } |
|
192 | ||
193 | /** |
|
194 | * Test for the findContent() method. |