@@ -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','AutoCompleteOption' |
|
11 | + 'SearchableTestPage', 'FlickrPhotoTO', 'FlickrAuthorTO', 'FlickrSetTO', 'FlickrTagTO', |
|
12 | + 'SearchableTestFatherPage', 'SearchableTestGrandFatherPage', 'AutoCompleteOption' |
|
13 | 13 | ); |
14 | 14 | |
15 | 15 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | // this needs to be called in order to create the list of searchable |
42 | 42 | // classes and fields that are available. Simulates part of a build |
43 | - $classes = array('SearchableTestPage','SiteTree','Page','FlickrPhotoTO','FlickrSetTO', |
|
43 | + $classes = array('SearchableTestPage', 'SiteTree', 'Page', 'FlickrPhotoTO', 'FlickrSetTO', |
|
44 | 44 | 'FlickrTagTO', 'FlickrAuthorTO'); |
45 | 45 | $this->requireDefaultRecordsFrom = $classes; |
46 | 46 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | try { |
54 | 54 | // A previous test may have deleted the index and then failed, so check for this |
55 | - if (!$this->service->getIndex()->exists()) { |
|
55 | + if(!$this->service->getIndex()->exists()) { |
|
56 | 56 | $this->service->getIndex()->create(); |
57 | 57 | } |
58 | 58 | $this->service->reset(); |
@@ -62,9 +62,9 @@ discard block |
||
62 | 62 | |
63 | 63 | $orig_fixture_file = static::$fixture_file; |
64 | 64 | |
65 | - foreach (static::$ignoreFixtureFileFor as $testPattern) { |
|
66 | - $pattern = '/'.$testPattern.'/'; |
|
67 | - if (preg_match($pattern, $this->getName())) { |
|
65 | + foreach(static::$ignoreFixtureFileFor as $testPattern) { |
|
66 | + $pattern = '/' . $testPattern . '/'; |
|
67 | + if(preg_match($pattern, $this->getName())) { |
|
68 | 68 | static::$fixture_file = null; |
69 | 69 | } |
70 | 70 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | // this needs to run otherwise nested injector errors show up |
77 | 77 | parent::setUp(); |
78 | 78 | |
79 | - if ($elasticException) { |
|
79 | + if($elasticException) { |
|
80 | 80 | $this->fail('T1 An error has occurred trying to contact Elasticsearch server'); |
81 | 81 | } |
82 | 82 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $elasticException = true; |
96 | 96 | } |
97 | 97 | |
98 | - if ($elasticException) { |
|
98 | + if($elasticException) { |
|
99 | 99 | $this->fail('T2 An error has occurred trying to contact Elasticsearch server'); |
100 | 100 | } |
101 | 101 | |
@@ -110,55 +110,55 @@ discard block |
||
110 | 110 | |
111 | 111 | |
112 | 112 | private function publishSiteTree() { |
113 | - foreach (SiteTree::get()->getIterator() as $page) { |
|
113 | + foreach(SiteTree::get()->getIterator() as $page) { |
|
114 | 114 | // temporarily disable Elasticsearch indexing, it will be done in a batch |
115 | 115 | $page->IndexingOff = true; |
116 | - $page->publish('Stage','Live'); |
|
116 | + $page->publish('Stage', 'Live'); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
120 | 120 | |
121 | 121 | public function generateAssertionsFromArray($toAssert) { |
122 | - echo '$expected = array('."\n"; |
|
123 | - foreach ($toAssert as $key => $value) { |
|
122 | + echo '$expected = array(' . "\n"; |
|
123 | + foreach($toAssert as $key => $value) { |
|
124 | 124 | $escValue = str_replace("'", '\\\'', $value); |
125 | 125 | echo "'$key' => '$escValue',\n"; |
126 | 126 | } |
127 | 127 | echo ");\n"; |
128 | - echo '$this->assertEquals($expected, $somevar);'."\n"; |
|
128 | + echo '$this->assertEquals($expected, $somevar);' . "\n"; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | |
132 | 132 | public function generateAssertionsFromArray1D($toAssert) { |
133 | - echo '$expected = array('."\n"; |
|
134 | - foreach ($toAssert as $key => $value) { |
|
133 | + echo '$expected = array(' . "\n"; |
|
134 | + foreach($toAssert as $key => $value) { |
|
135 | 135 | $escValue = str_replace("'", '\\\'', $value); |
136 | 136 | echo "'$escValue',"; |
137 | 137 | } |
138 | 138 | echo ");\n"; |
139 | - echo '$this->assertEquals($expected, $somevar);'."\n"; |
|
139 | + echo '$this->assertEquals($expected, $somevar);' . "\n"; |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | |
143 | 143 | public function generateAssertionsFromArrayRecurse($toAssert) { |
144 | 144 | echo '$expected = '; |
145 | - $this->recurseArrayAssertion($toAssert,1, 'FIXME'); |
|
146 | - echo '$this->assertEquals($expected, $somevar);'."\n"; |
|
145 | + $this->recurseArrayAssertion($toAssert, 1, 'FIXME'); |
|
146 | + echo '$this->assertEquals($expected, $somevar);' . "\n"; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | |
150 | 150 | private function recurseArrayAssertion($toAssert, $depth, $parentKey) { |
151 | - $prefix = str_repeat("\t",$depth); |
|
151 | + $prefix = str_repeat("\t", $depth); |
|
152 | 152 | echo "\t{$prefix}'$parentKey' => array(\n"; |
153 | 153 | $ctr = 0; |
154 | 154 | $len = sizeof(array_keys($toAssert)); |
155 | - foreach ($toAssert as $key => $value) { |
|
156 | - if (is_array($value)) { |
|
157 | - $this->recurseArrayAssertion($value, $depth+1, $key); |
|
155 | + foreach($toAssert as $key => $value) { |
|
156 | + if(is_array($value)) { |
|
157 | + $this->recurseArrayAssertion($value, $depth + 1, $key); |
|
158 | 158 | } else { |
159 | 159 | $escValue = str_replace("'", '\\\'', $value); |
160 | 160 | $comma = ','; |
161 | - if ($ctr == $len-1) { |
|
161 | + if($ctr == $len - 1) { |
|
162 | 162 | $comma = ''; |
163 | 163 | } |
164 | 164 | echo "\t\t$prefix'$key' => '$escValue'$comma\n"; |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $size = sizeof($splits); |
182 | 182 | $nameToCheck = end($splits); |
183 | 183 | $this->assertEquals($actualTabName, $nameToCheck); |
184 | - if ($size == 1) { |
|
184 | + if($size == 1) { |
|
185 | 185 | $this->assertEquals("Root_${tabName}", $tab->id()); |
186 | 186 | } else { |
187 | 187 | $expected = "Root_{$splits[0]}_set_{$splits[1]}"; |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | } |
193 | 193 | |
194 | 194 | |
195 | - public function checkFieldExists($tab,$fieldName) { |
|
195 | + public function checkFieldExists($tab, $fieldName) { |
|
196 | 196 | $fields = $tab->Fields(); |
197 | 197 | $field = $tab->fieldByName($fieldName); |
198 | 198 | $this->assertTrue($field != null); |
@@ -226,16 +226,16 @@ discard block |
||
226 | 226 | |
227 | 227 | $numberDocsInIndex = -1; // flag value for not yet indexed |
228 | 228 | error_log('CHECKING NUMBER OF INDEXED DOCUMENTS, SHOULD BE ' . $expectedAmount); |
229 | - error_log(print_r($status,1)); |
|
229 | + error_log(print_r($status, 1)); |
|
230 | 230 | |
231 | - if (isset($status['indices']['elastica_ss_module_test_en_us']['docs'])) { |
|
231 | + if(isset($status['indices']['elastica_ss_module_test_en_us']['docs'])) { |
|
232 | 232 | $numberDocsInIndex = $status['indices']['elastica_ss_module_test_en_us']['docs']['num_docs']; |
233 | - error_log('DOCUMENTS FOUND:'.$numberDocsInIndex); |
|
233 | + error_log('DOCUMENTS FOUND:' . $numberDocsInIndex); |
|
234 | 234 | } else { |
235 | 235 | $numberDocsInIndex = 0; |
236 | 236 | } |
237 | 237 | |
238 | - $this->assertEquals($expectedAmount,$numberDocsInIndex); |
|
238 | + $this->assertEquals($expectedAmount, $numberDocsInIndex); |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | /* |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | $status = $index->getStatus()->getData(); |
247 | 247 | |
248 | 248 | $numberDocsInIndex = -1; // flag value for not yet indexed |
249 | - if (isset($status['indices']['elastica_ss_module_test_en_us']['docs'])) { |
|
249 | + if(isset($status['indices']['elastica_ss_module_test_en_us']['docs'])) { |
|
250 | 250 | $numberDocsInIndex = $status['indices']['elastica_ss_module_test_en_us']['docs']['num_docs']; |
251 | 251 | } |
252 | 252 |