@@ -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' |
|
| 12 | + 'SearchableTestPage', 'FlickrPhotoTO', 'FlickrAuthorTO', 'FlickrSetTO', 'FlickrTagTO', |
|
| 13 | + 'SearchableTestFatherPage', 'SearchableTestGrandFatherPage' |
|
| 14 | 14 | ); |
| 15 | 15 | |
| 16 | 16 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | public function setUp() { |
| 29 | 29 | |
| 30 | - error_log("*************** TEST: ".$this->getName()); |
|
| 30 | + error_log("*************** TEST: " . $this->getName()); |
|
| 31 | 31 | |
| 32 | 32 | $cache = SS_Cache::factory('elasticsearch'); |
| 33 | 33 | $cache->clean(Zend_Cache::CLEANING_MODE_ALL); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | // this needs to be called in order to create the list of searchable |
| 37 | 37 | // classes and fields that are available. Simulates part of a build |
| 38 | - $classes = array('SearchableTestPage','SiteTree','Page','FlickrPhotoTO','FlickrSetTO', |
|
| 38 | + $classes = array('SearchableTestPage', 'SiteTree', 'Page', 'FlickrPhotoTO', 'FlickrSetTO', |
|
| 39 | 39 | 'FlickrTagTO', 'FlickrAuthorTO'); |
| 40 | 40 | $this->requireDefaultRecordsFrom = $classes; |
| 41 | 41 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | $this->service->setTestMode(true); |
| 55 | 55 | |
| 56 | 56 | // A previous test may have deleted the index and then failed, so check for this |
| 57 | - if (!$this->service->getIndex()->exists()) { |
|
| 57 | + if(!$this->service->getIndex()->exists()) { |
|
| 58 | 58 | $this->service->getIndex()->create(); |
| 59 | 59 | } |
| 60 | 60 | $this->service->reset(); |
@@ -65,9 +65,9 @@ discard block |
||
| 65 | 65 | // load fixtures |
| 66 | 66 | $orig_fixture_file = static::$fixture_file; |
| 67 | 67 | |
| 68 | - foreach (static::$ignoreFixtureFileFor as $testPattern) { |
|
| 69 | - $pattern = '/'.$testPattern.'/'; |
|
| 70 | - if (preg_match($pattern, $this->getName())) { |
|
| 68 | + foreach(static::$ignoreFixtureFileFor as $testPattern) { |
|
| 69 | + $pattern = '/' . $testPattern . '/'; |
|
| 70 | + if(preg_match($pattern, $this->getName())) { |
|
| 71 | 71 | static::$fixture_file = null; |
| 72 | 72 | } |
| 73 | 73 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | // this has to be executed otherwise nesting exceptions occur |
| 80 | 80 | parent::setUp(); |
| 81 | 81 | |
| 82 | - if ($elasticaException) { |
|
| 82 | + if($elasticaException) { |
|
| 83 | 83 | $this->fail('T1 Exception with Elasticsearch'); |
| 84 | 84 | } |
| 85 | 85 | |
@@ -101,18 +101,18 @@ discard block |
||
| 101 | 101 | $elasticaException = true; |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - if ($elasticaException) { |
|
| 104 | + if($elasticaException) { |
|
| 105 | 105 | $this->fail('T2 Exception with Elasticsearch'); |
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | |
| 110 | 110 | private function publishSiteTree() { |
| 111 | - foreach (SiteTree::get()->getIterator() as $page) { |
|
| 111 | + foreach(SiteTree::get()->getIterator() as $page) { |
|
| 112 | 112 | // temporarily disable Elasticsearch indexing, it will be done in a batch |
| 113 | 113 | $page->IndexingOff = true; |
| 114 | 114 | |
| 115 | - $page->publish('Stage','Live'); |
|
| 115 | + $page->publish('Stage', 'Live'); |
|
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | $items = $this->cssParser()->getBySelector($selector); |
| 134 | 134 | |
| 135 | 135 | $ctr = 0; |
| 136 | - foreach ($items as $item) { |
|
| 136 | + foreach($items as $item) { |
|
| 137 | 137 | $text = strip_tags($item); |
| 138 | 138 | $escaped = str_replace("'", "\'", $text); |
| 139 | 139 | $ctr++; |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | $items = $this->cssParser()->getBySelector($selector); |
| 164 | 164 | |
| 165 | 165 | $ctr = 0; |
| 166 | - foreach ($items as $item) { |
|
| 166 | + foreach($items as $item) { |
|
| 167 | 167 | $text = strip_tags($item); |
| 168 | 168 | $escaped = str_replace("'", "\'", $text); |
| 169 | 169 | $ctr++; |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | |
| 172 | 172 | $ctr = 0; |
| 173 | 173 | $item = strip_tags($items[$index]); |
| 174 | - if ($downcase) { |
|
| 174 | + if($downcase) { |
|
| 175 | 175 | $item = strtolower($item); |
| 176 | 176 | $expectedClause = strtolower($expectedClause); |
| 177 | 177 | } |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | */ |
| 190 | 190 | public function assertAttributeHasExactValue($selector, $attributeName, $expectedValue) { |
| 191 | 191 | $items = $this->cssParser()->getBySelector($selector); |
| 192 | - foreach ($items as $item) { |
|
| 192 | + foreach($items as $item) { |
|
| 193 | 193 | $this->assertEquals($expectedValue, $item['value']); |
| 194 | 194 | } |
| 195 | 195 | } |
@@ -198,9 +198,9 @@ discard block |
||
| 198 | 198 | public function assertAttributesHaveExactValues($selector, $expectedValues) { |
| 199 | 199 | $attributeNames = array_keys($expectedValues); |
| 200 | 200 | $items = $this->cssParser()->getBySelector($selector); |
| 201 | - foreach ($items as $item) { |
|
| 201 | + foreach($items as $item) { |
|
| 202 | 202 | $actualValues = array(); |
| 203 | - foreach ($attributeNames as $attributeName) { |
|
| 203 | + foreach($attributeNames as $attributeName) { |
|
| 204 | 204 | $actualValues[$attributeName] = (string)$item[$attributeName]; |
| 205 | 205 | } |
| 206 | 206 | $this->assertEquals($expectedValues, $actualValues); |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | |
| 211 | 211 | public function assertNumberOfNodes($selector, $expectedAmount) { |
| 212 | 212 | $items = $this->cssParser()->getBySelector($selector); |
| 213 | - foreach ($items as $item) { |
|
| 213 | + foreach($items as $item) { |
|
| 214 | 214 | $text = strip_tags($item); |
| 215 | 215 | } |
| 216 | 216 | |
@@ -223,9 +223,9 @@ discard block |
||
| 223 | 223 | public function collateSearchResults() { |
| 224 | 224 | $items = $this->cssParser()->getBySelector('div.searchResults .searchResult'); |
| 225 | 225 | $result = array(); |
| 226 | - foreach ($items as $item) { |
|
| 226 | + foreach($items as $item) { |
|
| 227 | 227 | $attr = $item->attributes()->id; |
| 228 | - array_push($result, $attr.""); |
|
| 228 | + array_push($result, $attr . ""); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | return $result; |