|
@@ 445-480 (lines=36) @@
|
| 442 |
|
*/ |
| 443 |
|
|
| 444 |
|
|
| 445 |
|
public function testSearchOnePageNoAggregation() { |
| 446 |
|
$this->enableHighlights(); |
| 447 |
|
$this->autoFollowRedirection = false; |
| 448 |
|
$searchTerm = 'mineralogy'; |
| 449 |
|
|
| 450 |
|
//Note pages need to be published, by default fixtures only reside in Stage |
| 451 |
|
$searchPageObj = $this->ElasticSearchPage2; |
| 452 |
|
$url = rtrim($searchPageObj->Link(), '/'); |
| 453 |
|
$url = $url . '?q=' . $searchTerm; |
| 454 |
|
$response = $this->get($url); |
| 455 |
|
$this->assertEquals(200, $response->getStatusCode()); |
| 456 |
|
|
| 457 |
|
//There are 3 results for mineralogy |
| 458 |
|
$this->assertSelectorStartsWithOrEquals('div.resultsFound', 0, |
| 459 |
|
"Page 1 of 1 (3 results found"); |
| 460 |
|
|
| 461 |
|
|
| 462 |
|
//Check all the result highlights for mineralogy matches |
| 463 |
|
$this->assertSelectorStartsWithOrEquals('strong.hl', 1, 'mineralogy'); |
| 464 |
|
$this->assertSelectorStartsWithOrEquals('strong.hl', 2, 'Mineralogy'); |
| 465 |
|
$this->assertSelectorStartsWithOrEquals('strong.hl', 3, 'mineralogy'); |
| 466 |
|
$this->assertSelectorStartsWithOrEquals('strong.hl', 4, 'Mineralogy'); |
| 467 |
|
$this->assertSelectorStartsWithOrEquals('strong.hl', 5, 'mineralogy'); |
| 468 |
|
|
| 469 |
|
|
| 470 |
|
// Check the start text of the 3 results |
| 471 |
|
$this->assertSelectorStartsWithOrEquals('div.searchResult h4 a', 0, |
| 472 |
|
"Image taken from page 273 of"); |
| 473 |
|
$this->assertSelectorStartsWithOrEquals('div.searchResult h4 a', 1, |
| 474 |
|
'Image taken from page 69 of'); |
| 475 |
|
$this->assertSelectorStartsWithOrEquals('div.searchResult h4 a', 2, |
| 476 |
|
'Image taken from page 142 of'); |
| 477 |
|
|
| 478 |
|
// No span.count means no aggregations |
| 479 |
|
$this->assertExactHTMLMatchBySelector('span.count', array()); |
| 480 |
|
} |
| 481 |
|
|
| 482 |
|
|
| 483 |
|
/* When a search is posted, should redirect to the same URL with the search term attached. This |
|
@@ 512-544 (lines=33) @@
|
| 509 |
|
/* |
| 510 |
|
Test a search for an uncommon term, no pagination here |
| 511 |
|
*/ |
| 512 |
|
public function testSearchOnePage() { |
| 513 |
|
$this->enableHighlights(); |
| 514 |
|
$this->autoFollowRedirection = false; |
| 515 |
|
$searchTerm = 'mineralogy'; |
| 516 |
|
|
| 517 |
|
//Note pages need to be published, by default fixtures only reside in Stage |
| 518 |
|
$searchPageObj = $this->ElasticSearchPage; |
| 519 |
|
$url = rtrim($searchPageObj->Link(), '/'); |
| 520 |
|
$url = $url . '?q=' . $searchTerm; |
| 521 |
|
$response = $this->get($url); |
| 522 |
|
$this->assertEquals(200, $response->getStatusCode()); |
| 523 |
|
|
| 524 |
|
//There are 3 results for mineralogy |
| 525 |
|
$this->assertSelectorStartsWithOrEquals('div.resultsFound', 0, |
| 526 |
|
"Page 1 of 1 (3 results found"); |
| 527 |
|
|
| 528 |
|
|
| 529 |
|
//Check all the result highlights for mineralogy matches |
| 530 |
|
$this->assertSelectorStartsWithOrEquals('strong.hl', 1, 'mineralogy'); |
| 531 |
|
$this->assertSelectorStartsWithOrEquals('strong.hl', 2, 'Mineralogy'); |
| 532 |
|
$this->assertSelectorStartsWithOrEquals('strong.hl', 3, 'mineralogy'); |
| 533 |
|
$this->assertSelectorStartsWithOrEquals('strong.hl', 4, 'Mineralogy'); |
| 534 |
|
$this->assertSelectorStartsWithOrEquals('strong.hl', 5, 'mineralogy'); |
| 535 |
|
|
| 536 |
|
|
| 537 |
|
// Check the start text of the 3 results |
| 538 |
|
$this->assertSelectorStartsWithOrEquals('div.searchResult h4 a', 0, |
| 539 |
|
"Image taken from page 273 of"); |
| 540 |
|
$this->assertSelectorStartsWithOrEquals('div.searchResult h4 a', 1, |
| 541 |
|
'Image taken from page 69 of'); |
| 542 |
|
$this->assertSelectorStartsWithOrEquals('div.searchResult h4 a', 2, |
| 543 |
|
'Image taken from page 142 of'); |
| 544 |
|
} |
| 545 |
|
|
| 546 |
|
|
| 547 |
|
|