Completed
Push — dev2 ( 8c5e3c...d49e91 )
by Gordon
05:10 queued 02:18
created
tests/IndexSettingsTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
 	public function setUp() {
10 10
 		// this needs to be called in order to create the list of searchable
11 11
 		// classes and fields that are available.  Simulates part of a build
12
-		$classes = array('SearchableTestPage','SiteTree','Page','FlickrPhotoTO','FlickrSetTO',
12
+		$classes = array('SearchableTestPage', 'SiteTree', 'Page', 'FlickrPhotoTO', 'FlickrSetTO',
13 13
 			'FlickrTagTO', 'FlickrAuthorTO', 'FlickrSetTO');
14 14
 		$this->requireDefaultRecordsFrom = $classes;
15 15
 
Please login to merge, or discard this patch.
tests/SearchableFieldTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
 		$fields = $sf->getCMSFields();
17 17
 
18
-		$tab = $this->checkTabExists($fields,'Main');
18
+		$tab = $this->checkTabExists($fields, 'Main');
19 19
 
20 20
 		//Check fields
21 21
 		$nf = $this->checkFieldExists($tab, 'Name');
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 			$this->fail('Searchable fail should have failed to write');
46 46
 		} catch (ValidationException $e) {
47 47
 			$this->assertInstanceOf('ValidationException', $e);
48
-			$expected = 'The field SearchableTestPage.Title has a zero weight. ; The field '.
48
+			$expected = 'The field SearchableTestPage.Title has a zero weight. ; The field ' .
49 49
 			'SiteTree.Title has a zero weight. ; The field Page.Title has a zero weight. ';
50 50
 			$this->assertEquals($expected, $e->getMessage());
51 51
 		}
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 			$this->fail('Searchable fail should have failed to write');
77 77
 		} catch (ValidationException $e) {
78 78
 			$this->assertInstanceOf('ValidationException', $e);
79
-			$expected = 'The field SearchableTestPage.Title has a negative weight. ; The field '.
79
+			$expected = 'The field SearchableTestPage.Title has a negative weight. ; The field ' .
80 80
 			'SiteTree.Title has a negative weight. ; The field Page.Title has a negative weight. ';
81 81
 			$this->assertEquals($expected, $e->getMessage());
82 82
 		}
Please login to merge, or discard this patch.
tests/models/FlickrModels.php 2 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -139,37 +139,37 @@  discard block
 block discarded – undo
139 139
 	 * Add a mapping for the location of the photograph
140 140
 	 */
141 141
 	public function updateElasticsearchMapping(\Elastica\Type\Mapping $mapping)
142
-    {
143
-    	// get the properties of the individual fields as an array
144
-    	$properties = $mapping->getProperties();
145
-
146
-    	// add a location with geo point
147
-    	$precision1cm = array('format' => 'compressed', 'precision' => '1cm');
148
-    	$properties['location'] =  array(
149
-    		'type' => 'geo_point',
150
-    		'fielddata' => $precision1cm,
151
-    	);
152
-
153
-    	$properties['ShutterSpeed'] = array(
154
-    		'type' => 'string',
155
-    		'index' => 'not_analyzed'
142
+	{
143
+		// get the properties of the individual fields as an array
144
+		$properties = $mapping->getProperties();
145
+
146
+		// add a location with geo point
147
+		$precision1cm = array('format' => 'compressed', 'precision' => '1cm');
148
+		$properties['location'] =  array(
149
+			'type' => 'geo_point',
150
+			'fielddata' => $precision1cm,
156 151
 		);
157 152
 
158
-    	$properties['Aperture'] = array(
159
-    		// do not use float as the rounding makes facets impossible
160
-    		'type' => 'double'
161
-    	);
153
+		$properties['ShutterSpeed'] = array(
154
+			'type' => 'string',
155
+			'index' => 'not_analyzed'
156
+		);
162 157
 
163
-    	$properties['FlickrID'] = array('type' => 'integer');
158
+		$properties['Aperture'] = array(
159
+			// do not use float as the rounding makes facets impossible
160
+			'type' => 'double'
161
+		);
164 162
 
165
-    	// by default casted as a string, we want a date 2015-07-25 18:15:33 y-M-d H:m:s
166
-     	//$properties['TakenAt'] = array('type' => 'date', 'format' => 'y-M-d H:m:s');
163
+		$properties['FlickrID'] = array('type' => 'integer');
167 164
 
168
-    	// set the new properties on the mapping
169
-    	$mapping->setProperties($properties);
165
+		// by default casted as a string, we want a date 2015-07-25 18:15:33 y-M-d H:m:s
166
+	 	//$properties['TakenAt'] = array('type' => 'date', 'format' => 'y-M-d H:m:s');
170 167
 
171
-        return $mapping;
172
-    }
168
+		// set the new properties on the mapping
169
+		$mapping->setProperties($properties);
170
+
171
+		return $mapping;
172
+	}
173 173
 
174 174
 
175 175
 	/**
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 		}
206 206
 		$sortable = $sortable . '|' . $this->owner->ShutterSpeed;
207 207
 		$document->set('ShutterSpeed', $sortable);
208
-	    return $document;
208
+		return $document;
209 209
 	}
210 210
 
211 211
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@  discard block
 block discarded – undo
6 6
  * @subpackage tests
7 7
  */
8 8
 class FlickrPhotoTO extends DataObject implements TestOnly {
9
-	private static $searchable_fields = array('Title','FlickrID','Description','TakenAt', 'TakenAtDT', 'FirstViewed',
10
-		'Aperture','ShutterSpeed','FocalLength35mm','ISO','AspectRatio', 'TestMethod', 'TestMethodHTML');
9
+	private static $searchable_fields = array('Title', 'FlickrID', 'Description', 'TakenAt', 'TakenAtDT', 'FirstViewed',
10
+		'Aperture', 'ShutterSpeed', 'FocalLength35mm', 'ISO', 'AspectRatio', 'TestMethod', 'TestMethodHTML');
11 11
 
12 12
 	private static $searchable_relationships = array('Photographer', 'FlickrTagTOs', 'FlickrSetTOs');
13 13
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
  * @subpackage tests
89 89
  */
90 90
 class FlickrSetTO extends DataObject implements TestOnly {
91
-	private static $searchable_fields = array('Title','FlickrID','Description');
91
+	private static $searchable_fields = array('Title', 'FlickrID', 'Description');
92 92
 
93 93
 	private static $db = array(
94 94
 		'Title' => 'Varchar(255)',
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 
134 134
 
135 135
 
136
-class FlickrPhotoTOTestIndexingExtension extends Extension implements ElasticaIndexingHelperInterface,TestOnly {
136
+class FlickrPhotoTOTestIndexingExtension extends Extension implements ElasticaIndexingHelperInterface, TestOnly {
137 137
 
138 138
 	/**
139 139
 	 * Add a mapping for the location of the photograph
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 
146 146
     	// add a location with geo point
147 147
     	$precision1cm = array('format' => 'compressed', 'precision' => '1cm');
148
-    	$properties['location'] =  array(
148
+    	$properties['location'] = array(
149 149
     		'type' => 'geo_point',
150 150
     		'fielddata' => $precision1cm,
151 151
     	);
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 
184 184
 		if ($this->owner->Lat != null && $this->owner->Lon != null) {
185 185
 			$coors = array('lat' => $this->owner->Lat, 'lon' => $this->owner->Lon);
186
-			$document->set('location',$coors);
186
+			$document->set('location', $coors);
187 187
 		}
188 188
 
189 189
 		$sortable = $this->owner->ShutterSpeed;
@@ -200,8 +200,8 @@  discard block
 block discarded – undo
200 200
 			}
201 201
 
202 202
 		} else if (sizeof($sortable) == 2) {
203
-			$sortable = floatval($sortable[0])/intval($sortable[1]);
204
-			$sortable = round($sortable,6);
203
+			$sortable = floatval($sortable[0]) / intval($sortable[1]);
204
+			$sortable = round($sortable, 6);
205 205
 		}
206 206
 		$sortable = $sortable . '|' . $this->owner->ShutterSpeed;
207 207
 		$document->set('ShutterSpeed', $sortable);
Please login to merge, or discard this patch.
tests/models/SearchableTestPage.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
  * @subpackage tests
6 6
  */
7 7
 class SearchableTestPage extends Page implements TestOnly {
8
-	private static $searchable_fields = array('Country','PageDate');
8
+	private static $searchable_fields = array('Country', 'PageDate');
9 9
 
10 10
 	private static $db = array(
11 11
 		'Country' => 'Varchar',
Please login to merge, or discard this patch.
tests/models/FlickrPhotoElasticaSearchHelper.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
10 10
 
11 11
 	public function __construct() {
12 12
 		$aspectAgg = new RangedAggregation('Aspect', 'AspectRatio');
13
-        $aspectAgg->addRange(0.0000001, 0.3, 'Panoramic');
14
-        $aspectAgg->addRange(0.3, 0.9, 'Horizontal');
15
-        $aspectAgg->addRange(0.9, 1.2, 'Square');
16
-        $aspectAgg->addRange(1.2, 1.79, 'Vertical');
17
-        $aspectAgg->addRange(1.79, 1e7, 'Tallest');
13
+		$aspectAgg->addRange(0.0000001, 0.3, 'Panoramic');
14
+		$aspectAgg->addRange(0.3, 0.9, 'Horizontal');
15
+		$aspectAgg->addRange(0.9, 1.2, 'Square');
16
+		$aspectAgg->addRange(1.2, 1.79, 'Vertical');
17
+		$aspectAgg->addRange(1.79, 1e7, 'Tallest');
18 18
 	}
19 19
 
20 20
 	private static $titleFieldMapping = array(
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 
74 74
 
75 75
 		$aspectRangedAgg = RangedAggregation::getByTitle('Aspect');
76
-        $query->addAggregation($aspectRangedAgg->getRangeAgg());
76
+		$query->addAggregation($aspectRangedAgg->getRangeAgg());
77 77
 
78 78
 		// leave this out for the moment as way too many terms being returned slowing things down
79 79
 		/*
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 use SilverStripe\Elastica\RangedAggregation;
7 7
 
8 8
 
9
-class FlickrPhotoTOElasticaSearchHelper implements ElasticaSearchHelperInterface,TestOnly {
9
+class FlickrPhotoTOElasticaSearchHelper implements ElasticaSearchHelperInterface, TestOnly {
10 10
 
11 11
 	public function __construct() {
12 12
 		$aspectAgg = new RangedAggregation('Aspect', 'AspectRatio');
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
 					$sortable = '';
124 124
 
125 125
 				} else {
126
-					$sortable = floatval($sortable[0])/intval($sortable[1]);
127
-					$sortable = round($sortable,6);
126
+					$sortable = floatval($sortable[0]) / intval($sortable[1]);
127
+					$sortable = round($sortable, 6);
128 128
 					$sortable = $sortable . '|' . $filters['ShutterSpeed'];
129 129
 				}
130 130
 
Please login to merge, or discard this patch.
tests/ElasticSearchPageTest.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -13,15 +13,15 @@  discard block
 block discarded – undo
13 13
 
14 14
 		$fields = $searchPage->getCMSFields();
15 15
 
16
-		$mainTab = $this->checkTabExists($fields,'Main');
16
+		$mainTab = $this->checkTabExists($fields, 'Main');
17 17
 		$this->checkFieldExists($mainTab, 'Identifier');
18 18
 		$this->checkFieldExists($mainTab, 'ContentForEmptySearch');
19 19
 
20
-		$searchTab = $this->checkTabExists($fields,'Search.SearchFor');
21
-		$fieldsTab = $this->checkTabExists($fields,'Search.Fields');
22
-		$autoCompleteTab = $this->checkTabExists($fields,'Search.AutoComplete');
23
-		$aggTab = $this->checkTabExists($fields,'Search.Aggregations');
24
-		$simTab = $this->checkTabExists($fields,'Search.Similarity');
20
+		$searchTab = $this->checkTabExists($fields, 'Search.SearchFor');
21
+		$fieldsTab = $this->checkTabExists($fields, 'Search.Fields');
22
+		$autoCompleteTab = $this->checkTabExists($fields, 'Search.AutoComplete');
23
+		$aggTab = $this->checkTabExists($fields, 'Search.Aggregations');
24
+		$simTab = $this->checkTabExists($fields, 'Search.Similarity');
25 25
 
26 26
 		$this->checkFieldExists($searchTab, 'InfoField');
27 27
 		$this->checkFieldExists($searchTab, 'SiteTreeOnly');
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 		$pageLength = 10; // the default
186 186
 		$searchPageObj->ResultsPerPage = $pageLength;
187 187
 		$searchPageObj->write();
188
-		$searchPageObj->publish('Stage','Live');
188
+		$searchPageObj->publish('Stage', 'Live');
189 189
 
190 190
 		$form = $searchPageObj->SearchForm();
191 191
 		$fields = $form->Fields();
@@ -317,11 +317,11 @@  discard block
 block discarded – undo
317 317
 		$filter = array('ClazzName' => 'FlickrPhotoTO', 'Name' => 'Title');
318 318
 
319 319
 		//Check fieldnames as expected
320
-		$searchableFields = $searchPage->ElasticaSearchableFields()->filter('Active',1);
320
+		$searchableFields = $searchPage->ElasticaSearchableFields()->filter('Active', 1);
321 321
 		$sfs = $searchableFields->map('Name')->toArray();
322 322
 		sort($sfs);
323
-		$expected = array('Aperture','AspectRatio','Description','FirstViewed','FlickrID',
324
-			'FlickrSetTOs','FlickrTagTOs','FocalLength35mm','ISO','Photographer','ShutterSpeed',
323
+		$expected = array('Aperture', 'AspectRatio', 'Description', 'FirstViewed', 'FlickrID',
324
+			'FlickrSetTOs', 'FlickrTagTOs', 'FocalLength35mm', 'ISO', 'Photographer', 'ShutterSpeed',
325 325
 			'TakenAt', 'TakenAtDT', 'TestMethod', 'TestMethodHTML', 'Title');
326 326
 		$this->assertEquals($expected, $sfs);
327 327
 
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 		$searchPage->Title = '**** SiteTree Search ****';
332 332
 		$searchPage->write();
333 333
 
334
-		$searchableFields = $searchPage->ElasticaSearchableFields()->filter('Active',1);
334
+		$searchableFields = $searchPage->ElasticaSearchableFields()->filter('Active', 1);
335 335
 		$sfs = $searchableFields->map('Name')->toArray();
336 336
 		sort($sfs);
337 337
 		$expected = array('Content', 'Country', 'PageDate', 'Title');
@@ -351,15 +351,15 @@  discard block
 block discarded – undo
351 351
 		// expected mapping of searchable classes to searchable fields that will be
352 352
 		// stored in the database as SearchableClass and SearchableField
353 353
 		$expected = array(
354
-			'Page' => array('Title','Content'),
355
-			'SiteTree' => array('Title','Content'),
356
-			'SearchableTestPage' => array('Title','Content','Country','PageDate'),
354
+			'Page' => array('Title', 'Content'),
355
+			'SiteTree' => array('Title', 'Content'),
356
+			'SearchableTestPage' => array('Title', 'Content', 'Country', 'PageDate'),
357 357
 			'FlickrTagTO' => array('RawValue'),
358
-			'FlickrAuthorTO' => array('PathAlias','DisplayName','FlickrPhotoTOs'),
359
-			'FlickrPhotoTO' => array('Title','FlickrID','Description','TakenAt', 'TakenAtDT', 'Aperture',
360
-				'ShutterSpeed','FocalLength35mm','ISO','Photographer','FlickrTagTOs','FlickrSetTOs',
361
-				'FirstViewed','AspectRatio', 'TestMethod', 'TestMethodHTML'),
362
-			'FlickrSetTO' => array('Title','FlickrID','Description')
358
+			'FlickrAuthorTO' => array('PathAlias', 'DisplayName', 'FlickrPhotoTOs'),
359
+			'FlickrPhotoTO' => array('Title', 'FlickrID', 'Description', 'TakenAt', 'TakenAtDT', 'Aperture',
360
+				'ShutterSpeed', 'FocalLength35mm', 'ISO', 'Photographer', 'FlickrTagTOs', 'FlickrSetTOs',
361
+				'FirstViewed', 'AspectRatio', 'TestMethod', 'TestMethodHTML'),
362
+			'FlickrSetTO' => array('Title', 'FlickrID', 'Description')
363 363
 		);
364 364
 
365 365
 		// check the expected classes
@@ -383,18 +383,18 @@  discard block
 block discarded – undo
383 383
 		foreach ($expectedClasses as $expectedClass) {
384 384
 			$expectedFields = array();
385 385
 			$sc = SearchableClass::get()->filter('Name', $expectedClass)->first();
386
-			$this->assertEquals($expectedClass,$sc->Name);
386
+			$this->assertEquals($expectedClass, $sc->Name);
387 387
 
388 388
 			$inSiteTree = 1;
389
-			$start = substr($expectedClass, 0,6);
389
+			$start = substr($expectedClass, 0, 6);
390 390
 			if ($start == 'Flickr') {
391 391
 				$inSiteTree = 0;
392 392
 			};
393
-			$this->assertEquals($inSiteTree,$sc->InSiteTree);
393
+			$this->assertEquals($inSiteTree, $sc->InSiteTree);
394 394
 
395 395
 			$expectedNames = $expected[$expectedClass];
396 396
 			foreach ($expectedNames as $expectedName) {
397
-				$filter = array('Name' => $expectedName, 'SearchableClassID' => $sc->ID );
397
+				$filter = array('Name' => $expectedName, 'SearchableClassID' => $sc->ID);
398 398
 				$sf = SearchableField::get()->filter($filter)->first();
399 399
 				$this->assertEquals($expectedName, $sf->Name);
400 400
 				$fieldCtr++;
Please login to merge, or discard this patch.
tests/ElasticSearchPageControllerTest.php 2 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -115,10 +115,10 @@  discard block
 block discarded – undo
115 115
 		$this->assertEquals(200, $searchPage->getStatusCode());
116 116
 		$url = rtrim($url,'/');
117 117
 
118
-        $response = $this->get($url);
119
-        $this->assertEquals(200, $response->getStatusCode());
118
+		$response = $this->get($url);
119
+		$this->assertEquals(200, $response->getStatusCode());
120 120
 
121
-        $this->assertSelectorStartsWithOrEquals('span.count', 0, '(5)');
121
+		$this->assertSelectorStartsWithOrEquals('span.count', 0, '(5)');
122 122
 		$this->assertSelectorStartsWithOrEquals('span.count', 1, '(11)');
123 123
 		$this->assertSelectorStartsWithOrEquals('span.count', 2, '(12)');
124 124
 		$this->assertSelectorStartsWithOrEquals('span.count', 3, '(13)');
@@ -168,10 +168,10 @@  discard block
 block discarded – undo
168 168
 		$url = rtrim($url,'/');
169 169
 		$url .= '?ISO=400';
170 170
 
171
-        $response = $this->get($url);
172
-        $this->assertEquals(200, $response->getStatusCode());
171
+		$response = $this->get($url);
172
+		$this->assertEquals(200, $response->getStatusCode());
173 173
 
174
-        // These are less than in the no facets selected case, as expected
174
+		// These are less than in the no facets selected case, as expected
175 175
 		$this->assertSelectorStartsWithOrEquals('span.count', 0, '(2)');
176 176
 		$this->assertSelectorStartsWithOrEquals('span.count', 1, '(1)');
177 177
 		$this->assertSelectorStartsWithOrEquals('span.count', 2, '(2)');
@@ -215,12 +215,12 @@  discard block
 block discarded – undo
215 215
 		$url = rtrim($url,'/');
216 216
 		$url .= '?ISO=400&ShutterSpeed=2%2F250';
217 217
 
218
-        $response = $this->get($url);
218
+		$response = $this->get($url);
219 219
 		print_r($response);
220
-        $this->assertEquals(200, $response->getStatusCode());
220
+		$this->assertEquals(200, $response->getStatusCode());
221 221
 
222
-        // These are less than in the one facet selected case, as expected
223
-        $this->assertSelectorStartsWithOrEquals('span.count', 0, '(1)');
222
+		// These are less than in the one facet selected case, as expected
223
+		$this->assertSelectorStartsWithOrEquals('span.count', 0, '(1)');
224 224
 		$this->assertSelectorStartsWithOrEquals('span.count', 1, '(2)');
225 225
 		$this->assertSelectorStartsWithOrEquals('span.count', 2, '(1)');
226 226
 		$this->assertSelectorStartsWithOrEquals('span.count', 3, '(1)');
@@ -249,12 +249,12 @@  discard block
 block discarded – undo
249 249
 		$url = rtrim($url,'/');
250 250
 		$url .= '?ISO=400&ShutterSpeed=2%2F250&Aspect=Vertical';
251 251
 
252
-        $response = $this->get($url);
252
+		$response = $this->get($url);
253 253
 		print_r($response);
254
-        $this->assertEquals(200, $response->getStatusCode());
254
+		$this->assertEquals(200, $response->getStatusCode());
255 255
 
256
-        // These are less than in the one facet selected case, as expected
257
-        $this->assertSelectorStartsWithOrEquals('span.count', 0, '(2)');
256
+		// These are less than in the one facet selected case, as expected
257
+		$this->assertSelectorStartsWithOrEquals('span.count', 0, '(2)');
258 258
 		$this->assertSelectorStartsWithOrEquals('span.count', 1, '(1)');
259 259
 		$this->assertSelectorStartsWithOrEquals('span.count', 2, '(1)');
260 260
 	}
@@ -602,13 +602,13 @@  discard block
 block discarded – undo
602 602
 		$searchPage = $this->get($searchPageObj->URLSegment);
603 603
 		$this->assertEquals(200, $searchPage->getStatusCode());
604 604
 
605
-        $response = $this->submitForm("ElasticSearchForm_SearchForm", null, array(
606
-            'q' => 'New Zealand'
607
-        ));
605
+		$response = $this->submitForm("ElasticSearchForm_SearchForm", null, array(
606
+			'q' => 'New Zealand'
607
+		));
608 608
 
609 609
 		$url = rtrim($url,'/');
610
-        $this->assertEquals(302, $response->getStatusCode());
611
-        $this->assertEquals($url.'?q=New Zealand&sfid=testwithagg', $response->getHeader('Location'));
610
+		$this->assertEquals(302, $response->getStatusCode());
611
+		$this->assertEquals($url.'?q=New Zealand&sfid=testwithagg', $response->getHeader('Location'));
612 612
 	}
613 613
 
614 614
 
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 		}
49 49
 		$esp2->write();
50 50
 
51
-		$esfs= $esp->ElasticaSearchableFields();
51
+		$esfs = $esp->ElasticaSearchableFields();
52 52
 
53 53
 		foreach ($esfs as $sf) {
54 54
 			if ($sf->Name == 'Title' || $sf->Name == 'Description') {
@@ -80,10 +80,10 @@  discard block
 block discarded – undo
80 80
 		$esp->ElasticaSearchableFields()->add($espf2);
81 81
 		$esp2->ElasticaSearchableFields()->add($espf2);
82 82
 */
83
-		$esp->publish('Stage','Live');
84
-		$esp2->publish('Stage','Live');
83
+		$esp->publish('Stage', 'Live');
84
+		$esp2->publish('Stage', 'Live');
85 85
 		$this->ElasticSearchPage = $esp;
86
-		$this->ElasticSearchPage2= $esp2;
86
+		$this->ElasticSearchPage2 = $esp2;
87 87
 
88 88
 
89 89
 		echo "CHECK MYSQL";
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 		$url = $searchPageObj->Link();
114 114
 		$searchPage = $this->get($searchPageObj->URLSegment);
115 115
 		$this->assertEquals(200, $searchPage->getStatusCode());
116
-		$url = rtrim($url,'/');
116
+		$url = rtrim($url, '/');
117 117
 
118 118
         $response = $this->get($url);
119 119
         $this->assertEquals(200, $response->getStatusCode());
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 		$url = $searchPageObj->Link();
166 166
 		$searchPage = $this->get($searchPageObj->URLSegment);
167 167
 		$this->assertEquals(200, $searchPage->getStatusCode());
168
-		$url = rtrim($url,'/');
168
+		$url = rtrim($url, '/');
169 169
 		$url .= '?ISO=400';
170 170
 
171 171
         $response = $this->get($url);
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 		$url = $searchPageObj->Link();
213 213
 		$searchPage = $this->get($searchPageObj->URLSegment);
214 214
 		$this->assertEquals(200, $searchPage->getStatusCode());
215
-		$url = rtrim($url,'/');
215
+		$url = rtrim($url, '/');
216 216
 		$url .= '?ISO=400&ShutterSpeed=2%2F250';
217 217
 
218 218
         $response = $this->get($url);
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 		$url = $searchPageObj->Link();
247 247
 		$searchPage = $this->get($searchPageObj->URLSegment);
248 248
 		$this->assertEquals(200, $searchPage->getStatusCode());
249
-		$url = rtrim($url,'/');
249
+		$url = rtrim($url, '/');
250 250
 		$url .= '?ISO=400&ShutterSpeed=2%2F250&Aspect=Vertical';
251 251
 
252 252
         $response = $this->get($url);
@@ -290,9 +290,9 @@  discard block
 block discarded – undo
290 290
 	public function testQueryInSearchBoxForOneFormOnly() {
291 291
 		$searchPageObj = $this->ElasticSearchPage2;
292 292
 		$url = rtrim($searchPageObj->Link(), '/');
293
-		$url .= "?q=Auckland&sfid=".$searchPageObj->Identifier;
293
+		$url .= "?q=Auckland&sfid=" . $searchPageObj->Identifier;
294 294
 
295
-		echo "URL:".$url;
295
+		echo "URL:" . $url;
296 296
 		$response = $this->get($url);
297 297
 
298 298
 		print_r($response);
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 		$pageLength = 10; // the default
320 320
 		$searchPageObj->ResultsPerPage = $pageLength;
321 321
 		$searchPageObj->write();
322
-		$searchPageObj->publish('Stage','Live');
322
+		$searchPageObj->publish('Stage', 'Live');
323 323
 
324 324
 		$url = rtrim($searchPageObj->Link(), '/');
325 325
 		$response = $this->get($url);
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
 		//Note pages need to be published, by default fixtures only reside in Stage
559 559
 		$searchPageObj = $this->ElasticSearchPage2;
560 560
 		$url = rtrim($searchPageObj->Link(), '/');
561
-		$url = $url.'?q='.$searchTerm;
561
+		$url = $url . '?q=' . $searchTerm;
562 562
 		echo "URL:$url\n";
563 563
 		$response = $this->get($url);
564 564
 		$this->assertEquals(200, $response->getStatusCode());
@@ -606,9 +606,9 @@  discard block
 block discarded – undo
606 606
             'q' => 'New Zealand'
607 607
         ));
608 608
 
609
-		$url = rtrim($url,'/');
609
+		$url = rtrim($url, '/');
610 610
         $this->assertEquals(302, $response->getStatusCode());
611
-        $this->assertEquals($url.'?q=New Zealand&sfid=testwithagg', $response->getHeader('Location'));
611
+        $this->assertEquals($url . '?q=New Zealand&sfid=testwithagg', $response->getHeader('Location'));
612 612
 	}
613 613
 
614 614
 
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
 		//Note pages need to be published, by default fixtures only reside in Stage
629 629
 		$searchPageObj = $this->ElasticSearchPage;
630 630
 		$url = rtrim($searchPageObj->Link(), '/');
631
-		$url = $url.'?q='.$searchTerm;
631
+		$url = $url . '?q=' . $searchTerm;
632 632
 		echo "URL:$url\n";
633 633
 		$response = $this->get($url);
634 634
 		$this->assertEquals(200, $response->getStatusCode());
@@ -673,13 +673,13 @@  discard block
 block discarded – undo
673 673
 		$searchPageObj = $this->ElasticSearchPage;
674 674
 		$searchPageObj->SiteTreeOnly = true;
675 675
 		$searchPageObj->write();
676
-		$searchPageObj->publish('Stage','Live');
676
+		$searchPageObj->publish('Stage', 'Live');
677 677
 
678 678
 
679 679
 		$pageLength = 10; // the default
680 680
 		$searchPageObj->ResultsPerPage = $pageLength;
681 681
 		$url = rtrim($searchPageObj->Link(), '/');
682
-		$url = $url.'?q='.$searchTerm;
682
+		$url = $url . '?q=' . $searchTerm;
683 683
 		$firstPageURL = $url;
684 684
 		$response = $this->get($url);
685 685
 		$this->assertEquals(200, $response->getStatusCode());
@@ -714,7 +714,7 @@  discard block
 block discarded – undo
714 714
 		$pageLength = 10; // the default
715 715
 		$searchPageObj->ResultsPerPage = $pageLength;
716 716
 		$url = rtrim($searchPageObj->Link(), '/');
717
-		$url = $url.'?q='.$searchTerm;
717
+		$url = $url . '?q=' . $searchTerm;
718 718
 		$firstPageURL = $url;
719 719
 		$response = $this->get($url);
720 720
 		$this->assertEquals(200, $response->getStatusCode());
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
 
740 740
 		$resultsP1 = $this->collateSearchResults();
741 741
 
742
-		$page2url = $url . '&start='.$pageLength;
742
+		$page2url = $url . '&start=' . $pageLength;
743 743
 
744 744
 		//Check pagination on page 2
745 745
 		$response2 = $this->get($page2url);
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
 		//increase the number of results and assert that they are the same as per pages 1,2 joined
767 767
 		$searchPageObj->ResultsPerPage = 20;
768 768
 		$searchPageObj->write();
769
-		$searchPageObj->publish('Stage','Live');
769
+		$searchPageObj->publish('Stage', 'Live');
770 770
 		$response3 = $this->get($firstPageURL);
771 771
 	}
772 772
 
Please login to merge, or discard this patch.
tests/AutocompleteControllerTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 
22 22
 		// Delete and assert that it does not exist
23 23
 		echo "Displaying searchable fields\n";
24
-		$sql =  "SELECT ID,Name,ClazzName from SearchableField";
24
+		$sql = "SELECT ID,Name,ClazzName from SearchableField";
25 25
 		$records = DB::query($sql);
26 26
 		foreach ($records as $record) {
27 27
 			print_r($record);
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
 		$filter = array('Name' => 'Title', 'ClazzName' => 'FlickrPhotoTO');
31 31
 		$sf = SearchableField::get()->filter($filter)->first();
32 32
 		print_r($sf);
33
-		$sql = "UPDATE ElasticSearchPage_ElasticaSearchableFields SET Searchable=1,".
34
-				"EnableAutocomplete=1 where SearchableFieldID=".$sf->ID;
33
+		$sql = "UPDATE ElasticSearchPage_ElasticaSearchableFields SET Searchable=1," .
34
+				"EnableAutocomplete=1 where SearchableFieldID=" . $sf->ID;
35 35
 		echo $sql;
36 36
 
37 37
 		DB::query($sql);
Please login to merge, or discard this patch.
tests/TermVectorTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@
 block discarded – undo
17 17
 		sort($terms);
18 18
 		$expected = array('Description', 'Description.shingles', 'Description.standard',
19 19
 			'ShutterSpeed',
20
-			'TestMethod','TestMethod.shingles','TestMethod.standard',
21
-			'TestMethodHTML','TestMethodHTML.shingles','TestMethodHTML.standard',
20
+			'TestMethod', 'TestMethod.shingles', 'TestMethod.standard',
21
+			'TestMethodHTML', 'TestMethodHTML.shingles', 'TestMethodHTML.standard',
22 22
 			'Title', 'Title.autocomplete', 'Title.shingles', 'Title.standard');
23 23
 		$this->assertEquals($expected, $terms);
24 24
 
Please login to merge, or discard this patch.