|
@@ 178-211 (lines=34) @@
|
| 175 |
|
/** |
| 176 |
|
* @When /^I view a content matched by the view configuration above$/ |
| 177 |
|
*/ |
| 178 |
|
public function visitMatchedContent() |
| 179 |
|
{ |
| 180 |
|
$urlAliasService = $this->repository->getURLAliasService(); |
| 181 |
|
$urlAlias = $urlAliasService->reverseLookup( |
| 182 |
|
$this->repository->getLocationService()->loadLocation( |
| 183 |
|
$this->matchedContent->contentInfo->mainLocationId |
| 184 |
|
) |
| 185 |
|
); |
| 186 |
|
|
| 187 |
|
$this->visitPath($urlAlias->path); |
| 188 |
|
|
| 189 |
|
if ($this->getSession()->getStatusCode() !== 200) { |
| 190 |
|
$page = $this->getSession()->getPage(); |
| 191 |
|
$exceptionElements = $page->findAll('xpath', "//div[@class='text-exception']/h1"); |
| 192 |
|
$exceptionStackTraceItems = $page->findAll('xpath', "//ol[@id='traces-0']/li"); |
| 193 |
|
if (\count($exceptionElements) > 0) { |
| 194 |
|
$exceptionElement = $exceptionElements[0]; |
| 195 |
|
$exceptionLines = [$exceptionElement->getText(), '']; |
| 196 |
|
|
| 197 |
|
foreach ($exceptionStackTraceItems as $stackTraceItem) { |
| 198 |
|
$html = $stackTraceItem->getHtml(); |
| 199 |
|
$html = substr($html, 0, strpos($html, '<a href', 1)); |
| 200 |
|
$html = htmlspecialchars_decode(strip_tags($html)); |
| 201 |
|
$html = preg_replace('/\s+/', ' ', $html); |
| 202 |
|
$html = str_replace(' (', '(', $html); |
| 203 |
|
$html = str_replace(' ->', '->', $html); |
| 204 |
|
$exceptionLines[] = trim($html); |
| 205 |
|
} |
| 206 |
|
$message = 'An exception occurred during rendering:' . implode("\n", $exceptionLines); |
| 207 |
|
Assert::assertTrue(false, $message); |
| 208 |
|
} |
| 209 |
|
} |
| 210 |
|
$this->assertSession()->statusCodeEquals(200); |
| 211 |
|
} |
| 212 |
|
|
| 213 |
|
/** |
| 214 |
|
* @Then /^the viewed content's main location id is mapped to the parentLocationId QueryType parameter$/ |
|
@@ 343-376 (lines=34) @@
|
| 340 |
|
/** |
| 341 |
|
* @When I view a content matched by the view configuration above on page :arg1 with the :arg2 parameter |
| 342 |
|
*/ |
| 343 |
|
public function iViewAContentMatchedByTheViewConfigurationAboveOnPageWithTheParameter($pageNumber, $pageParam) |
| 344 |
|
{ |
| 345 |
|
$urlAliasService = $this->repository->getURLAliasService(); |
| 346 |
|
$urlAlias = $urlAliasService->reverseLookup( |
| 347 |
|
$this->repository->getLocationService()->loadLocation( |
| 348 |
|
$this->matchedContent->contentInfo->mainLocationId |
| 349 |
|
) |
| 350 |
|
); |
| 351 |
|
|
| 352 |
|
$this->visitPath($urlAlias->path . "?$pageParam=$pageNumber"); |
| 353 |
|
|
| 354 |
|
if ($this->getSession()->getStatusCode() !== 200) { |
| 355 |
|
$page = $this->getSession()->getPage(); |
| 356 |
|
$exceptionElements = $page->findAll('xpath', "//div[@class='text-exception']/h1"); |
| 357 |
|
$exceptionStackTraceItems = $page->findAll('xpath', "//ol[@id='traces-0']/li"); |
| 358 |
|
if (\count($exceptionElements) > 0) { |
| 359 |
|
$exceptionElement = $exceptionElements[0]; |
| 360 |
|
$exceptionLines = [$exceptionElement->getText(), '']; |
| 361 |
|
|
| 362 |
|
foreach ($exceptionStackTraceItems as $stackTraceItem) { |
| 363 |
|
$html = $stackTraceItem->getHtml(); |
| 364 |
|
$html = substr($html, 0, strpos($html, '<a href', 1)); |
| 365 |
|
$html = htmlspecialchars_decode(strip_tags($html)); |
| 366 |
|
$html = preg_replace('/\s+/', ' ', $html); |
| 367 |
|
$html = str_replace(' (', '(', $html); |
| 368 |
|
$html = str_replace(' ->', '->', $html); |
| 369 |
|
$exceptionLines[] = trim($html); |
| 370 |
|
} |
| 371 |
|
$message = 'An exception occurred during rendering:' . implode("\n", $exceptionLines); |
| 372 |
|
Assert::assertTrue(false, $message); |
| 373 |
|
} |
| 374 |
|
} |
| 375 |
|
$this->assertSession()->statusCodeEquals(200); |
| 376 |
|
} |
| 377 |
|
|
| 378 |
|
/** |
| 379 |
|
* @Then the Query results assigned to the twig variable is a Pagerfanta object and has limit :arg1 and selected page :arg2 |