summaryrefslogtreecommitdiffstats
path: root/php-solarium-pr479.patch
blob: 4c9bcb3f4d97d71c73ee355149cf83650d916555 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
From 188b80f45facf9f8c4ad584b12ff7c62a569e8ed Mon Sep 17 00:00:00 2001
From: Remi Collet <fedora@famillecollet.com>
Date: Thu, 2 Feb 2017 12:58:32 +0100
Subject: [PATCH] fix for PHP 5.3 (as still set as supported)

---
 library/Solarium/Core/Client/Adapter/Guzzle3.php   |  8 +--
 .../Select/ResponseParser/Component/Grouping.php   |  2 +-
 .../Tests/Core/Client/Adapter/Guzzle3Test.php      | 38 ++++++-------
 .../Tests/Core/Client/Adapter/GuzzleTest.php       | 62 +++++++++++-----------
 4 files changed, 55 insertions(+), 55 deletions(-)

diff --git a/library/Solarium/Core/Client/Adapter/Guzzle3.php b/library/Solarium/Core/Client/Adapter/Guzzle3.php
index 752141f..fa5b7db 100644
--- a/library/Solarium/Core/Client/Adapter/Guzzle3.php
+++ b/library/Solarium/Core/Client/Adapter/Guzzle3.php
@@ -74,10 +74,10 @@ public function execute($request, $endpoint)
             $endpoint->getBaseUri() . $request->getUri(),
             $this->getRequestHeaders($request),
             $this->getRequestBody($request),
-            [
+            array(
                 'timeout' => $endpoint->getTimeout(),
                 'connecttimeout' => $endpoint->getTimeout(),
-            ]
+            )
         );
 
         // Try endpoint authentication first, fallback to request for backwards compatibility
@@ -96,7 +96,7 @@ public function execute($request, $endpoint)
             $guzzleResponse = $guzzleRequest->getResponse();
 
             $responseHeaders = array_merge(
-                ["HTTP/1.1 {$guzzleResponse->getStatusCode()} {$guzzleResponse->getReasonPhrase()}"],
+                array("HTTP/1.1 {$guzzleResponse->getStatusCode()} {$guzzleResponse->getReasonPhrase()}"),
                 $guzzleResponse->getHeaderLines()
             );
 
@@ -155,7 +155,7 @@ private function getRequestBody(Request $request)
      */
     private function getRequestHeaders(Request $request)
     {
-        $headers = [];
+        $headers = array();
         foreach ($request->getHeaders() as $headerLine) {
             list($header, $value) = explode(':', $headerLine);
             if ($header = trim($header)) {
diff --git a/library/Solarium/QueryType/Select/ResponseParser/Component/Grouping.php b/library/Solarium/QueryType/Select/ResponseParser/Component/Grouping.php
index b365e75..27be278 100644
--- a/library/Solarium/QueryType/Select/ResponseParser/Component/Grouping.php
+++ b/library/Solarium/QueryType/Select/ResponseParser/Component/Grouping.php
@@ -82,7 +82,7 @@ public function parse($query, $grouping, $data)
             $matches = (isset($result['matches'])) ? $result['matches'] : null;
             $groupCount = (isset($result['ngroups'])) ? $result['ngroups'] : null;
             if ($grouping->getFormat() === GroupingComponent::FORMAT_SIMPLE) {
-                $valueGroups = [$this->extractValueGroup($valueResultClass, $documentClass, $result, $query)];
+                $valueGroups = array($this->extractValueGroup($valueResultClass, $documentClass, $result, $query));
                 $groups[$field] = new FieldGroup($matches, $groupCount, $valueGroups);
                 continue;
             }
diff --git a/tests/Solarium/Tests/Core/Client/Adapter/Guzzle3Test.php b/tests/Solarium/Tests/Core/Client/Adapter/Guzzle3Test.php
index 0133fc3..9976d32 100644
--- a/tests/Solarium/Tests/Core/Client/Adapter/Guzzle3Test.php
+++ b/tests/Solarium/Tests/Core/Client/Adapter/Guzzle3Test.php
@@ -91,11 +91,11 @@ public function executeGet()
         $this->assertSame('OK', $response->getStatusMessage());
         $this->assertSame('200', $response->getStatusCode());
         $this->assertSame(
-            [
+            array(
                 'HTTP/1.1 200 OK',
                 'Content-Type: application/json',
                 'X-PHPUnit: response value',
-            ],
+            ),
             $response->getHeaders()
         );
         $this->assertSame($guzzleResponse->getBody(true), $response->getBody());
@@ -138,11 +138,11 @@ public function executePostWithFile()
         $this->assertSame('OK', $response->getStatusMessage());
         $this->assertSame('200', $response->getStatusCode());
         $this->assertSame(
-            [
+            array(
                 'HTTP/1.1 200 OK',
                 'Content-Type: application/json',
                 'X-PHPUnit: response value',
-            ],
+            ),
             $response->getHeaders()
         );
         $this->assertSame($guzzleResponse->getBody(true), $response->getBody());
@@ -187,11 +187,11 @@ public function executePostWithRawBody()
         $this->assertSame('OK', $response->getStatusMessage());
         $this->assertSame('200', $response->getStatusCode());
         $this->assertSame(
-            [
+            array(
                 'HTTP/1.1 200 OK',
                 'Content-Type: application/json',
                 'X-PHPUnit: response value',
-            ],
+            ),
             $response->getHeaders()
         );
         $this->assertSame($guzzleResponse->getBody(true), $response->getBody());
@@ -239,11 +239,11 @@ public function executeGetWithAuthentication()
         $this->assertSame('OK', $response->getStatusMessage());
         $this->assertSame('200', $response->getStatusCode());
         $this->assertSame(
-            [
+            array(
                 'HTTP/1.1 200 OK',
                 'Content-Type: application/json',
                 'X-PHPUnit: response value',
-            ],
+            ),
             $response->getHeaders()
         );
         $this->assertSame($guzzleResponse->getBody(true), $response->getBody());
@@ -280,9 +280,9 @@ public function executeRequestException()
         $request->setMethod(Request::METHOD_GET);
 
         $endpoint = new Endpoint(
-            [
+            array(
                 'scheme'  => 'silly', //invalid protocol
-            ]
+            )
         );
 
         $this->adapter->execute($request, $endpoint);
@@ -296,12 +296,12 @@ public function executeRequestException()
     private function getValidResponse()
     {
         $body = json_encode(
-            [
-                'response' => [
+            array(
+                'response' => array(
                     'numFound' => 10,
                     'start' => 0,
-                    'docs' => [
-                        [
+                    'docs' => array(
+                        array(
                             'id' => '58339e95d5200',
                             'author' => 'Gambardella, Matthew',
                             'title' => "XML Developer's Guide",
@@ -309,13 +309,13 @@ private function getValidResponse()
                             'price' => 44.95,
                             'published' => 970372800,
                             'description' => 'An in-depth look at creating applications with XML.',
-                        ],
-                    ],
-                ],
-            ]
+                        ),
+                    ),
+                ),
+            )
         );
 
-        $headers = ['Content-Type' => 'application/json', 'X-PHPUnit' => 'response value'];
+        $headers = array('Content-Type' => 'application/json', 'X-PHPUnit' => 'response value');
         return new Response(200, $headers, $body);
     }
 }
diff --git a/tests/Solarium/Tests/Core/Client/Adapter/GuzzleTest.php b/tests/Solarium/Tests/Core/Client/Adapter/GuzzleTest.php
index dbc526c..2b6fdd4 100644
--- a/tests/Solarium/Tests/Core/Client/Adapter/GuzzleTest.php
+++ b/tests/Solarium/Tests/Core/Client/Adapter/GuzzleTest.php
@@ -75,15 +75,15 @@ public function setUp()
     public function executeGet()
     {
         $guzzleResponse = $this->getValidResponse();
-        $mockHandler = new MockHandler([$guzzleResponse]);
+        $mockHandler = new MockHandler(array($guzzleResponse));
 
-        $container = [];
+        $container = array();
         $history = Middleware::history($container);
 
         $stack = HandlerStack::create($mockHandler);
         $stack->push($history);
 
-        $adapter = new GuzzleAdapter(['handler' => $stack]);
+        $adapter = new GuzzleAdapter(array('handler' => $stack));
 
         $request = new Request();
         $request->setMethod(Request::METHOD_GET);
@@ -96,11 +96,11 @@ public function executeGet()
         $this->assertSame('OK', $response->getStatusMessage());
         $this->assertSame('200', $response->getStatusCode());
         $this->assertSame(
-            [
+            array(
                 'HTTP/1.1 200 OK',
                 'Content-Type: application/json',
                 'X-PHPUnit: response value',
-            ],
+            ),
             $response->getHeaders()
         );
         $this->assertSame((string)$guzzleResponse->getBody(), $response->getBody());
@@ -121,15 +121,15 @@ public function executeGet()
     public function executePostWithFile()
     {
         $guzzleResponse = $this->getValidResponse();
-        $mockHandler = new MockHandler([$guzzleResponse]);
+        $mockHandler = new MockHandler(array($guzzleResponse));
 
-        $container = [];
+        $container = array();
         $history = Middleware::history($container);
 
         $stack = HandlerStack::create($mockHandler);
         $stack->push($history);
 
-        $adapter = new GuzzleAdapter(['handler' => $stack]);
+        $adapter = new GuzzleAdapter(array('handler' => $stack));
 
         $request = new Request();
         $request->setMethod(Request::METHOD_POST);
@@ -143,11 +143,11 @@ public function executePostWithFile()
         $this->assertSame('OK', $response->getStatusMessage());
         $this->assertSame('200', $response->getStatusCode());
         $this->assertSame(
-            [
+            array(
                 'HTTP/1.1 200 OK',
                 'Content-Type: application/json',
                 'X-PHPUnit: response value',
-            ],
+            ),
             $response->getHeaders()
         );
         $this->assertSame((string)$guzzleResponse->getBody(), $response->getBody());
@@ -169,15 +169,15 @@ public function executePostWithFile()
     public function executePostWithRawBody()
     {
         $guzzleResponse = $this->getValidResponse();
-        $mockHandler = new MockHandler([$guzzleResponse]);
+        $mockHandler = new MockHandler(array($guzzleResponse));
 
-        $container = [];
+        $container = array();
         $history = Middleware::history($container);
 
         $stack = HandlerStack::create($mockHandler);
         $stack->push($history);
 
-        $adapter = new GuzzleAdapter(['handler' => $stack]);
+        $adapter = new GuzzleAdapter(array('handler' => $stack));
 
         $request = new Request();
         $request->setMethod(Request::METHOD_POST);
@@ -192,11 +192,11 @@ public function executePostWithRawBody()
         $this->assertSame('OK', $response->getStatusMessage());
         $this->assertSame('200', $response->getStatusCode());
         $this->assertSame(
-            [
+            array(
                 'HTTP/1.1 200 OK',
                 'Content-Type: application/json',
                 'X-PHPUnit: response value',
-            ],
+            ),
             $response->getHeaders()
         );
         $this->assertSame((string)$guzzleResponse->getBody(), $response->getBody());
@@ -219,15 +219,15 @@ public function executePostWithRawBody()
     public function executeGetWithAuthentication()
     {
         $guzzleResponse = $this->getValidResponse();
-        $mockHandler = new MockHandler([$guzzleResponse]);
+        $mockHandler = new MockHandler(array($guzzleResponse));
 
-        $container = [];
+        $container = array();
         $history = Middleware::history($container);
 
         $stack = HandlerStack::create($mockHandler);
         $stack->push($history);
 
-        $adapter = new GuzzleAdapter(['handler' => $stack]);
+        $adapter = new GuzzleAdapter(array('handler' => $stack));
 
         $request = new Request();
         $request->setMethod(Request::METHOD_GET);
@@ -241,11 +241,11 @@ public function executeGetWithAuthentication()
         $this->assertSame('OK', $response->getStatusMessage());
         $this->assertSame('200', $response->getStatusCode());
         $this->assertSame(
-            [
+            array(
                 'HTTP/1.1 200 OK',
                 'Content-Type: application/json',
                 'X-PHPUnit: response value',
-            ],
+            ),
             $response->getHeaders()
         );
         $this->assertSame((string)$guzzleResponse->getBody(), $response->getBody());
@@ -277,9 +277,9 @@ public function executeRequestException()
         $request->setMethod(Request::METHOD_GET);
 
         $endpoint = new Endpoint(
-            [
+            array(
                 'scheme'  => 'silly', //invalid protocol
-            ]
+            )
         );
         $endpoint->setTimeout(10);
 
@@ -294,12 +294,12 @@ public function executeRequestException()
     private function getValidResponse()
     {
         $body = json_encode(
-            [
-                'response' => [
+            array(
+                'response' => array(
                     'numFound' => 10,
                     'start' => 0,
-                    'docs' => [
-                        [
+                    'docs' => array(
+                        array(
                             'id' => '58339e95d5200',
                             'author' => 'Gambardella, Matthew',
                             'title' => "XML Developer's Guide",
@@ -307,13 +307,13 @@ private function getValidResponse()
                             'price' => 44.95,
                             'published' => 970372800,
                             'description' => 'An in-depth look at creating applications with XML.',
-                        ],
-                    ],
-                ],
-            ]
+                        ),
+                    ),
+                ),
+            )
         );
 
-        $headers = ['Content-Type' => 'application/json', 'X-PHPUnit' => 'response value'];
+        $headers = array('Content-Type' => 'application/json', 'X-PHPUnit' => 'response value');
         return new Response(200, $headers, $body);
     }
 }