@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | public function testQueryInSearchBoxForOneFormOnly() { |
| 247 | 247 | $searchPageObj = $this->ElasticSearchPage2; |
| 248 | 248 | $url = rtrim($searchPageObj->Link(), '/'); |
| 249 | - $url .= "?q=Auckland&sfid=".$searchPageObj->Identifier; |
|
| 249 | + $url .= "?q=Auckland&sfid=" . $searchPageObj->Identifier; |
|
| 250 | 250 | $response = $this->get($url); |
| 251 | 251 | $this->assertEquals(200, $response->getStatusCode()); |
| 252 | 252 | $this->assertAttributeHasExactValue('#ElasticSearchForm_SearchForm_q', 'q', |
@@ -504,7 +504,7 @@ discard block |
||
| 504 | 504 | //Note pages need to be published, by default fixtures only reside in Stage |
| 505 | 505 | $searchPageObj = $this->ElasticSearchPage2; |
| 506 | 506 | $url = rtrim($searchPageObj->Link(), '/'); |
| 507 | - $url = $url.'?q='.$searchTerm; |
|
| 507 | + $url = $url . '?q=' . $searchTerm; |
|
| 508 | 508 | $response = $this->get($url); |
| 509 | 509 | $this->assertEquals(200, $response->getStatusCode()); |
| 510 | 510 | |
@@ -571,7 +571,7 @@ discard block |
||
| 571 | 571 | //Note pages need to be published, by default fixtures only reside in Stage |
| 572 | 572 | $searchPageObj = $this->ElasticSearchPage; |
| 573 | 573 | $url = rtrim($searchPageObj->Link(), '/'); |
| 574 | - $url = $url.'?q='.$searchTerm; |
|
| 574 | + $url = $url . '?q=' . $searchTerm; |
|
| 575 | 575 | $response = $this->get($url); |
| 576 | 576 | $this->assertEquals(200, $response->getStatusCode()); |
| 577 | 577 | |
@@ -702,18 +702,18 @@ discard block |
||
| 702 | 702 | //increase the number of results and assert that they are the same as per pages 1,2 joined |
| 703 | 703 | $searchPageObj->ResultsPerPage = 20; |
| 704 | 704 | $searchPageObj->write(); |
| 705 | - $searchPageObj->publish('Stage','Live'); |
|
| 705 | + $searchPageObj->publish('Stage', 'Live'); |
|
| 706 | 706 | $response3 = $this->get($firstPageURL); |
| 707 | 707 | } |
| 708 | 708 | |
| 709 | 709 | |
| 710 | 710 | private function enableHighlights() { |
| 711 | - foreach (SearchableField::get()->filter('Name', 'Title') as $sf) { |
|
| 711 | + foreach(SearchableField::get()->filter('Name', 'Title') as $sf) { |
|
| 712 | 712 | $sf->ShowHighlights = true; |
| 713 | 713 | $sf->write(); |
| 714 | 714 | } |
| 715 | 715 | |
| 716 | - foreach (SearchableField::get()->filter('Name', 'Content') as $sf) { |
|
| 716 | + foreach(SearchableField::get()->filter('Name', 'Content') as $sf) { |
|
| 717 | 717 | $sf->ShowHighlights = true; |
| 718 | 718 | $sf->write(); |
| 719 | 719 | } |
@@ -74,11 +74,11 @@ discard block |
||
| 74 | 74 | $this->assertEquals(200, $searchPage->getStatusCode()); |
| 75 | 75 | $url = rtrim($url, '/'); |
| 76 | 76 | |
| 77 | - $response = $this->get($url); |
|
| 78 | - error_log($response); |
|
| 79 | - $this->assertEquals(200, $response->getStatusCode()); |
|
| 77 | + $response = $this->get($url); |
|
| 78 | + error_log($response); |
|
| 79 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 80 | 80 | |
| 81 | - $this->assertSelectorStartsWithOrEquals('span.count', 0, '(5)'); |
|
| 81 | + $this->assertSelectorStartsWithOrEquals('span.count', 0, '(5)'); |
|
| 82 | 82 | $this->assertSelectorStartsWithOrEquals('span.count', 1, '(11)'); |
| 83 | 83 | $this->assertSelectorStartsWithOrEquals('span.count', 2, '(12)'); |
| 84 | 84 | $this->assertSelectorStartsWithOrEquals('span.count', 3, '(13)'); |
@@ -128,11 +128,11 @@ discard block |
||
| 128 | 128 | $url = rtrim($url, '/'); |
| 129 | 129 | $url .= '?ISO=400'; |
| 130 | 130 | |
| 131 | - $response = $this->get($url); |
|
| 132 | - error_log($response); |
|
| 133 | - $this->assertEquals(200, $response->getStatusCode()); |
|
| 131 | + $response = $this->get($url); |
|
| 132 | + error_log($response); |
|
| 133 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 134 | 134 | |
| 135 | - // These are less than in the no facets selected case, as expected |
|
| 135 | + // These are less than in the no facets selected case, as expected |
|
| 136 | 136 | $this->assertSelectorStartsWithOrEquals('span.count', 0, '(2)'); |
| 137 | 137 | $this->assertSelectorStartsWithOrEquals('span.count', 1, '(1)'); |
| 138 | 138 | $this->assertSelectorStartsWithOrEquals('span.count', 2, '(2)'); |
@@ -176,12 +176,12 @@ discard block |
||
| 176 | 176 | $url = rtrim($url, '/'); |
| 177 | 177 | $url .= '?ISO=400&ShutterSpeed=2%2F250'; |
| 178 | 178 | |
| 179 | - $response = $this->get($url); |
|
| 180 | - error_log($response); |
|
| 181 | - $this->assertEquals(200, $response->getStatusCode()); |
|
| 179 | + $response = $this->get($url); |
|
| 180 | + error_log($response); |
|
| 181 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 182 | 182 | |
| 183 | - // These are less than in the one facet selected case, as expected |
|
| 184 | - $this->assertSelectorStartsWithOrEquals('span.count', 0, '(1)'); |
|
| 183 | + // These are less than in the one facet selected case, as expected |
|
| 184 | + $this->assertSelectorStartsWithOrEquals('span.count', 0, '(1)'); |
|
| 185 | 185 | $this->assertSelectorStartsWithOrEquals('span.count', 1, '(2)'); |
| 186 | 186 | $this->assertSelectorStartsWithOrEquals('span.count', 2, '(1)'); |
| 187 | 187 | $this->assertSelectorStartsWithOrEquals('span.count', 3, '(1)'); |
@@ -210,11 +210,11 @@ discard block |
||
| 210 | 210 | $url = rtrim($url, '/'); |
| 211 | 211 | $url .= '?ISO=400&ShutterSpeed=2%2F250&Aspect=Vertical'; |
| 212 | 212 | |
| 213 | - $response = $this->get($url); |
|
| 214 | - $this->assertEquals(200, $response->getStatusCode()); |
|
| 213 | + $response = $this->get($url); |
|
| 214 | + $this->assertEquals(200, $response->getStatusCode()); |
|
| 215 | 215 | |
| 216 | - // These are less than in the one facet selected case, as expected |
|
| 217 | - $this->assertSelectorStartsWithOrEquals('span.count', 0, '(2)'); |
|
| 216 | + // These are less than in the one facet selected case, as expected |
|
| 217 | + $this->assertSelectorStartsWithOrEquals('span.count', 0, '(2)'); |
|
| 218 | 218 | $this->assertSelectorStartsWithOrEquals('span.count', 1, '(1)'); |
| 219 | 219 | $this->assertSelectorStartsWithOrEquals('span.count', 2, '(1)'); |
| 220 | 220 | } |
@@ -551,13 +551,13 @@ discard block |
||
| 551 | 551 | $searchPage = $this->get($searchPageObj->URLSegment); |
| 552 | 552 | $this->assertEquals(200, $searchPage->getStatusCode()); |
| 553 | 553 | |
| 554 | - $response = $this->submitForm("ElasticSearchForm_SearchForm", null, array( |
|
| 555 | - 'q' => 'New Zealand' |
|
| 556 | - )); |
|
| 554 | + $response = $this->submitForm("ElasticSearchForm_SearchForm", null, array( |
|
| 555 | + 'q' => 'New Zealand' |
|
| 556 | + )); |
|
| 557 | 557 | |
| 558 | 558 | $url = rtrim($url, '/'); |
| 559 | - $this->assertEquals(302, $response->getStatusCode()); |
|
| 560 | - $this->assertEquals($url . '?q=New Zealand&sfid=testwithagg', $response->getHeader('Location')); |
|
| 559 | + $this->assertEquals(302, $response->getStatusCode()); |
|
| 560 | + $this->assertEquals($url . '?q=New Zealand&sfid=testwithagg', $response->getHeader('Location')); |
|
| 561 | 561 | } |
| 562 | 562 | |
| 563 | 563 | |
@@ -13,15 +13,15 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | $fields = $searchPage->getCMSFields(); |
| 15 | 15 | |
| 16 | - $mainTab = $this->checkTabExists($fields,'Main'); |
|
| 16 | + $mainTab = $this->checkTabExists($fields, 'Main'); |
|
| 17 | 17 | $this->checkFieldExists($mainTab, 'Identifier'); |
| 18 | 18 | $this->checkFieldExists($mainTab, 'ContentForEmptySearch'); |
| 19 | 19 | |
| 20 | - $searchTab = $this->checkTabExists($fields,'Search.SearchFor'); |
|
| 21 | - $fieldsTab = $this->checkTabExists($fields,'Search.Fields'); |
|
| 22 | - $autoCompleteTab = $this->checkTabExists($fields,'Search.AutoComplete'); |
|
| 23 | - $aggTab = $this->checkTabExists($fields,'Search.Aggregations'); |
|
| 24 | - $simTab = $this->checkTabExists($fields,'Search.Similarity'); |
|
| 20 | + $searchTab = $this->checkTabExists($fields, 'Search.SearchFor'); |
|
| 21 | + $fieldsTab = $this->checkTabExists($fields, 'Search.Fields'); |
|
| 22 | + $autoCompleteTab = $this->checkTabExists($fields, 'Search.AutoComplete'); |
|
| 23 | + $aggTab = $this->checkTabExists($fields, 'Search.Aggregations'); |
|
| 24 | + $simTab = $this->checkTabExists($fields, 'Search.Similarity'); |
|
| 25 | 25 | |
| 26 | 26 | $this->checkFieldExists($searchTab, 'InfoField'); |
| 27 | 27 | $this->checkFieldExists($searchTab, 'SiteTreeOnly'); |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | $pageLength = 10; // the default |
| 177 | 177 | $searchPageObj->ResultsPerPage = $pageLength; |
| 178 | 178 | $searchPageObj->write(); |
| 179 | - $searchPageObj->publish('Stage','Live'); |
|
| 179 | + $searchPageObj->publish('Stage', 'Live'); |
|
| 180 | 180 | |
| 181 | 181 | $form = $searchPageObj->SearchForm(); |
| 182 | 182 | $fields = $form->Fields(); |
@@ -306,11 +306,11 @@ discard block |
||
| 306 | 306 | $filter = array('ClazzName' => 'FlickrPhotoTO', 'Name' => 'Title'); |
| 307 | 307 | |
| 308 | 308 | //Check fieldnames as expected |
| 309 | - $searchableFields = $searchPage->ElasticaSearchableFields()->filter('Active',1); |
|
| 309 | + $searchableFields = $searchPage->ElasticaSearchableFields()->filter('Active', 1); |
|
| 310 | 310 | $sfs = $searchableFields->map('Name')->toArray(); |
| 311 | 311 | sort($sfs); |
| 312 | - $expected = array('Aperture','AspectRatio','Description','FirstViewed','FlickrID', |
|
| 313 | - 'FlickrSetTOs','FlickrTagTOs','FocalLength35mm','ISO','Photographer','ShutterSpeed', |
|
| 312 | + $expected = array('Aperture', 'AspectRatio', 'Description', 'FirstViewed', 'FlickrID', |
|
| 313 | + 'FlickrSetTOs', 'FlickrTagTOs', 'FocalLength35mm', 'ISO', 'Photographer', 'ShutterSpeed', |
|
| 314 | 314 | 'TakenAt', 'TakenAtDT', 'TestMethod', 'TestMethodHTML', 'Title'); |
| 315 | 315 | $this->assertEquals($expected, $sfs); |
| 316 | 316 | |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | $searchPage->Title = '**** SiteTree Search ****'; |
| 321 | 321 | $searchPage->write(); |
| 322 | 322 | |
| 323 | - $searchableFields = $searchPage->ElasticaSearchableFields()->filter('Active',1); |
|
| 323 | + $searchableFields = $searchPage->ElasticaSearchableFields()->filter('Active', 1); |
|
| 324 | 324 | $sfs = $searchableFields->map('Name')->toArray(); |
| 325 | 325 | sort($sfs); |
| 326 | 326 | $expected = array('Content', 'Country', 'PageDate', 'Title'); |
@@ -340,15 +340,15 @@ discard block |
||
| 340 | 340 | // expected mapping of searchable classes to searchable fields that will be |
| 341 | 341 | // stored in the database as SearchableClass and SearchableField |
| 342 | 342 | $expected = array( |
| 343 | - 'Page' => array('Title','Content'), |
|
| 344 | - 'SiteTree' => array('Title','Content'), |
|
| 345 | - 'SearchableTestPage' => array('Title','Content','Country','PageDate'), |
|
| 343 | + 'Page' => array('Title', 'Content'), |
|
| 344 | + 'SiteTree' => array('Title', 'Content'), |
|
| 345 | + 'SearchableTestPage' => array('Title', 'Content', 'Country', 'PageDate'), |
|
| 346 | 346 | 'FlickrTagTO' => array('RawValue'), |
| 347 | - 'FlickrAuthorTO' => array('PathAlias','DisplayName','FlickrPhotoTOs'), |
|
| 348 | - 'FlickrPhotoTO' => array('Title','FlickrID','Description','TakenAt', 'TakenAtDT', 'Aperture', |
|
| 349 | - 'ShutterSpeed','FocalLength35mm','ISO','Photographer','FlickrTagTOs','FlickrSetTOs', |
|
| 350 | - 'FirstViewed','AspectRatio', 'TestMethod', 'TestMethodHTML'), |
|
| 351 | - 'FlickrSetTO' => array('Title','FlickrID','Description') |
|
| 347 | + 'FlickrAuthorTO' => array('PathAlias', 'DisplayName', 'FlickrPhotoTOs'), |
|
| 348 | + 'FlickrPhotoTO' => array('Title', 'FlickrID', 'Description', 'TakenAt', 'TakenAtDT', 'Aperture', |
|
| 349 | + 'ShutterSpeed', 'FocalLength35mm', 'ISO', 'Photographer', 'FlickrTagTOs', 'FlickrSetTOs', |
|
| 350 | + 'FirstViewed', 'AspectRatio', 'TestMethod', 'TestMethodHTML'), |
|
| 351 | + 'FlickrSetTO' => array('Title', 'FlickrID', 'Description') |
|
| 352 | 352 | ); |
| 353 | 353 | |
| 354 | 354 | // check the expected classes |
@@ -369,21 +369,21 @@ discard block |
||
| 369 | 369 | // check the names expected to appear |
| 370 | 370 | |
| 371 | 371 | $fieldCtr = 0; |
| 372 | - foreach ($expectedClasses as $expectedClass) { |
|
| 372 | + foreach($expectedClasses as $expectedClass) { |
|
| 373 | 373 | $expectedFields = array(); |
| 374 | 374 | $sc = SearchableClass::get()->filter('Name', $expectedClass)->first(); |
| 375 | - $this->assertEquals($expectedClass,$sc->Name); |
|
| 375 | + $this->assertEquals($expectedClass, $sc->Name); |
|
| 376 | 376 | |
| 377 | 377 | $inSiteTree = 1; |
| 378 | - $start = substr($expectedClass, 0,6); |
|
| 379 | - if ($start == 'Flickr') { |
|
| 378 | + $start = substr($expectedClass, 0, 6); |
|
| 379 | + if($start == 'Flickr') { |
|
| 380 | 380 | $inSiteTree = 0; |
| 381 | 381 | }; |
| 382 | - $this->assertEquals($inSiteTree,$sc->InSiteTree); |
|
| 382 | + $this->assertEquals($inSiteTree, $sc->InSiteTree); |
|
| 383 | 383 | |
| 384 | 384 | $expectedNames = $expected[$expectedClass]; |
| 385 | - foreach ($expectedNames as $expectedName) { |
|
| 386 | - $filter = array('Name' => $expectedName, 'SearchableClassID' => $sc->ID ); |
|
| 385 | + foreach($expectedNames as $expectedName) { |
|
| 386 | + $filter = array('Name' => $expectedName, 'SearchableClassID' => $sc->ID); |
|
| 387 | 387 | $sf = SearchableField::get()->filter($filter)->first(); |
| 388 | 388 | $this->assertEquals($expectedName, $sf->Name); |
| 389 | 389 | $fieldCtr++; |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | $expected = array('first'); |
| 27 | 27 | $this->assertEquals($expected, array_keys($terms['Title.standard']['terms'])); |
| 28 | 28 | |
| 29 | - $expected = array('fi','fir','firs','first','ir','irs','irst','rs','rst','st'); |
|
| 29 | + $expected = array('fi', 'fir', 'firs', 'first', 'ir', 'irs', 'irst', 'rs', 'rst', 'st'); |
|
| 30 | 30 | $this->assertEquals($expected, array_keys($terms['Title.autocomplete']['terms'])); |
| 31 | 31 | |
| 32 | 32 | // ---- now a parental class page ---- |
@@ -50,9 +50,9 @@ discard block |
||
| 50 | 50 | $terms = $page->getTermVectors(); |
| 51 | 51 | |
| 52 | 52 | //Check the expected fields are indexed |
| 53 | - $expected = array('Content','Content.shingles','Content.standard','FatherText','FatherText.shingles','FatherText.standard', |
|
| 54 | - 'GrandFatherText','GrandFatherText.shingles','GrandFatherText.standard','Link','Title','Title.autocomplete', |
|
| 55 | - 'Title.shingles','Title.standard'); |
|
| 53 | + $expected = array('Content', 'Content.shingles', 'Content.standard', 'FatherText', 'FatherText.shingles', 'FatherText.standard', |
|
| 54 | + 'GrandFatherText', 'GrandFatherText.shingles', 'GrandFatherText.standard', 'Link', 'Title', 'Title.autocomplete', |
|
| 55 | + 'Title.shingles', 'Title.standard'); |
|
| 56 | 56 | $indexedFields = array_keys($terms); |
| 57 | 57 | sort($indexedFields); |
| 58 | 58 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | $fatherTerms = $terms['FatherText.standard']['terms']; |
| 62 | 62 | $grandFatherTerms = $terms['GrandFatherText.standard']['terms']; |
| 63 | 63 | |
| 64 | - $expected = array('father', 'field', 'grandfather', 'page', 'trace3');; |
|
| 64 | + $expected = array('father', 'field', 'grandfather', 'page', 'trace3'); ; |
|
| 65 | 65 | $this->assertEquals($expected, array_keys($fatherTerms)); |
| 66 | 66 | |
| 67 | 67 | $expected = array('grandfather', 'page', 'trace4'); |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | |
| 15 | 15 | public function setUpOnce() { |
| 16 | 16 | //Add translatable if it exists |
| 17 | - if (class_exists('Translatable')) { |
|
| 17 | + if(class_exists('Translatable')) { |
|
| 18 | 18 | SiteTree::add_extension('Translatable'); |
| 19 | 19 | } |
| 20 | 20 | parent::setUpOnce(); |
@@ -18,13 +18,13 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | |
| 20 | 20 | // Delete and assert that it does not exist |
| 21 | - $sql = "SELECT ID,Name,ClazzName from SearchableField"; |
|
| 21 | + $sql = "SELECT ID,Name,ClazzName from SearchableField"; |
|
| 22 | 22 | $records = DB::query($sql); |
| 23 | 23 | |
| 24 | 24 | $filter = array('Name' => 'Title', 'ClazzName' => 'FlickrPhotoTO'); |
| 25 | 25 | $sf = SearchableField::get()->filter($filter)->first(); |
| 26 | - $sql = "UPDATE ElasticSearchPage_ElasticaSearchableFields SET Searchable=1,". |
|
| 27 | - "EnableAutocomplete=1 where SearchableFieldID=".$sf->ID; |
|
| 26 | + $sql = "UPDATE ElasticSearchPage_ElasticaSearchableFields SET Searchable=1," . |
|
| 27 | + "EnableAutocomplete=1 where SearchableFieldID=" . $sf->ID; |
|
| 28 | 28 | |
| 29 | 29 | DB::query($sql); |
| 30 | 30 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | $this->assertEquals('the', $result->Query); |
| 45 | 45 | $lquery = strtolower($result->Query); |
| 46 | - foreach ($result->suggestions as $suggestion) { |
|
| 46 | + foreach($result->suggestions as $suggestion) { |
|
| 47 | 47 | $value = $suggestion->value; |
| 48 | 48 | $value = strtolower($value); |
| 49 | 49 | $this->assertContains($lquery, $value); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | $locales = array(); |
| 33 | 33 | if(class_exists('Translatable') && singleton('SiteTree')->hasExtension('Translatable')) { |
| 34 | - foreach (\Translatable::get_existing_content_languages('SiteTree') as $code => $val) { |
|
| 34 | + foreach(\Translatable::get_existing_content_languages('SiteTree') as $code => $val) { |
|
| 35 | 35 | array_push($locales, $code); |
| 36 | 36 | } |
| 37 | 37 | } else { |
@@ -39,11 +39,11 @@ discard block |
||
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | // now iterate all the locales indexing each locale in turn using it's owner index settings |
| 42 | - foreach ($locales as $locale) { |
|
| 42 | + foreach($locales as $locale) { |
|
| 43 | 43 | Searchable::$index_ctr = 0; |
| 44 | - $message('Indexing locale '.$locale); |
|
| 44 | + $message('Indexing locale ' . $locale); |
|
| 45 | 45 | |
| 46 | - if (class_exists('Translatable')) { |
|
| 46 | + if(class_exists('Translatable')) { |
|
| 47 | 47 | \Translatable::set_current_locale($locale); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -60,10 +60,10 @@ discard block |
||
| 60 | 60 | $this->service->refresh(); |
| 61 | 61 | // display indexing speed stats |
| 62 | 62 | $endTime = microtime(true); |
| 63 | - $elapsed = $endTime-$startTime; |
|
| 63 | + $elapsed = $endTime - $startTime; |
|
| 64 | 64 | $perSecond = Searchable::$index_ctr / $elapsed; |
| 65 | - $info = "\nReindexing $locale completed \n ".Searchable::$index_ctr." docs in ".round($elapsed,2)." seconds "; |
|
| 66 | - $info .= "at ".round($perSecond,2)." documents per second\n\n"; |
|
| 65 | + $info = "\nReindexing $locale completed \n " . Searchable::$index_ctr . " docs in " . round($elapsed, 2) . " seconds "; |
|
| 66 | + $info .= "at " . round($perSecond, 2) . " documents per second\n\n"; |
|
| 67 | 67 | $message($info); |
| 68 | 68 | } |
| 69 | 69 | |
@@ -25,11 +25,11 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | $locales = array(); |
| 27 | 27 | |
| 28 | - if ($this->locale == null) { |
|
| 29 | - if (class_exists('Translatable') && \SiteTree::has_extension('Translatable')) { |
|
| 28 | + if($this->locale == null) { |
|
| 29 | + if(class_exists('Translatable') && \SiteTree::has_extension('Translatable')) { |
|
| 30 | 30 | $this->locale = \Translatable::get_current_locale(); |
| 31 | 31 | } else { |
| 32 | - foreach (\Translatable::get_existing_content_languages('SiteTree') as $code => $val) { |
|
| 32 | + foreach(\Translatable::get_existing_content_languages('SiteTree') as $code => $val) { |
|
| 33 | 33 | array_push($locales, $code); |
| 34 | 34 | } |
| 35 | 35 | } |
@@ -42,13 +42,13 @@ discard block |
||
| 42 | 42 | $es->setPageLength(20); |
| 43 | 43 | $es->addFilter('IsInSiteTree', true); |
| 44 | 44 | $results = $es->search($query); |
| 45 | - foreach ($results as $result) { |
|
| 46 | - $title = '['.$result->ClassName.', '.$result->ID.'] '; |
|
| 45 | + foreach($results as $result) { |
|
| 46 | + $title = '[' . $result->ClassName . ', ' . $result->ID . '] '; |
|
| 47 | 47 | $title .= $result->Title; |
| 48 | 48 | $message($title); |
| 49 | - if ($result->SearchHighlightsByField->Content) { |
|
| 50 | - foreach ($result->SearchHighlightsByField->Content as $highlight) { |
|
| 51 | - $message("- ".$highlight->Snippet); |
|
| 49 | + if($result->SearchHighlightsByField->Content) { |
|
| 50 | + foreach($result->SearchHighlightsByField->Content as $highlight) { |
|
| 51 | + $message("- " . $highlight->Snippet); |
|
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | |
| 19 | 19 | $this->assertEquals('the', $result->Query); |
| 20 | 20 | $lquery = strtolower($result->Query); |
| 21 | - foreach ($result->suggestions as $suggestion) { |
|
| 21 | + foreach($result->suggestions as $suggestion) { |
|
| 22 | 22 | $value = $suggestion->value; |
| 23 | 23 | $value = strtolower($value); |
| 24 | 24 | $this->assertContains($lquery, $value); |