@@ -538,8 +538,8 @@ |
||
538 | 538 | $e->getMessage()); |
539 | 539 | } |
540 | 540 | |
541 | - // MUST REMOVE FIRST. Otherwise append and the erroroneus value above still exists |
|
542 | - $config->remove('FlickrPhotoTO', 'searchable_relationships'); |
|
541 | + // MUST REMOVE FIRST. Otherwise append and the erroroneus value above still exists |
|
542 | + $config->remove('FlickrPhotoTO', 'searchable_relationships'); |
|
543 | 543 | $config->update('FlickrPhotoTO' ,'searchable_relationships', $sr); |
544 | 544 | } |
545 | 545 |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | public function setUp() { |
14 | 14 | // this needs to be called in order to create the list of searchable |
15 | 15 | // classes and fields that are available. Simulates part of a build |
16 | - $classes = array('SearchableTestPage','SiteTree','Page','FlickrPhotoTO','FlickrSetTO', |
|
16 | + $classes = array('SearchableTestPage', 'SiteTree', 'Page', 'FlickrPhotoTO', 'FlickrSetTO', |
|
17 | 17 | 'FlickrTagTO', 'FlickrAuthorTO', 'FlickrSetTO'); |
18 | 18 | $this->requireDefaultRecordsFrom = $classes; |
19 | 19 | |
@@ -181,20 +181,20 @@ discard block |
||
181 | 181 | |
182 | 182 | |
183 | 183 | // check strings |
184 | - $shouldBeString = array('Title','Description'); |
|
185 | - $shouldBeInt = array('ISO','FlickrID','FocalLength35mm'); |
|
184 | + $shouldBeString = array('Title', 'Description'); |
|
185 | + $shouldBeInt = array('ISO', 'FlickrID', 'FocalLength35mm'); |
|
186 | 186 | $shouldBeBoolean = array('IsInSiteTree'); |
187 | 187 | $shouldBeDouble = array('Aperture'); |
188 | 188 | $shouldBeDateTime = array('TakenAt'); |
189 | 189 | $shouldBeDate = array('FirstViewed'); |
190 | 190 | |
191 | 191 | // tokens are strings that have analyzer 'not_analyzed', namely the string is indexed as is |
192 | - $shouldBeTokens = array('ShutterSpeed','Link'); |
|
192 | + $shouldBeTokens = array('ShutterSpeed', 'Link'); |
|
193 | 193 | |
194 | 194 | |
195 | 195 | // check strings |
196 | 196 | $expectedStandardArray = array('type' => 'string', 'analyzer' => 'unstemmed', 'term_vector' => 'yes'); |
197 | - foreach ($shouldBeString as $fieldName) { |
|
197 | + foreach($shouldBeString as $fieldName) { |
|
198 | 198 | $fieldProperties = $properties[$fieldName]; |
199 | 199 | |
200 | 200 | $type = $fieldProperties['type']; |
@@ -206,60 +206,60 @@ discard block |
||
206 | 206 | |
207 | 207 | // check for unstemmed analaysis |
208 | 208 | |
209 | - $this->assertEquals($expectedStandardArray,$fieldProperties['fields']['standard']); |
|
209 | + $this->assertEquals($expectedStandardArray, $fieldProperties['fields']['standard']); |
|
210 | 210 | |
211 | 211 | // check for only 3 entries |
212 | 212 | $this->assertEquals(4, sizeof(array_keys($fieldProperties))); |
213 | 213 | } |
214 | 214 | |
215 | 215 | // check ints |
216 | - foreach ($shouldBeInt as $fieldName) { |
|
216 | + foreach($shouldBeInt as $fieldName) { |
|
217 | 217 | $fieldProperties = $properties[$fieldName]; |
218 | 218 | $type = $fieldProperties['type']; |
219 | 219 | $this->assertEquals(1, sizeof(array_keys($fieldProperties))); |
220 | - $this->assertEquals('integer',$type); |
|
220 | + $this->assertEquals('integer', $type); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | |
224 | 224 | // check doubles |
225 | - foreach ($shouldBeDouble as $fieldName) { |
|
225 | + foreach($shouldBeDouble as $fieldName) { |
|
226 | 226 | $fieldProperties = $properties[$fieldName]; |
227 | 227 | $type = $fieldProperties['type']; |
228 | 228 | $this->assertEquals(1, sizeof(array_keys($fieldProperties))); |
229 | - $this->assertEquals('double',$type); |
|
229 | + $this->assertEquals('double', $type); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | // check boolean |
233 | - foreach ($shouldBeBoolean as $fieldName) { |
|
233 | + foreach($shouldBeBoolean as $fieldName) { |
|
234 | 234 | $fieldProperties = $properties[$fieldName]; |
235 | 235 | $type = $fieldProperties['type']; |
236 | 236 | $this->assertEquals(1, sizeof(array_keys($fieldProperties))); |
237 | - $this->assertEquals('boolean',$type); |
|
237 | + $this->assertEquals('boolean', $type); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | |
241 | - foreach ($shouldBeDate as $fieldName) { |
|
241 | + foreach($shouldBeDate as $fieldName) { |
|
242 | 242 | $fieldProperties = $properties[$fieldName]; |
243 | 243 | $type = $fieldProperties['type']; |
244 | 244 | $this->assertEquals(2, sizeof(array_keys($fieldProperties))); |
245 | - $this->assertEquals('date',$type); |
|
245 | + $this->assertEquals('date', $type); |
|
246 | 246 | $this->assertEquals('y-M-d', $fieldProperties['format']); |
247 | 247 | } |
248 | 248 | |
249 | 249 | |
250 | 250 | |
251 | 251 | // check date time, stored in Elasticsearch as a date with a different format than above |
252 | - foreach ($shouldBeDateTime as $fieldName) { |
|
252 | + foreach($shouldBeDateTime as $fieldName) { |
|
253 | 253 | $fieldProperties = $properties[$fieldName]; |
254 | 254 | $type = $fieldProperties['type']; |
255 | 255 | $this->assertEquals(2, sizeof(array_keys($fieldProperties))); |
256 | - $this->assertEquals('date',$type); |
|
256 | + $this->assertEquals('date', $type); |
|
257 | 257 | $this->assertEquals('y-M-d H:m:s', $fieldProperties['format']); |
258 | 258 | } |
259 | 259 | |
260 | 260 | //check shutter speed is tokenized, ie not analyzed - for aggregation purposes |
261 | 261 | // |
262 | - foreach ($shouldBeTokens as $fieldName) { |
|
262 | + foreach($shouldBeTokens as $fieldName) { |
|
263 | 263 | $fieldProperties = $properties[$fieldName]; |
264 | 264 | $type = $fieldProperties['type']; |
265 | 265 | $this->assertEquals('string', $type); |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | $doc = $flickrPhoto->getElasticaDocument()->getData(); |
293 | 293 | |
294 | 294 | $expected = array(); |
295 | - $expected['Title'] = 'Bangkok' ; |
|
295 | + $expected['Title'] = 'Bangkok'; |
|
296 | 296 | $expected['FlickrID'] = '1234567'; |
297 | 297 | $expected['Description'] = 'Test photograph'; |
298 | 298 | $expected['TakenAt'] = '2011-07-04 20:36:00'; |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | $resultList = $this->getResultsFor('Bangkok'); |
325 | 325 | |
326 | 326 | // there is only one result. Note lack of a 'first' method |
327 | - foreach ($resultList->getIterator() as $fp) { |
|
327 | + foreach($resultList->getIterator() as $fp) { |
|
328 | 328 | //This is an Elastica\Result object |
329 | 329 | $elasticaResult = $fp->getElasticaResult(); |
330 | 330 | |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | $page = $this->objFromFixture('SiteTree', 'sitetree001'); |
380 | 380 | $page->doUnpublish(); |
381 | 381 | |
382 | - $this->checkNumberOfIndexedDocuments($nDocsAtStart-1); |
|
382 | + $this->checkNumberOfIndexedDocuments($nDocsAtStart - 1); |
|
383 | 383 | |
384 | 384 | $page->doPublish(); |
385 | 385 | $this->checkNumberOfIndexedDocuments($nDocsAtStart); |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | $flickrPhoto = $this->objFromFixture('FlickrPhotoTO', 'photo0001'); |
471 | 471 | $fields = $flickrPhoto->getCMSFields(); |
472 | 472 | |
473 | - $this->checkTabExists($fields,'ElasticaTermsset'); |
|
473 | + $this->checkTabExists($fields, 'ElasticaTermsset'); |
|
474 | 474 | } |
475 | 475 | |
476 | 476 | |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | $this->assertEquals('The field $searchable_fields must be set for the class FlickrPhotoTO', $e->getMessage()); |
487 | 487 | } |
488 | 488 | |
489 | - $config->update('FlickrPhotoTO' ,'searchable_fields', $sf); |
|
489 | + $config->update('FlickrPhotoTO', 'searchable_fields', $sf); |
|
490 | 490 | } |
491 | 491 | |
492 | 492 | |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | $this->assertEquals('The field $searchable_fields must be set for the class FlickrTagTO', $e->getMessage()); |
503 | 503 | } |
504 | 504 | |
505 | - $config->update('FlickrTagTO' ,'searchable_fields', $sf); |
|
505 | + $config->update('FlickrTagTO', 'searchable_fields', $sf); |
|
506 | 506 | |
507 | 507 | } |
508 | 508 | |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | $this->assertEquals('The field $searchable_fields must be set for the class FlickrAuthorTO', $e->getMessage()); |
520 | 520 | } |
521 | 521 | |
522 | - $config->update('FlickrAuthorTO' ,'searchable_fields', $sf); |
|
522 | + $config->update('FlickrAuthorTO', 'searchable_fields', $sf); |
|
523 | 523 | |
524 | 524 | } |
525 | 525 | |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | $config = Config::inst(); |
529 | 529 | $sr = $config->get('FlickrPhotoTO', 'searchable_relationships'); |
530 | 530 | $config->remove('FlickrPhotoTO', 'searchable_relationships'); |
531 | - $config->update('FlickrPhotoTO', 'searchable_relationships',array('thisMethodDoesNotExist')); |
|
531 | + $config->update('FlickrPhotoTO', 'searchable_relationships', array('thisMethodDoesNotExist')); |
|
532 | 532 | $fp = Injector::inst()->create('FlickrPhotoTO'); |
533 | 533 | try { |
534 | 534 | $fp->getAllSearchableFields(); |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | |
541 | 541 | // MUST REMOVE FIRST. Otherwise append and the erroroneus value above still exists |
542 | 542 | $config->remove('FlickrPhotoTO', 'searchable_relationships'); |
543 | - $config->update('FlickrPhotoTO' ,'searchable_relationships', $sr); |
|
543 | + $config->update('FlickrPhotoTO', 'searchable_relationships', $sr); |
|
544 | 544 | } |
545 | 545 | |
546 | 546 | |
@@ -647,9 +647,9 @@ discard block |
||
647 | 647 | |
648 | 648 | $photographer->write(); |
649 | 649 | |
650 | - $flickrPhoto->PhotographerID = $photographer->ID;; |
|
650 | + $flickrPhoto->PhotographerID = $photographer->ID; ; |
|
651 | 651 | $flickrPhoto->write(); |
652 | - echo 'ID='.$flickrPhoto->PhotographerID; |
|
652 | + echo 'ID=' . $flickrPhoto->PhotographerID; |
|
653 | 653 | $fieldValuesArray = $flickrPhoto->getFieldValuesAsArray(); |
654 | 654 | |
655 | 655 | $actual = $fieldValuesArray['Photographer']; |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | |
690 | 690 | |
691 | 691 | $flickrPhoto->write(); |
692 | - echo 'ID='.$flickrPhoto->PhotographerID; |
|
692 | + echo 'ID=' . $flickrPhoto->PhotographerID; |
|
693 | 693 | $fieldValuesArray = $flickrPhoto->getFieldValuesAsArray(); |
694 | 694 | $actual = $fieldValuesArray['Photographer']; |
695 | 695 | $this->assertEquals(array(), $actual); |
@@ -722,20 +722,20 @@ discard block |
||
722 | 722 | |
723 | 723 | $tabset = $fields->findOrMakeTab('Root.ElasticaTerms'); |
724 | 724 | $tabNames = array(); |
725 | - foreach ($tabset->Tabs() as $tab) { |
|
725 | + foreach($tabset->Tabs() as $tab) { |
|
726 | 726 | $tabFields = array(); |
727 | - foreach ($tab->FieldList() as $field) { |
|
727 | + foreach($tab->FieldList() as $field) { |
|
728 | 728 | array_push($tabFields, $field->getName()); |
729 | 729 | } |
730 | - $expectedName = 'TermsFor'.$tab->getName();; |
|
730 | + $expectedName = 'TermsFor' . $tab->getName(); ; |
|
731 | 731 | $expected = array($expectedName); |
732 | 732 | $this->assertEquals($expected, $tabFields); |
733 | 733 | array_push($tabNames, $tab->getName()); |
734 | 734 | } |
735 | - $expected = array('Description','Description_shingles','Description_standard', |
|
736 | - 'ShutterSpeed', 'TestMethod', 'TestMethod_shingles', 'TestMethod_standard', |
|
735 | + $expected = array('Description', 'Description_shingles', 'Description_standard', |
|
736 | + 'ShutterSpeed', 'TestMethod', 'TestMethod_shingles', 'TestMethod_standard', |
|
737 | 737 | 'TestMethodHTML', 'TestMethodHTML_shingles', 'TestMethodHTML_standard', |
738 | - 'Title','Title_autocomplete','Title_shingles','Title_standard'); |
|
738 | + 'Title', 'Title_autocomplete', 'Title_shingles', 'Title_standard'); |
|
739 | 739 | |
740 | 740 | $this->assertEquals($expected, $tabNames); |
741 | 741 | } |
@@ -754,18 +754,18 @@ discard block |
||
754 | 754 | |
755 | 755 | $tabset = $fields->findOrMakeTab('Root.ElasticaTerms'); |
756 | 756 | $tabNames = array(); |
757 | - foreach ($tabset->Tabs() as $tab) { |
|
757 | + foreach($tabset->Tabs() as $tab) { |
|
758 | 758 | $tabFields = array(); |
759 | - foreach ($tab->FieldList() as $field) { |
|
759 | + foreach($tab->FieldList() as $field) { |
|
760 | 760 | array_push($tabFields, $field->getName()); |
761 | 761 | } |
762 | - $expectedName = 'TermsFor'.$tab->getName();; |
|
762 | + $expectedName = 'TermsFor' . $tab->getName(); ; |
|
763 | 763 | $expected = array($expectedName); |
764 | 764 | $this->assertEquals($expected, $tabFields); |
765 | 765 | array_push($tabNames, $tab->getName()); |
766 | 766 | } |
767 | 767 | $expected = array( |
768 | - 'Content','Content_standard','Link','Title','Title_autocomplete','Title_shingles', |
|
768 | + 'Content', 'Content_standard', 'Link', 'Title', 'Title_autocomplete', 'Title_shingles', |
|
769 | 769 | 'Title_standard'); |
770 | 770 | $this->generateAssertionsFromArray1D($tabNames); |
771 | 771 | $this->assertEquals($expected, $tabNames); |