@@ -15,10 +15,10 @@ |
||
| 15 | 15 | |
| 16 | 16 | $fields = new FieldList(); |
| 17 | 17 | |
| 18 | - $fields->push( new TabSet( "Root", $mainTab = new Tab( "Main" ) ) ); |
|
| 19 | - $mainTab->setTitle( _t( 'SiteTree.TABMAIN', "Main" ) ); |
|
| 18 | + $fields->push(new TabSet("Root", $mainTab = new Tab("Main"))); |
|
| 19 | + $mainTab->setTitle(_t('SiteTree.TABMAIN', "Main")); |
|
| 20 | 20 | |
| 21 | - $fields->addFieldToTab( 'Root.Main', $nf = new TextField( 'Name', 'Name') ); |
|
| 21 | + $fields->addFieldToTab('Root.Main', $nf = new TextField('Name', 'Name')); |
|
| 22 | 22 | $nf->setReadOnly(true); |
| 23 | 23 | $nf->setDisabled(true); |
| 24 | 24 | |
@@ -24,10 +24,10 @@ |
||
| 24 | 24 | |
| 25 | 25 | function getCMSFields() { |
| 26 | 26 | $fields = new FieldList(); |
| 27 | - $fields->push( new TabSet( "Root", $mainTab = new Tab( "Main" ) ) ); |
|
| 28 | - $mainTab->setTitle( _t( 'SiteTree.TABMAIN', "Main" ) ); |
|
| 29 | - $fields->addFieldToTab( 'Root.Main', $cf = new TextField( 'ClazzName', 'Class sourced from') ); |
|
| 30 | - $fields->addFieldToTab( 'Root.Main', $nf = new TextField( 'Name', 'Name') ); |
|
| 27 | + $fields->push(new TabSet("Root", $mainTab = new Tab("Main"))); |
|
| 28 | + $mainTab->setTitle(_t('SiteTree.TABMAIN', "Main")); |
|
| 29 | + $fields->addFieldToTab('Root.Main', $cf = new TextField('ClazzName', 'Class sourced from')); |
|
| 30 | + $fields->addFieldToTab('Root.Main', $nf = new TextField('Name', 'Name')); |
|
| 31 | 31 | $cf->setDisabled(true); |
| 32 | 32 | $nf->setDisabled(true); |
| 33 | 33 | $cf->setReadOnly(true); |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | // Makes most sense to only provide one field here, e.g. Title, Name |
| 21 | 21 | $field = $this->request->getVar('field'); |
| 22 | 22 | |
| 23 | - error_log('QUERY:'.$query); |
|
| 23 | + error_log('QUERY:' . $query); |
|
| 24 | 24 | |
| 25 | 25 | // start, and page length, i.e. pagination |
| 26 | 26 | $es->setPageLength(10); |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | $es->addFilter('InSiteTree', true); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - $resultList = $es->autocomplete_search($query,$field); |
|
| 35 | + $resultList = $es->autocomplete_search($query, $field); |
|
| 36 | 36 | $result = array(); |
| 37 | 37 | $result['Query'] = $query; |
| 38 | 38 | $suggestions = array(); |
@@ -58,10 +58,10 @@ discard block |
||
| 58 | 58 | $originalParts = explode(' ', $originalQuery); |
| 59 | 59 | $suggestedParts = explode(' ', $suggestedPhrase); |
| 60 | 60 | |
| 61 | - $markedHighlightedParts = ' '.$suggestedPhraseHighlighted.' '; |
|
| 62 | - $markedHighlightedParts = str_replace(' '.$preTags, ' '.self::$pre_marker, $markedHighlightedParts); |
|
| 61 | + $markedHighlightedParts = ' ' . $suggestedPhraseHighlighted . ' '; |
|
| 62 | + $markedHighlightedParts = str_replace(' ' . $preTags, ' ' . self::$pre_marker, $markedHighlightedParts); |
|
| 63 | 63 | |
| 64 | - $markedHighlightedParts = str_replace($postTags.' ', self::$post_marker, $markedHighlightedParts); |
|
| 64 | + $markedHighlightedParts = str_replace($postTags . ' ', self::$post_marker, $markedHighlightedParts); |
|
| 65 | 65 | |
| 66 | 66 | $markedHighlightedParts = trim($markedHighlightedParts); |
| 67 | 67 | $markedHighlightedParts = trim($markedHighlightedParts); |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | } else { |
| 92 | 92 | //Need to check capitalisation of terms suggested that are different |
| 93 | 93 | |
| 94 | - $chr = mb_substr ($possiblyUppercase, 0, 1, "UTF-8"); |
|
| 94 | + $chr = mb_substr($possiblyUppercase, 0, 1, "UTF-8"); |
|
| 95 | 95 | if (mb_strtolower($chr, "UTF-8") != $chr) { |
| 96 | 96 | $upperLowercaseWord = $lowercaseWord; |
| 97 | 97 | $upperLowercaseWord[0] = $chr; |
@@ -115,9 +115,9 @@ discard block |
||
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - $highlighted = ' '.implode(' ', $highlighted).' '; |
|
| 119 | - $highlighted = str_replace(self::$pre_marker, ' '.$preTags, $highlighted); |
|
| 120 | - $highlighted = str_replace(self::$post_marker, $postTags.' ', $highlighted); |
|
| 118 | + $highlighted = ' ' . implode(' ', $highlighted) . ' '; |
|
| 119 | + $highlighted = str_replace(self::$pre_marker, ' ' . $preTags, $highlighted); |
|
| 120 | + $highlighted = str_replace(self::$post_marker, $postTags . ' ', $highlighted); |
|
| 121 | 121 | |
| 122 | 122 | $resultArray['suggestedQuery'] = implode(' ', $plain); |
| 123 | 123 | $resultArray['suggestedQueryHighlighted'] = trim($highlighted); |
@@ -146,10 +146,10 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | $bracketPos = strpos($explanation, ')~'); |
| 148 | 148 | |
| 149 | - if (substr($explanation, 0,2) == '((') { |
|
| 150 | - $explanation = substr($explanation, 2, $bracketPos-2); |
|
| 151 | - } elseif (substr($explanation, 0,1) == '(') { |
|
| 152 | - $explanation = substr($explanation, 1, $bracketPos-2); |
|
| 149 | + if (substr($explanation, 0, 2) == '((') { |
|
| 150 | + $explanation = substr($explanation, 2, $bracketPos - 2); |
|
| 151 | + } elseif (substr($explanation, 0, 1) == '(') { |
|
| 152 | + $explanation = substr($explanation, 1, $bracketPos - 2); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | $terms = array(); |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | $es->setLocale($locale); |
| 22 | 22 | $es->setClasses('FlickrPhotoTO'); |
| 23 | 23 | |
| 24 | - $fields = array('Description' => 1,'Title' => 1); |
|
| 24 | + $fields = array('Description' => 1, 'Title' => 1); |
|
| 25 | 25 | $results = $es->search('New Zealind', $fields, true); |
| 26 | 26 | |
| 27 | 27 | $this->assertEquals('New Zealand', $es->getSuggestedQuery()); |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | $es->setLocale($locale); |
| 49 | 49 | $es->setClasses('FlickrPhotoTO'); |
| 50 | 50 | |
| 51 | - $fields = array('Description.standard' => 1,'Title.standard' => 1); |
|
| 51 | + $fields = array('Description.standard' => 1, 'Title.standard' => 1); |
|
| 52 | 52 | $results = $es->moreLikeThis($fp, $fields, true); |
| 53 | 53 | |
| 54 | 54 | echo "RESULTS:\n"; |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | $expected = array('texas'); |
| 70 | 70 | $this->assertEquals($expected, $terms['Title.standard']); |
| 71 | 71 | |
| 72 | - $expected = array('new', 'see','photographs', 'information','resolution', 'company', 'view', |
|
| 72 | + $expected = array('new', 'see', 'photographs', 'information', 'resolution', 'company', 'view', |
|
| 73 | 73 | 'high', 'collection', 'pacific', 'orleans', 'degolyer', 'southern', 'everett', |
| 74 | 74 | 'railroad', 'texas'); |
| 75 | 75 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | $fields = array('Title.standard' => 1, 'Description.standard' => 1); |
| 138 | 138 | $paginated = $es->moreLikeThis($fp, $fields, true); |
| 139 | 139 | foreach ($paginated->getList() as $result) { |
| 140 | - echo $result->ID. ' : '.$result->Title."\n"; |
|
| 140 | + echo $result->ID . ' : ' . $result->Title . "\n"; |
|
| 141 | 141 | } |
| 142 | 142 | $this->assertEquals(32, $paginated->getTotalItems()); |
| 143 | 143 | $results = $paginated->getList()->toArray(); |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | $fields = array('Title.standard' => 1, 'Description.standard' => 1); |
| 164 | 164 | $paginated = $es->moreLikeThis($fp, $fields, true); |
| 165 | 165 | foreach ($paginated->getList() as $result) { |
| 166 | - echo $result->ID. ' : '.$result->Title."\n"; |
|
| 166 | + echo $result->ID . ' : ' . $result->Title . "\n"; |
|
| 167 | 167 | } |
| 168 | 168 | $this->assertEquals(14, $paginated->getTotalItems()); |
| 169 | 169 | $results = $paginated->getList()->toArray(); |
@@ -226,12 +226,12 @@ discard block |
||
| 226 | 226 | $wordFound = false; |
| 227 | 227 | $lcquery = explode(' ', strtolower($query)); |
| 228 | 228 | foreach ($lcquery as $part) { |
| 229 | - $bracketed = '<strong class="hl">'.$part.'</strong>'; |
|
| 229 | + $bracketed = '<strong class="hl">' . $part . '</strong>'; |
|
| 230 | 230 | if (strpos($snippet, $bracketed) > 0) { |
| 231 | 231 | $wordFound = true; |
| 232 | 232 | } |
| 233 | 233 | } |
| 234 | - $this->assertTrue($wordFound,'Highlight should have been found'); |
|
| 234 | + $this->assertTrue($wordFound, 'Highlight should have been found'); |
|
| 235 | 235 | } |
| 236 | 236 | } |
| 237 | 237 | } |
@@ -256,12 +256,12 @@ discard block |
||
| 256 | 256 | $wordFound = false; |
| 257 | 257 | $lcquery = explode(' ', strtolower($query)); |
| 258 | 258 | foreach ($lcquery as $part) { |
| 259 | - $bracketed = '<strong class="hl">'.$part.'</strong>'; |
|
| 259 | + $bracketed = '<strong class="hl">' . $part . '</strong>'; |
|
| 260 | 260 | if (strpos($snippet, $bracketed) > 0) { |
| 261 | 261 | $wordFound = true; |
| 262 | 262 | } |
| 263 | 263 | } |
| 264 | - $this->assertTrue($wordFound,'Highlight should have been found'); |
|
| 264 | + $this->assertTrue($wordFound, 'Highlight should have been found'); |
|
| 265 | 265 | } |
| 266 | 266 | } |
| 267 | 267 | } |
@@ -283,9 +283,9 @@ discard block |
||
| 283 | 283 | private function makeCode($paginated) { |
| 284 | 284 | $results = $paginated->getList()->toArray(); |
| 285 | 285 | $ctr = 0; |
| 286 | - echo '$result = $paginated->getList()->toArray();'."\n"; |
|
| 286 | + echo '$result = $paginated->getList()->toArray();' . "\n"; |
|
| 287 | 287 | foreach ($results as $result) { |
| 288 | - echo '$this->assertEquals("'.$result->Title.'", $results['.$ctr.']->Title);'."\n"; |
|
| 288 | + echo '$this->assertEquals("' . $result->Title . '", $results[' . $ctr . ']->Title);' . "\n"; |
|
| 289 | 289 | $ctr++; |
| 290 | 290 | } |
| 291 | 291 | } |
@@ -9,8 +9,8 @@ discard block |
||
| 9 | 9 | public static $ignoreFixtureFileFor = array(); |
| 10 | 10 | |
| 11 | 11 | protected $extraDataObjects = array( |
| 12 | - 'SearchableTestPage','FlickrPhotoTO','FlickrAuthorTO','FlickrSetTO','FlickrTagTO', |
|
| 13 | - 'SearchableTestFatherPage','SearchableTestGrandFatherPage','AutoCompleteOption' |
|
| 12 | + 'SearchableTestPage', 'FlickrPhotoTO', 'FlickrAuthorTO', 'FlickrSetTO', 'FlickrTagTO', |
|
| 13 | + 'SearchableTestFatherPage', 'SearchableTestGrandFatherPage', 'AutoCompleteOption' |
|
| 14 | 14 | ); |
| 15 | 15 | |
| 16 | 16 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | // this needs to be called in order to create the list of searchable |
| 41 | 41 | // classes and fields that are available. Simulates part of a build |
| 42 | - $classes = array('SearchableTestPage','SiteTree','Page','FlickrPhotoTO','FlickrSetTO', |
|
| 42 | + $classes = array('SearchableTestPage', 'SiteTree', 'Page', 'FlickrPhotoTO', 'FlickrSetTO', |
|
| 43 | 43 | 'FlickrTagTO', 'FlickrAuthorTO'); |
| 44 | 44 | $this->requireDefaultRecordsFrom = $classes; |
| 45 | 45 | |
@@ -61,13 +61,13 @@ discard block |
||
| 61 | 61 | $orig_fixture_file = static::$fixture_file; |
| 62 | 62 | |
| 63 | 63 | foreach (static::$ignoreFixtureFileFor as $testPattern) { |
| 64 | - $pattern = '/'.$testPattern.'/'; |
|
| 64 | + $pattern = '/' . $testPattern . '/'; |
|
| 65 | 65 | if (preg_match($pattern, $this->getName())) { |
| 66 | 66 | static::$fixture_file = null; |
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - echo "\n\n\n\nEXECUTING TEST {$this->getName()}, FIXTURES=".static::$fixture_file."\n"; |
|
| 70 | + echo "\n\n\n\nEXECUTING TEST {$this->getName()}, FIXTURES=" . static::$fixture_file . "\n"; |
|
| 71 | 71 | |
| 72 | 72 | parent::setUp(); |
| 73 | 73 | static::$fixture_file = $orig_fixture_file; |
@@ -97,53 +97,53 @@ discard block |
||
| 97 | 97 | // temporarily disable Elasticsearch indexing, it will be done in a batch |
| 98 | 98 | $page->IndexingOff = true; |
| 99 | 99 | |
| 100 | - echo "Publishing ".$page->Title."\n"; |
|
| 101 | - $page->publish('Stage','Live'); |
|
| 100 | + echo "Publishing " . $page->Title . "\n"; |
|
| 101 | + $page->publish('Stage', 'Live'); |
|
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | |
| 106 | 106 | public function generateAssertionsFromArray($toAssert) { |
| 107 | - echo '$expected = array('."\n"; |
|
| 107 | + echo '$expected = array(' . "\n"; |
|
| 108 | 108 | foreach ($toAssert as $key => $value) { |
| 109 | 109 | $escValue = str_replace("'", '\\\'', $value); |
| 110 | 110 | echo "'$key' => '$escValue',\n"; |
| 111 | 111 | } |
| 112 | 112 | echo ");\n"; |
| 113 | - echo '$this->assertEquals($expected, $somevar);'."\n"; |
|
| 113 | + echo '$this->assertEquals($expected, $somevar);' . "\n"; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | |
| 117 | 117 | public function generateAssertionsFromArray1D($toAssert) { |
| 118 | - echo '$expected = array('."\n"; |
|
| 118 | + echo '$expected = array(' . "\n"; |
|
| 119 | 119 | foreach ($toAssert as $key => $value) { |
| 120 | 120 | $escValue = str_replace("'", '\\\'', $value); |
| 121 | 121 | echo "'$escValue',"; |
| 122 | 122 | } |
| 123 | 123 | echo ");\n"; |
| 124 | - echo '$this->assertEquals($expected, $somevar);'."\n"; |
|
| 124 | + echo '$this->assertEquals($expected, $somevar);' . "\n"; |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | |
| 128 | 128 | public function generateAssertionsFromArrayRecurse($toAssert) { |
| 129 | 129 | echo '$expected = '; |
| 130 | - $this->recurseArrayAssertion($toAssert,1, 'FIXME'); |
|
| 131 | - echo '$this->assertEquals($expected, $somevar);'."\n"; |
|
| 130 | + $this->recurseArrayAssertion($toAssert, 1, 'FIXME'); |
|
| 131 | + echo '$this->assertEquals($expected, $somevar);' . "\n"; |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | |
| 135 | 135 | private function recurseArrayAssertion($toAssert, $depth, $parentKey) { |
| 136 | - $prefix = str_repeat("\t",$depth); |
|
| 136 | + $prefix = str_repeat("\t", $depth); |
|
| 137 | 137 | echo "\t{$prefix}'$parentKey' => array(\n"; |
| 138 | 138 | $ctr = 0; |
| 139 | 139 | $len = sizeof(array_keys($toAssert)); |
| 140 | 140 | foreach ($toAssert as $key => $value) { |
| 141 | 141 | if (is_array($value)) { |
| 142 | - $this->recurseArrayAssertion($value, $depth+1, $key); |
|
| 142 | + $this->recurseArrayAssertion($value, $depth + 1, $key); |
|
| 143 | 143 | } else { |
| 144 | 144 | $escValue = str_replace("'", '\\\'', $value); |
| 145 | 145 | $comma = ','; |
| 146 | - if ($ctr == $len-1) { |
|
| 146 | + if ($ctr == $len - 1) { |
|
| 147 | 147 | $comma = ''; |
| 148 | 148 | } |
| 149 | 149 | echo "\t\t$prefix'$key' => '$escValue'$comma\n"; |
@@ -184,11 +184,11 @@ discard block |
||
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | |
| 187 | - public function checkFieldExists($tab,$fieldName) { |
|
| 187 | + public function checkFieldExists($tab, $fieldName) { |
|
| 188 | 188 | $fields = $tab->Fields(); |
| 189 | 189 | echo "TAB:{$tab->Name}\n"; |
| 190 | 190 | foreach ($fields as $fi) { |
| 191 | - echo "NAME:".$fi->Name."\n"; |
|
| 191 | + echo "NAME:" . $fi->Name . "\n"; |
|
| 192 | 192 | } |
| 193 | 193 | $field = $tab->fieldByName($fieldName); |
| 194 | 194 | $this->assertTrue($field != null); |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | $numberDocsInIndex = $status['indices']['elastica_ss_module_test_en_us']['docs']['num_docs']; |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | - $this->assertEquals($expectedAmount,$numberDocsInIndex); |
|
| 228 | + $this->assertEquals($expectedAmount, $numberDocsInIndex); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | /* |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | parent::setup(); |
| 9 | 9 | $this->ElasticSearchPage = $this->objFromFixture('ElasticSearchPage', 'search'); |
| 10 | 10 | |
| 11 | - $this->ElasticSearchPage->SimilarityStopWords = 'a,the,which'; |
|
| 11 | + $this->ElasticSearchPage->SimilarityStopWords = 'a,the,which'; |
|
| 12 | 12 | $this->ElasticSearchPage->write(); |
| 13 | 13 | |
| 14 | 14 | $this->Validator = $this->ElasticSearchPage->getCMSValidator(); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | 'AutoCompleteFieldID' => null, |
| 35 | 35 | 'AutoCompleteFunctionID' => null, |
| 36 | 36 | 'SearchHelper' => null, |
| 37 | - 'SimilarityStopWords' => array('a', 'an', 'the', ), |
|
| 37 | + 'SimilarityStopWords' => array('a', 'an', 'the',), |
|
| 38 | 38 | 'MinTermFreq' => 2, |
| 39 | 39 | 'MaxTermFreq' => 25, |
| 40 | 40 | 'MinDocFreq' => 2, |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $esp->Identifier = 'THISWILLBECOPIED'; |
| 103 | 103 | $esp->write(); |
| 104 | 104 | $this->checkForError('Identifier', 'THISWILLBECOPIED', |
| 105 | - 'The identifier THISWILLBECOPIED already exists' ); |
|
| 105 | + 'The identifier THISWILLBECOPIED already exists'); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | |
@@ -126,9 +126,9 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | foreach ($errors as $error) { |
| 128 | 128 | echo "Checking error\n"; |
| 129 | - echo " - " . $error['fieldName'].' => '.$error['message']."\n"; |
|
| 130 | - echo "\tT1:".($error['message'] == $message); |
|
| 131 | - echo "\n\tT2:".($error['fieldName'] == $fieldName); |
|
| 129 | + echo " - " . $error['fieldName'] . ' => ' . $error['message'] . "\n"; |
|
| 130 | + echo "\tT1:" . ($error['message'] == $message); |
|
| 131 | + echo "\n\tT2:" . ($error['fieldName'] == $fieldName); |
|
| 132 | 132 | |
| 133 | 133 | if ($error['message'] == $message && $error['fieldName'] == $fieldName) { |
| 134 | 134 | $found = true; |
@@ -8,8 +8,8 @@ discard block |
||
| 8 | 8 | public static $ignoreFixtureFileFor = array(); |
| 9 | 9 | |
| 10 | 10 | protected $extraDataObjects = array( |
| 11 | - 'SearchableTestPage','FlickrPhotoTO','FlickrAuthorTO','FlickrSetTO','FlickrTagTO', |
|
| 12 | - 'SearchableTestFatherPage','SearchableTestGrandFatherPage' |
|
| 11 | + 'SearchableTestPage', 'FlickrPhotoTO', 'FlickrAuthorTO', 'FlickrSetTO', 'FlickrTagTO', |
|
| 12 | + 'SearchableTestFatherPage', 'SearchableTestGrandFatherPage' |
|
| 13 | 13 | ); |
| 14 | 14 | |
| 15 | 15 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | // this needs to be called in order to create the list of searchable |
| 31 | 31 | // classes and fields that are available. Simulates part of a build |
| 32 | - $classes = array('SearchableTestPage','SiteTree','Page','FlickrPhotoTO','FlickrSetTO', |
|
| 32 | + $classes = array('SearchableTestPage', 'SiteTree', 'Page', 'FlickrPhotoTO', 'FlickrSetTO', |
|
| 33 | 33 | 'FlickrTagTO', 'FlickrAuthorTO'); |
| 34 | 34 | $this->requireDefaultRecordsFrom = $classes; |
| 35 | 35 | |
@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | print_r(static::$ignoreFixtureFileFor); |
| 61 | 61 | |
| 62 | 62 | foreach (static::$ignoreFixtureFileFor as $testPattern) { |
| 63 | - $pattern = '/'.$testPattern.'/'; |
|
| 64 | - echo "GREP: $pattern against ".$this->getName()."\n"; |
|
| 63 | + $pattern = '/' . $testPattern . '/'; |
|
| 64 | + echo "GREP: $pattern against " . $this->getName() . "\n"; |
|
| 65 | 65 | if (preg_match($pattern, $this->getName())) { |
| 66 | 66 | static::$fixture_file = null; |
| 67 | 67 | } |
@@ -88,8 +88,8 @@ discard block |
||
| 88 | 88 | // temporarily disable Elasticsearch indexing, it will be done in a batch |
| 89 | 89 | $page->IndexingOff = true; |
| 90 | 90 | |
| 91 | - echo "Publishing ".$page->Title."\n"; |
|
| 92 | - $page->publish('Stage','Live'); |
|
| 91 | + echo "Publishing " . $page->Title . "\n"; |
|
| 92 | + $page->publish('Stage', 'Live'); |
|
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | $text = strip_tags($item); |
| 116 | 116 | $escaped = str_replace("'", "\'", $text); |
| 117 | 117 | echo "SELECTED:\$this->assertSelectorStartsWithOrEquals('{$selector}', $ctr, '$escaped');\n"; |
| 118 | - echo "ITEM:".$item."\n"; |
|
| 118 | + echo "ITEM:" . $item . "\n"; |
|
| 119 | 119 | $ctr++; |
| 120 | 120 | } |
| 121 | 121 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | $result = array(); |
| 172 | 172 | foreach ($items as $item) { |
| 173 | 173 | $attr = $item->attributes()->id; |
| 174 | - array_push($result, $attr.""); |
|
| 174 | + array_push($result, $attr . ""); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | return $result; |
@@ -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 | |
@@ -188,15 +188,15 @@ discard block |
||
| 188 | 188 | |
| 189 | 189 | |
| 190 | 190 | // check strings |
| 191 | - $shouldBeString = array('Title','Description'); |
|
| 192 | - $shouldBeInt = array('ISO','FlickrID','FocalLength35mm'); |
|
| 191 | + $shouldBeString = array('Title', 'Description'); |
|
| 192 | + $shouldBeInt = array('ISO', 'FlickrID', 'FocalLength35mm'); |
|
| 193 | 193 | $shouldBeBoolean = array('IsInSiteTree'); |
| 194 | 194 | $shouldBeDouble = array('Aperture'); |
| 195 | 195 | $shouldBeDateTime = array('TakenAt'); |
| 196 | 196 | $shouldBeDate = array('FirstViewed'); |
| 197 | 197 | |
| 198 | 198 | // tokens are strings that have analyzer 'not_analyzed', namely the string is indexed as is |
| 199 | - $shouldBeTokens = array('ShutterSpeed','Link'); |
|
| 199 | + $shouldBeTokens = array('ShutterSpeed', 'Link'); |
|
| 200 | 200 | |
| 201 | 201 | |
| 202 | 202 | // check strings |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | |
| 214 | 214 | // check for unstemmed analaysis |
| 215 | 215 | |
| 216 | - $this->assertEquals($expectedStandardArray,$fieldProperties['fields']['standard']); |
|
| 216 | + $this->assertEquals($expectedStandardArray, $fieldProperties['fields']['standard']); |
|
| 217 | 217 | |
| 218 | 218 | // check for only 3 entries |
| 219 | 219 | $this->assertEquals(4, sizeof(array_keys($fieldProperties))); |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | $fieldProperties = $properties[$fieldName]; |
| 225 | 225 | $type = $fieldProperties['type']; |
| 226 | 226 | $this->assertEquals(1, sizeof(array_keys($fieldProperties))); |
| 227 | - $this->assertEquals('integer',$type); |
|
| 227 | + $this->assertEquals('integer', $type); |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | $fieldProperties = $properties[$fieldName]; |
| 234 | 234 | $type = $fieldProperties['type']; |
| 235 | 235 | $this->assertEquals(1, sizeof(array_keys($fieldProperties))); |
| 236 | - $this->assertEquals('double',$type); |
|
| 236 | + $this->assertEquals('double', $type); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | // check boolean |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | $fieldProperties = $properties[$fieldName]; |
| 242 | 242 | $type = $fieldProperties['type']; |
| 243 | 243 | $this->assertEquals(1, sizeof(array_keys($fieldProperties))); |
| 244 | - $this->assertEquals('boolean',$type); |
|
| 244 | + $this->assertEquals('boolean', $type); |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | $fieldProperties = $properties[$fieldName]; |
| 250 | 250 | $type = $fieldProperties['type']; |
| 251 | 251 | $this->assertEquals(2, sizeof(array_keys($fieldProperties))); |
| 252 | - $this->assertEquals('date',$type); |
|
| 252 | + $this->assertEquals('date', $type); |
|
| 253 | 253 | $this->assertEquals('y-M-d', $fieldProperties['format']); |
| 254 | 254 | } |
| 255 | 255 | |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | $fieldProperties = $properties[$fieldName]; |
| 261 | 261 | $type = $fieldProperties['type']; |
| 262 | 262 | $this->assertEquals(2, sizeof(array_keys($fieldProperties))); |
| 263 | - $this->assertEquals('date',$type); |
|
| 263 | + $this->assertEquals('date', $type); |
|
| 264 | 264 | $this->assertEquals('y-M-d H:m:s', $fieldProperties['format']); |
| 265 | 265 | } |
| 266 | 266 | |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | $doc = $flickrPhoto->getElasticaDocument()->getData(); |
| 300 | 300 | |
| 301 | 301 | $expected = array(); |
| 302 | - $expected['Title'] = 'Bangkok' ; |
|
| 302 | + $expected['Title'] = 'Bangkok'; |
|
| 303 | 303 | $expected['FlickrID'] = '1234567'; |
| 304 | 304 | $expected['Description'] = 'Test photograph'; |
| 305 | 305 | $expected['TakenAt'] = '2011-07-04 20:36:00'; |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | $page = $this->objFromFixture('SiteTree', 'sitetree001'); |
| 389 | 389 | $page->doUnpublish(); |
| 390 | 390 | |
| 391 | - $this->checkNumberOfIndexedDocuments($nDocsAtStart-1); |
|
| 391 | + $this->checkNumberOfIndexedDocuments($nDocsAtStart - 1); |
|
| 392 | 392 | |
| 393 | 393 | $page->doPublish(); |
| 394 | 394 | $this->checkNumberOfIndexedDocuments($nDocsAtStart); |
@@ -481,7 +481,7 @@ discard block |
||
| 481 | 481 | $flickrPhoto = $this->objFromFixture('FlickrPhotoTO', 'photo0001'); |
| 482 | 482 | $fields = $flickrPhoto->getCMSFields(); |
| 483 | 483 | |
| 484 | - $tab = $this->checkTabExists($fields,'ElasticaTermsset'); |
|
| 484 | + $tab = $this->checkTabExists($fields, 'ElasticaTermsset'); |
|
| 485 | 485 | } |
| 486 | 486 | |
| 487 | 487 | |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | $this->assertEquals('The field $searchable_fields must be set for the class FlickrPhotoTO', $e->getMessage()); |
| 498 | 498 | } |
| 499 | 499 | |
| 500 | - $config->update('FlickrPhotoTO' ,'searchable_fields', $sf); |
|
| 500 | + $config->update('FlickrPhotoTO', 'searchable_fields', $sf); |
|
| 501 | 501 | } |
| 502 | 502 | |
| 503 | 503 | |
@@ -513,7 +513,7 @@ discard block |
||
| 513 | 513 | $this->assertEquals('The field $searchable_fields must be set for the class FlickrTagTO', $e->getMessage()); |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | - $config->update('FlickrTagTO' ,'searchable_fields', $sf); |
|
| 516 | + $config->update('FlickrTagTO', 'searchable_fields', $sf); |
|
| 517 | 517 | |
| 518 | 518 | } |
| 519 | 519 | |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | $this->assertEquals('The field $searchable_fields must be set for the class FlickrAuthorTO', $e->getMessage()); |
| 531 | 531 | } |
| 532 | 532 | |
| 533 | - $config->update('FlickrAuthorTO' ,'searchable_fields', $sf); |
|
| 533 | + $config->update('FlickrAuthorTO', 'searchable_fields', $sf); |
|
| 534 | 534 | |
| 535 | 535 | } |
| 536 | 536 | |
@@ -539,7 +539,7 @@ discard block |
||
| 539 | 539 | $config = Config::inst(); |
| 540 | 540 | $sr = $config->get('FlickrPhotoTO', 'searchable_relationships'); |
| 541 | 541 | $config->remove('FlickrPhotoTO', 'searchable_relationships'); |
| 542 | - $config->update('FlickrPhotoTO', 'searchable_relationships',array('thisMethodDoesNotExist')); |
|
| 542 | + $config->update('FlickrPhotoTO', 'searchable_relationships', array('thisMethodDoesNotExist')); |
|
| 543 | 543 | $fp = Injector::inst()->create('FlickrPhotoTO'); |
| 544 | 544 | try { |
| 545 | 545 | $fields = $fp->getAllSearchableFields(); |
@@ -557,7 +557,7 @@ discard block |
||
| 557 | 557 | |
| 558 | 558 | // MUST REMOVE FIRST. Otherwise append and the erroroneus value above still exists |
| 559 | 559 | $config->remove('FlickrPhotoTO', 'searchable_relationships'); |
| 560 | - $config->update('FlickrPhotoTO' ,'searchable_relationships', $sr); |
|
| 560 | + $config->update('FlickrPhotoTO', 'searchable_relationships', $sr); |
|
| 561 | 561 | } |
| 562 | 562 | |
| 563 | 563 | |
@@ -669,9 +669,9 @@ discard block |
||
| 669 | 669 | |
| 670 | 670 | $photographer->write(); |
| 671 | 671 | |
| 672 | - $flickrPhoto->PhotographerID = $photographer->ID;; |
|
| 672 | + $flickrPhoto->PhotographerID = $photographer->ID; ; |
|
| 673 | 673 | $flickrPhoto->write(); |
| 674 | - echo 'ID='.$flickrPhoto->PhotographerID; |
|
| 674 | + echo 'ID=' . $flickrPhoto->PhotographerID; |
|
| 675 | 675 | $a = $flickrPhoto->getFieldValuesAsArray(); |
| 676 | 676 | |
| 677 | 677 | print_r($a); |
@@ -718,7 +718,7 @@ discard block |
||
| 718 | 718 | |
| 719 | 719 | |
| 720 | 720 | $flickrPhoto->write(); |
| 721 | - echo 'ID='.$flickrPhoto->PhotographerID; |
|
| 721 | + echo 'ID=' . $flickrPhoto->PhotographerID; |
|
| 722 | 722 | $a = $flickrPhoto->getFieldValuesAsArray(); |
| 723 | 723 | |
| 724 | 724 | print_r($a); |
@@ -766,15 +766,15 @@ discard block |
||
| 766 | 766 | foreach ($tab->FieldList() as $field) { |
| 767 | 767 | array_push($tabFields, $field->getName()); |
| 768 | 768 | } |
| 769 | - $expectedName = 'TermsFor'.$tab->getName();; |
|
| 769 | + $expectedName = 'TermsFor' . $tab->getName(); ; |
|
| 770 | 770 | $expected = array($expectedName); |
| 771 | 771 | $this->assertEquals($expected, $tabFields); |
| 772 | 772 | array_push($tabNames, $tab->getName()); |
| 773 | 773 | } |
| 774 | - $expected = array('Description','Description_shingles','Description_standard', |
|
| 775 | - 'ShutterSpeed', 'TestMethod', 'TestMethod_shingles', 'TestMethod_standard', |
|
| 774 | + $expected = array('Description', 'Description_shingles', 'Description_standard', |
|
| 775 | + 'ShutterSpeed', 'TestMethod', 'TestMethod_shingles', 'TestMethod_standard', |
|
| 776 | 776 | 'TestMethodHTML', 'TestMethodHTML_shingles', 'TestMethodHTML_standard', |
| 777 | - 'Title','Title_autocomplete','Title_shingles','Title_standard'); |
|
| 777 | + 'Title', 'Title_autocomplete', 'Title_shingles', 'Title_standard'); |
|
| 778 | 778 | |
| 779 | 779 | $this->assertEquals($expected, $tabNames); |
| 780 | 780 | } |
@@ -798,13 +798,13 @@ discard block |
||
| 798 | 798 | foreach ($tab->FieldList() as $field) { |
| 799 | 799 | array_push($tabFields, $field->getName()); |
| 800 | 800 | } |
| 801 | - $expectedName = 'TermsFor'.$tab->getName();; |
|
| 801 | + $expectedName = 'TermsFor' . $tab->getName(); ; |
|
| 802 | 802 | $expected = array($expectedName); |
| 803 | 803 | $this->assertEquals($expected, $tabFields); |
| 804 | 804 | array_push($tabNames, $tab->getName()); |
| 805 | 805 | } |
| 806 | 806 | $expected = array( |
| 807 | - 'Content','Content_standard','Link','Title','Title_autocomplete','Title_shingles', |
|
| 807 | + 'Content', 'Content_standard', 'Link', 'Title', 'Title_autocomplete', 'Title_shingles', |
|
| 808 | 808 | 'Title_standard'); |
| 809 | 809 | $this->generateAssertionsFromArray1D($tabNames); |
| 810 | 810 | $this->assertEquals($expected, $tabNames); |