Completed
Push — dev2 ( 26ca88...f79151 )
by Gordon
03:18
created
tests/ElasticSearchPageControllerTest.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -37,27 +37,27 @@  discard block
 block discarded – undo
37 37
 		$extraFields = array('Searchable' => 1, 'SimilarSearchable' => 1, 'Active' => 1,
38 38
 			'Weight' => 1);
39 39
 		$esfs2 = $esp2->ElasticaSearchableFields();
40
-		foreach ($esfs2 as $sf) {
41
-			if ($sf->Name == 'Title' || $sf->Name == 'Description') {
40
+		foreach($esfs2 as $sf) {
41
+			if($sf->Name == 'Title' || $sf->Name == 'Description') {
42 42
 				$esfs2->remove($sf);
43 43
 				$esfs2->add($sf, $extraFields);
44 44
 			}
45 45
 		}
46 46
 		$esp2->write();
47 47
 
48
-		$esfs= $esp->ElasticaSearchableFields();
48
+		$esfs = $esp->ElasticaSearchableFields();
49 49
 
50
-		foreach ($esfs as $sf) {
51
-			if ($sf->Name == 'Title' || $sf->Name == 'Description') {
50
+		foreach($esfs as $sf) {
51
+			if($sf->Name == 'Title' || $sf->Name == 'Description') {
52 52
 				$esfs->remove($sf);
53 53
 				$esfs->add($sf, $extraFields);
54 54
 			}
55 55
 		}
56 56
 		$esp->write();
57
-		$esp->publish('Stage','Live');
58
-		$esp2->publish('Stage','Live');
57
+		$esp->publish('Stage', 'Live');
58
+		$esp2->publish('Stage', 'Live');
59 59
 		$this->ElasticSearchPage = $esp;
60
-		$this->ElasticSearchPage2= $esp2;
60
+		$this->ElasticSearchPage2 = $esp2;
61 61
 	}
62 62
 
63 63
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 		$url = $searchPageObj->Link();
73 73
 		$searchPage = $this->get($searchPageObj->URLSegment);
74 74
 		$this->assertEquals(200, $searchPage->getStatusCode());
75
-		$url = rtrim($url,'/');
75
+		$url = rtrim($url, '/');
76 76
 
77 77
         $response = $this->get($url);
78 78
         $this->assertEquals(200, $response->getStatusCode());
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 		$url = $searchPageObj->Link();
125 125
 		$searchPage = $this->get($searchPageObj->URLSegment);
126 126
 		$this->assertEquals(200, $searchPage->getStatusCode());
127
-		$url = rtrim($url,'/');
127
+		$url = rtrim($url, '/');
128 128
 		$url .= '?ISO=400';
129 129
 
130 130
         $response = $this->get($url);
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 		$url = $searchPageObj->Link();
172 172
 		$searchPage = $this->get($searchPageObj->URLSegment);
173 173
 		$this->assertEquals(200, $searchPage->getStatusCode());
174
-		$url = rtrim($url,'/');
174
+		$url = rtrim($url, '/');
175 175
 		$url .= '?ISO=400&ShutterSpeed=2%2F250';
176 176
 
177 177
         $response = $this->get($url);
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 		$url = $searchPageObj->Link();
206 206
 		$searchPage = $this->get($searchPageObj->URLSegment);
207 207
 		$this->assertEquals(200, $searchPage->getStatusCode());
208
-		$url = rtrim($url,'/');
208
+		$url = rtrim($url, '/');
209 209
 		$url .= '?ISO=400&ShutterSpeed=2%2F250&Aspect=Vertical';
210 210
 
211 211
         $response = $this->get($url);
@@ -249,9 +249,9 @@  discard block
 block discarded – undo
249 249
 	public function testQueryInSearchBoxForOneFormOnly() {
250 250
 		$searchPageObj = $this->ElasticSearchPage2;
251 251
 		$url = rtrim($searchPageObj->Link(), '/');
252
-		$url .= "?q=Auckland&sfid=".$searchPageObj->Identifier;
252
+		$url .= "?q=Auckland&sfid=" . $searchPageObj->Identifier;
253 253
 
254
-		echo "URL:".$url;
254
+		echo "URL:" . $url;
255 255
 		$response = $this->get($url);
256 256
 
257 257
 		print_r($response);
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 		$pageLength = 10; // the default
279 279
 		$searchPageObj->ResultsPerPage = $pageLength;
280 280
 		$searchPageObj->write();
281
-		$searchPageObj->publish('Stage','Live');
281
+		$searchPageObj->publish('Stage', 'Live');
282 282
 
283 283
 		$url = rtrim($searchPageObj->Link(), '/');
284 284
 		$response = $this->get($url);
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 
300 300
 	public function testTemplateOverrideExtension() {
301 301
 
302
-		if (!class_exists('PageControllerTemplateOverrideExtension')) {
302
+		if(!class_exists('PageControllerTemplateOverrideExtension')) {
303 303
 			$this->markTestSkipped('PageControllerTemplateOverrideExtension not installed');
304 304
 		}
305 305
 
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 		//Note pages need to be published, by default fixtures only reside in Stage
518 518
 		$searchPageObj = $this->ElasticSearchPage2;
519 519
 		$url = rtrim($searchPageObj->Link(), '/');
520
-		$url = $url.'?q='.$searchTerm;
520
+		$url = $url . '?q=' . $searchTerm;
521 521
 		echo "URL:$url\n";
522 522
 		$response = $this->get($url);
523 523
 		$this->assertEquals(200, $response->getStatusCode());
@@ -565,9 +565,9 @@  discard block
 block discarded – undo
565 565
             'q' => 'New Zealand'
566 566
         ));
567 567
 
568
-		$url = rtrim($url,'/');
568
+		$url = rtrim($url, '/');
569 569
         $this->assertEquals(302, $response->getStatusCode());
570
-        $this->assertEquals($url.'?q=New Zealand&sfid=testwithagg', $response->getHeader('Location'));
570
+        $this->assertEquals($url . '?q=New Zealand&sfid=testwithagg', $response->getHeader('Location'));
571 571
 	}
572 572
 
573 573
 
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 		//Note pages need to be published, by default fixtures only reside in Stage
588 588
 		$searchPageObj = $this->ElasticSearchPage;
589 589
 		$url = rtrim($searchPageObj->Link(), '/');
590
-		$url = $url.'?q='.$searchTerm;
590
+		$url = $url . '?q=' . $searchTerm;
591 591
 		echo "URL:$url\n";
592 592
 		$response = $this->get($url);
593 593
 		$this->assertEquals(200, $response->getStatusCode());
@@ -632,13 +632,13 @@  discard block
 block discarded – undo
632 632
 		$searchPageObj = $this->ElasticSearchPage;
633 633
 		$searchPageObj->SiteTreeOnly = true;
634 634
 		$searchPageObj->write();
635
-		$searchPageObj->publish('Stage','Live');
635
+		$searchPageObj->publish('Stage', 'Live');
636 636
 
637 637
 
638 638
 		$pageLength = 10; // the default
639 639
 		$searchPageObj->ResultsPerPage = $pageLength;
640 640
 		$url = rtrim($searchPageObj->Link(), '/');
641
-		$url = $url.'?q='.$searchTerm;
641
+		$url = $url . '?q=' . $searchTerm;
642 642
 		$firstPageURL = $url;
643 643
 		$response = $this->get($url);
644 644
 		$this->assertEquals(200, $response->getStatusCode());
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
 		$pageLength = 10; // the default
674 674
 		$searchPageObj->ResultsPerPage = $pageLength;
675 675
 		$url = rtrim($searchPageObj->Link(), '/');
676
-		$url = $url.'?q='.$searchTerm;
676
+		$url = $url . '?q=' . $searchTerm;
677 677
 		$firstPageURL = $url;
678 678
 		$response = $this->get($url);
679 679
 		$this->assertEquals(200, $response->getStatusCode());
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
 
699 699
 		$resultsP1 = $this->collateSearchResults();
700 700
 
701
-		$page2url = $url . '&start='.$pageLength;
701
+		$page2url = $url . '&start=' . $pageLength;
702 702
 
703 703
 		//Check pagination on page 2
704 704
 		$response2 = $this->get($page2url);
@@ -725,19 +725,19 @@  discard block
 block discarded – undo
725 725
 		//increase the number of results and assert that they are the same as per pages 1,2 joined
726 726
 		$searchPageObj->ResultsPerPage = 20;
727 727
 		$searchPageObj->write();
728
-		$searchPageObj->publish('Stage','Live');
728
+		$searchPageObj->publish('Stage', 'Live');
729 729
 		$response3 = $this->get($firstPageURL);
730 730
 	}
731 731
 
732 732
 
733 733
 	private function enableHighlights() {
734
-		foreach (SearchableField::get()->filter('Name', 'Title') as $sf) {
734
+		foreach(SearchableField::get()->filter('Name', 'Title') as $sf) {
735 735
 			echo "Highlighting {$sf->ClazzName} {$sf->Name}\n";
736 736
 			$sf->ShowHighlights = true;
737 737
 			$sf->write();
738 738
 		}
739 739
 
740
-		foreach (SearchableField::get()->filter('Name', 'Content') as $sf) {
740
+		foreach(SearchableField::get()->filter('Name', 'Content') as $sf) {
741 741
 			echo "Highlighting {$sf->ClazzName} {$sf->Name}\n";
742 742
 
743 743
 			$sf->ShowHighlights = true;
Please login to merge, or discard this patch.
tests/TranslatableSearchableTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 	public function setUpOnce() {
16 16
 		//Add translatable if it exists
17
-		if (class_exists('Translatable')) {
17
+		if(class_exists('Translatable')) {
18 18
 			error_log("TRANSLATABLE EXISTS!");
19 19
 			SiteTree::add_extension('Translatable');
20 20
 		}
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	public function setUp() {
26 26
 		// this needs to be called in order to create the list of searchable
27 27
 		// classes and fields that are available.  Simulates part of a build
28
-		$classes = array('SearchableTestPage','SiteTree','Page','FlickrPhotoTO','FlickrSetTO',
28
+		$classes = array('SearchableTestPage', 'SiteTree', 'Page', 'FlickrPhotoTO', 'FlickrSetTO',
29 29
 			'FlickrTagTO', 'FlickrAuthorTO', 'FlickrSetTO');
30 30
 		$this->requireDefaultRecordsFrom = $classes;
31 31
 		// load fixtures
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 
36 36
 
37 37
 	public function testgetFieldValuesAsArrayWithLocale() {
38
-		if (!class_exists('Translatable')) {
38
+		if(!class_exists('Translatable')) {
39 39
 			$this->markTestSkipped('Translatable not installed');
40 40
 		}
41 41
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 * Test a valid identifier
69 69
 	 */
70 70
 	public function testMappingWithLocale() {
71
-		if (!class_exists('Translatable')) {
71
+		if(!class_exists('Translatable')) {
72 72
 			$this->markTestSkipped('Translatable not installed');
73 73
 		}
74 74
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	Get a record as an Elastic document and check values
88 88
 	 */
89 89
 	public function testGetElasticaDocumentWithLocale() {
90
-		if (!class_exists('Translatable')) {
90
+		if(!class_exists('Translatable')) {
91 91
 			$this->markTestSkipped('Translatable not installed');
92 92
 		}
93 93
 
Please login to merge, or discard this patch.
tests/TranslatableUnitTest.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -10,14 +10,14 @@  discard block
 block discarded – undo
10 10
 
11 11
 	public function setUpOnce() {
12 12
 		//Add translatable if it exists
13
-		if (class_exists('Translatable')) {
13
+		if(class_exists('Translatable')) {
14 14
 			SiteTree::add_extension('Translatable');
15 15
 		}
16 16
 		parent::setUpOnce();
17 17
 	}
18 18
 
19 19
 	public function testElasticSearchForm() {
20
-		if (!class_exists('Translatable')) {
20
+		if(!class_exists('Translatable')) {
21 21
 			$this->markTestSkipped('Translatable not installed');
22 22
 		}
23 23
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
 
38 38
 	public function testHighlightPassingFields() {
39
-		if (!class_exists('Translatable')) {
39
+		if(!class_exists('Translatable')) {
40 40
 			$this->markTestSkipped('Translatable not installed');
41 41
 		}
42 42
 
@@ -50,28 +50,28 @@  discard block
 block discarded – undo
50 50
 		$paginated = $es->search($query, $fields);
51 51
 		$ctr = 0;
52 52
 
53
-		foreach ($paginated->getList()->toArray() as $result) {
53
+		foreach($paginated->getList()->toArray() as $result) {
54 54
 			$ctr++;
55 55
 
56
-			foreach ($result->SearchHighlightsByField->Description->getIterator() as $highlight) {
56
+			foreach($result->SearchHighlightsByField->Description->getIterator() as $highlight) {
57 57
 				$snippet = $highlight->Snippet;
58 58
 				$snippet = strtolower($snippet);
59 59
 				$wordFound = false;
60 60
 				$lcquery = explode(' ', strtolower($query));
61
-				foreach ($lcquery as $part) {
62
-					$bracketed = '<strong class="hl">'.$part.'</strong>';
63
-					if (strpos($snippet, $bracketed) > 0) {
61
+				foreach($lcquery as $part) {
62
+					$bracketed = '<strong class="hl">' . $part . '</strong>';
63
+					if(strpos($snippet, $bracketed) > 0) {
64 64
 						$wordFound = true;
65 65
 					}
66 66
 				}
67
-				$this->assertTrue($wordFound,'Highlight should have been found');
67
+				$this->assertTrue($wordFound, 'Highlight should have been found');
68 68
 			}
69 69
 		}
70 70
 	}
71 71
 
72 72
 
73 73
 	public function testAutoCompleteGood() {
74
-		if (!class_exists('Translatable')) {
74
+		if(!class_exists('Translatable')) {
75 75
 			$this->markTestSkipped('Translatable not installed');
76 76
 		}
77 77
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 		$query = 'Lond';
82 82
 		$results = $es->autocomplete_search($query, 'Title');
83 83
 		$this->assertEquals(7, $results->getTotalItems());
84
-		foreach ($results->toArray() as $result) {
84
+		foreach($results->toArray() as $result) {
85 85
 			$this->assertTrue(strpos($result->Title, $query) > 0);
86 86
 		}
87 87
 	}
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
 	// FIXME - this test is shardy unfortunately
95 95
 	public function testMoreLikeThisSinglePhoto() {
96
-		if (!class_exists('Translatable')) {
96
+		if(!class_exists('Translatable')) {
97 97
 			$this->markTestSkipped('Translatable not installed');
98 98
 		}
99 99
 
@@ -105,11 +105,11 @@  discard block
 block discarded – undo
105 105
 		$es->setLocale($locale);
106 106
 		$es->setClasses('FlickrPhotoTO');
107 107
 
108
-		$fields = array('Description.standard' => 1,'Title.standard' => 1);
108
+		$fields = array('Description.standard' => 1, 'Title.standard' => 1);
109 109
 		$results = $es->moreLikeThis($fp, $fields, true);
110 110
 
111 111
 		echo "RESULTS:\n";
112
-		foreach ($results as $result) {
112
+		foreach($results as $result) {
113 113
 			echo "-\t{$result->Title}\n";
114 114
 		}
115 115
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 		$expected = array('texas');
127 127
 		$this->assertEquals($expected, $terms['Title.standard']);
128 128
 
129
-		$expected = array('new', 'see','photographs', 'information','resolution', 'company', 'view',
129
+		$expected = array('new', 'see', 'photographs', 'information', 'resolution', 'company', 'view',
130 130
 			'high', 'collection', 'pacific', 'orleans', 'degolyer', 'southern', 'everett',
131 131
 			'railroad', 'texas');
132 132
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 */
155 155
 
156 156
 	public function testSimilarGood() {
157
-		if (!class_exists('Translatable')) {
157
+		if(!class_exists('Translatable')) {
158 158
 			$this->markTestSkipped('Translatable not installed');
159 159
 		}
160 160
 
@@ -163,8 +163,8 @@  discard block
 block discarded – undo
163 163
 		$es->setClasses('FlickrPhotoTO');
164 164
 		$fields = array('Title.standard' => 1, 'Description.standard' => 1);
165 165
 		$paginated = $es->moreLikeThis($fp, $fields, true);
166
-		foreach ($paginated->getList() as $result) {
167
-			echo $result->ID. ' : '.$result->Title."\n";
166
+		foreach($paginated->getList() as $result) {
167
+			echo $result->ID . ' : ' . $result->Title . "\n";
168 168
 		}
169 169
 		$this->assertEquals(32, $paginated->getTotalItems());
170 170
 		$results = $paginated->getList()->toArray();
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 	FIXME - this is not working, not sure why.  Trying to complete coverage of ReindexTask
186 186
 	 */
187 187
 	public function testBulkIndexing() {
188
-		if (!class_exists('Translatable')) {
188
+		if(!class_exists('Translatable')) {
189 189
 			$this->markTestSkipped('Translatable not installed');
190 190
 		}
191 191
 
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 		//Check that the number of indexing requests has increased by 2
204 204
 		$deltaReqs = $this->service->getIndexingRequestCtr() - $reqs;
205 205
 		//One call is made for each of Page and FlickrPhotoTO
206
-		$this->assertEquals(2,$deltaReqs);
206
+		$this->assertEquals(2, $deltaReqs);
207 207
 
208 208
 		// default installed pages plus 100 FlickrPhotoTOs
209 209
 		$this->checkNumberOfIndexedDocuments(103);
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 
213 213
 	// if this is not set to unbounded, zero, a conditional is triggered to add max doc freq to the request
214 214
 	public function testSimilarChangeMaxDocFreq() {
215
-		if (!class_exists('Translatable')) {
215
+		if(!class_exists('Translatable')) {
216 216
 			$this->markTestSkipped('Translatable not installed');
217 217
 		}
218 218
 
@@ -222,8 +222,8 @@  discard block
 block discarded – undo
222 222
 		$es->setClasses('FlickrPhotoTO');
223 223
 		$fields = array('Title.standard' => 1, 'Description.standard' => 1);
224 224
 		$paginated = $es->moreLikeThis($fp, $fields, true);
225
-		foreach ($paginated->getList() as $result) {
226
-			echo $result->ID. ' : '.$result->Title."\n";
225
+		foreach($paginated->getList() as $result) {
226
+			echo $result->ID . ' : ' . $result->Title . "\n";
227 227
 		}
228 228
 		$this->assertEquals(14, $paginated->getTotalItems());
229 229
 		$results = $paginated->getList()->toArray();
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 
233 233
 
234 234
 	public function testSimilarNullFields() {
235
-		if (!class_exists('Translatable')) {
235
+		if(!class_exists('Translatable')) {
236 236
 			$this->markTestSkipped('Translatable not installed');
237 237
 		}
238 238
 
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 
249 249
 
250 250
 	public function testSimilarNullItem() {
251
-		if (!class_exists('Translatable')) {
251
+		if(!class_exists('Translatable')) {
252 252
 			$this->markTestSkipped('Translatable not installed');
253 253
 		}
254 254
 
@@ -266,9 +266,9 @@  discard block
 block discarded – undo
266 266
 	private function makeCode($paginated) {
267 267
 		$results = $paginated->getList()->toArray();
268 268
 		$ctr = 0;
269
-		echo '$result = $paginated->getList()->toArray();'."\n";
270
-		foreach ($results as $result) {
271
-			echo '$this->assertEquals("'.$result->Title.'", $results['.$ctr.']->Title);'."\n";
269
+		echo '$result = $paginated->getList()->toArray();' . "\n";
270
+		foreach($results as $result) {
271
+			echo '$this->assertEquals("' . $result->Title . '", $results[' . $ctr . ']->Title);' . "\n";
272 272
 			$ctr++;
273 273
 		}
274 274
 	}
Please login to merge, or discard this patch.
tests/ElasticSearchPage_Validator_Test.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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,
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 		$origMode = Versioned::get_reading_mode();
70 70
 		echo "CURRENT MODE:$origMode\n";
71 71
 		Versioned::set_reading_mode('Stage');
72
-		echo "CURRENT MODE:".Versioned::get_reading_mode()."\n";
72
+		echo "CURRENT MODE:" . Versioned::get_reading_mode() . "\n";
73 73
 		Versioned::set_reading_mode($origMode); // reset current mode
74 74
 	}
75 75
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 		$esp->Identifier = 'THISWILLBECOPIED';
120 120
 		$esp->write();
121 121
 		$this->checkForError('Identifier', 'THISWILLBECOPIED',
122
-			'The identifier THISWILLBECOPIED already exists' );
122
+			'The identifier THISWILLBECOPIED already exists');
123 123
 	}
124 124
 
125 125
 
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 		$form = new Form($this, 'Form', $fields, new FieldList());
132 132
 		$form->loadDataFrom($this->ElasticSearchPage);
133 133
 
134
-		foreach ($form->Fields() as $field) {
134
+		foreach($form->Fields() as $field) {
135 135
 			echo "************** {$field->getName()} -> {$field->Value()}\n";
136 136
 		}
137 137
 		$form->setValidator($this->ElasticSearchPage->getCMSValidator());
@@ -141,13 +141,13 @@  discard block
 block discarded – undo
141 141
 		$found = false;
142 142
 		print_r($errors);
143 143
 
144
-		foreach ($errors as $error) {
144
+		foreach($errors as $error) {
145 145
 			echo "Checking error\n";
146
-			echo " - " . $error['fieldName'].' => '.$error['message']."\n";
147
-			echo "\tT1:".($error['message'] == $message);
148
-			echo "\n\tT2:".($error['fieldName'] == $fieldName);
146
+			echo " - " . $error['fieldName'] . ' => ' . $error['message'] . "\n";
147
+			echo "\tT1:" . ($error['message'] == $message);
148
+			echo "\n\tT2:" . ($error['fieldName'] == $fieldName);
149 149
 
150
-			if ($error['message'] == $message && $error['fieldName'] == $fieldName) {
150
+			if($error['message'] == $message && $error['fieldName'] == $fieldName) {
151 151
 				$found = true;
152 152
 				break;
153 153
 			}
Please login to merge, or discard this patch.