@@ -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 | |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | public function setUp() { |
26 | 26 | |
27 | - echo "*************** TEST: ".$this->getName(); |
|
27 | + echo "*************** TEST: " . $this->getName(); |
|
28 | 28 | |
29 | 29 | $cache = SS_Cache::factory('elasticsearch'); |
30 | 30 | $cache->clean(Zend_Cache::CLEANING_MODE_ALL); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | // this needs to be called in order to create the list of searchable |
34 | 34 | // classes and fields that are available. Simulates part of a build |
35 | - $classes = array('SearchableTestPage','SiteTree','Page','FlickrPhotoTO','FlickrSetTO', |
|
35 | + $classes = array('SearchableTestPage', 'SiteTree', 'Page', 'FlickrPhotoTO', 'FlickrSetTO', |
|
36 | 36 | 'FlickrTagTO', 'FlickrAuthorTO'); |
37 | 37 | $this->requireDefaultRecordsFrom = $classes; |
38 | 38 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $this->service->setTestMode(true); |
49 | 49 | |
50 | 50 | // A previous test may have deleted the index and then failed, so check for this |
51 | - if (!$this->service->getIndex()->exists()) { |
|
51 | + if(!$this->service->getIndex()->exists()) { |
|
52 | 52 | $this->service->getIndex()->create(); |
53 | 53 | } |
54 | 54 | $this->service->reset(); |
@@ -59,9 +59,9 @@ discard block |
||
59 | 59 | |
60 | 60 | $orig_fixture_file = static::$fixture_file; |
61 | 61 | |
62 | - foreach (static::$ignoreFixtureFileFor as $testPattern) { |
|
63 | - $pattern = '/'.$testPattern.'/'; |
|
64 | - if (preg_match($pattern, $this->getName())) { |
|
62 | + foreach(static::$ignoreFixtureFileFor as $testPattern) { |
|
63 | + $pattern = '/' . $testPattern . '/'; |
|
64 | + if(preg_match($pattern, $this->getName())) { |
|
65 | 65 | static::$fixture_file = null; |
66 | 66 | } |
67 | 67 | } |
@@ -83,11 +83,11 @@ discard block |
||
83 | 83 | |
84 | 84 | |
85 | 85 | private function publishSiteTree() { |
86 | - foreach (SiteTree::get()->getIterator() as $page) { |
|
86 | + foreach(SiteTree::get()->getIterator() as $page) { |
|
87 | 87 | // temporarily disable Elasticsearch indexing, it will be done in a batch |
88 | 88 | $page->IndexingOff = true; |
89 | 89 | |
90 | - $page->publish('Stage','Live'); |
|
90 | + $page->publish('Stage', 'Live'); |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $items = $this->cssParser()->getBySelector($selector); |
109 | 109 | |
110 | 110 | $ctr = 0; |
111 | - foreach ($items as $item) { |
|
111 | + foreach($items as $item) { |
|
112 | 112 | $text = strip_tags($item); |
113 | 113 | $escaped = str_replace("'", "\'", $text); |
114 | 114 | $ctr++; |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function assertAttributeHasExactValue($selector, $attributeName, $expectedValue) { |
132 | 132 | $items = $this->cssParser()->getBySelector($selector); |
133 | - foreach ($items as $item) { |
|
133 | + foreach($items as $item) { |
|
134 | 134 | $this->assertEquals($expectedValue, $item['value']); |
135 | 135 | } |
136 | 136 | } |
@@ -139,9 +139,9 @@ discard block |
||
139 | 139 | public function assertAttributesHaveExactValues($selector, $expectedValues) { |
140 | 140 | $attributeNames = array_keys($expectedValues); |
141 | 141 | $items = $this->cssParser()->getBySelector($selector); |
142 | - foreach ($items as $item) { |
|
142 | + foreach($items as $item) { |
|
143 | 143 | $actualValues = array(); |
144 | - foreach ($attributeNames as $attributeName) { |
|
144 | + foreach($attributeNames as $attributeName) { |
|
145 | 145 | $actualValues[$attributeName] = (string)$item[$attributeName]; |
146 | 146 | } |
147 | 147 | $this->assertEquals($expectedValues, $actualValues); |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | |
152 | 152 | public function assertNumberOfNodes($selector, $expectedAmount) { |
153 | 153 | $items = $this->cssParser()->getBySelector($selector); |
154 | - foreach ($items as $item) { |
|
154 | + foreach($items as $item) { |
|
155 | 155 | $text = strip_tags($item); |
156 | 156 | } |
157 | 157 | |
@@ -164,9 +164,9 @@ discard block |
||
164 | 164 | public function collateSearchResults() { |
165 | 165 | $items = $this->cssParser()->getBySelector('div.searchResults .searchResult'); |
166 | 166 | $result = array(); |
167 | - foreach ($items as $item) { |
|
167 | + foreach($items as $item) { |
|
168 | 168 | $attr = $item->attributes()->id; |
169 | - array_push($result, $attr.""); |
|
169 | + array_push($result, $attr . ""); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | return $result; |