@@ -47,9 +47,9 @@ discard block |
||
| 47 | 47 | $return = array('status' => 200); |
| 48 | 48 | |
| 49 | 49 | $stub->expects($this->once()) |
| 50 | - ->method('performRequest') |
|
| 51 | - ->with('HEAD', '', null, null, $options) |
|
| 52 | - ->will($this->returnValue($return)); |
|
| 50 | + ->method('performRequest') |
|
| 51 | + ->with('HEAD', '', null, null, $options) |
|
| 52 | + ->will($this->returnValue($return)); |
|
| 53 | 53 | |
| 54 | 54 | /** @var AbstractConnection $stub */ |
| 55 | 55 | $ret = $stub->ping(); |
@@ -75,9 +75,9 @@ discard block |
||
| 75 | 75 | $return = array('status' => 400); |
| 76 | 76 | |
| 77 | 77 | $stub->expects($this->once()) |
| 78 | - ->method('performRequest') |
|
| 79 | - ->with('HEAD', '', null, null, $options) |
|
| 80 | - ->will($this->returnValue($return)); |
|
| 78 | + ->method('performRequest') |
|
| 79 | + ->with('HEAD', '', null, null, $options) |
|
| 80 | + ->will($this->returnValue($return)); |
|
| 81 | 81 | |
| 82 | 82 | /** @var AbstractConnection $stub */ |
| 83 | 83 | $ret = $stub->ping(); |
@@ -103,9 +103,9 @@ discard block |
||
| 103 | 103 | $return = array('status' => 400); |
| 104 | 104 | |
| 105 | 105 | $stub->expects($this->once()) |
| 106 | - ->method('performRequest') |
|
| 107 | - ->with('HEAD', '', null, null, $options) |
|
| 108 | - ->will($this->throwException(new Elasticsearch\Common\Exceptions\Curl\OperationTimeoutException())); |
|
| 106 | + ->method('performRequest') |
|
| 107 | + ->with('HEAD', '', null, null, $options) |
|
| 108 | + ->will($this->throwException(new Elasticsearch\Common\Exceptions\Curl\OperationTimeoutException())); |
|
| 109 | 109 | |
| 110 | 110 | /** @var AbstractConnection $stub */ |
| 111 | 111 | $ret = $stub->ping(); |
@@ -30,10 +30,10 @@ |
||
| 30 | 30 | |
| 31 | 31 | // Eww... |
| 32 | 32 | $mockPimple = m::mock('\Pimple\Container') |
| 33 | - ->shouldReceive('offsetGet')->with('connection')->andReturn($mockFunction)->getMock() |
|
| 34 | - ->shouldReceive('offsetGet')->with('connectionParamsShared')->andReturn(array())->getMock() |
|
| 35 | - ->shouldReceive('offsetGet')->with('logObject')->andReturn(array())->getMock() |
|
| 36 | - ->shouldReceive('offsetGet')->with('traceObject')->andReturn(array())->getMock(); |
|
| 33 | + ->shouldReceive('offsetGet')->with('connection')->andReturn($mockFunction)->getMock() |
|
| 34 | + ->shouldReceive('offsetGet')->with('connectionParamsShared')->andReturn(array())->getMock() |
|
| 35 | + ->shouldReceive('offsetGet')->with('logObject')->andReturn(array())->getMock() |
|
| 36 | + ->shouldReceive('offsetGet')->with('traceObject')->andReturn(array())->getMock(); |
|
| 37 | 37 | |
| 38 | 38 | $hostDetails = array( |
| 39 | 39 | 'host' => 'localhost', |
@@ -48,8 +48,8 @@ discard block |
||
| 48 | 48 | public function testSniffOnStart() |
| 49 | 49 | { |
| 50 | 50 | $log = $this->getMockBuilder('\Monolog\Logger') |
| 51 | - ->disableOriginalConstructor() |
|
| 52 | - ->getMock(); |
|
| 51 | + ->disableOriginalConstructor() |
|
| 52 | + ->getMock(); |
|
| 53 | 53 | |
| 54 | 54 | $hosts = array(array('host' => 'localhost')); |
| 55 | 55 | |
@@ -69,13 +69,13 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | // Eww... |
| 71 | 71 | $params = m::mock('\Pimple\Container') |
| 72 | - ->shouldReceive('offsetGet')->with('connectionPool')->andReturn($mockConnectionPoolFxn)->getMock() |
|
| 73 | - ->shouldReceive('offsetGet')->with('serializer')->andReturn($mockSerializer)->getMock() |
|
| 74 | - ->shouldReceive('offsetGet')->with('connection')->andReturn($mockConnectionFxn)->getMock() |
|
| 75 | - ->shouldReceive('offsetGet')->with('sniffOnStart')->andReturn(true)->getMock() |
|
| 76 | - ->shouldReceive('offsetExists')->with('retries')->andReturn(false)->getMock() |
|
| 77 | - ->shouldReceive('offsetSet')->with('retries', 0)->getMock() |
|
| 78 | - ->shouldReceive('offsetGet')->with('retries')->andReturn(1)->getMock(); |
|
| 72 | + ->shouldReceive('offsetGet')->with('connectionPool')->andReturn($mockConnectionPoolFxn)->getMock() |
|
| 73 | + ->shouldReceive('offsetGet')->with('serializer')->andReturn($mockSerializer)->getMock() |
|
| 74 | + ->shouldReceive('offsetGet')->with('connection')->andReturn($mockConnectionFxn)->getMock() |
|
| 75 | + ->shouldReceive('offsetGet')->with('sniffOnStart')->andReturn(true)->getMock() |
|
| 76 | + ->shouldReceive('offsetExists')->with('retries')->andReturn(false)->getMock() |
|
| 77 | + ->shouldReceive('offsetSet')->with('retries', 0)->getMock() |
|
| 78 | + ->shouldReceive('offsetGet')->with('retries')->andReturn(1)->getMock(); |
|
| 79 | 79 | |
| 80 | 80 | $transport = new Elasticsearch\Transport($hosts, $params, $log); |
| 81 | 81 | } |
@@ -83,13 +83,13 @@ discard block |
||
| 83 | 83 | public function testSetRetries() |
| 84 | 84 | { |
| 85 | 85 | $log = $this->getMockBuilder('\Monolog\Logger') |
| 86 | - ->disableOriginalConstructor() |
|
| 87 | - ->getMock(); |
|
| 86 | + ->disableOriginalConstructor() |
|
| 87 | + ->getMock(); |
|
| 88 | 88 | |
| 89 | 89 | $hosts = array(array('host' => 'localhost')); |
| 90 | 90 | |
| 91 | 91 | $mockConnectionPool = m::mock('\Elasticsearch\ConnectionPool\StaticConnectionPool') |
| 92 | - ->shouldReceive('scheduleCheck')->once()->getMock(); |
|
| 92 | + ->shouldReceive('scheduleCheck')->once()->getMock(); |
|
| 93 | 93 | |
| 94 | 94 | $mockConnectionPoolFxn = function($connections) use ($mockConnectionPool) { |
| 95 | 95 | return $mockConnectionPool; |
@@ -104,12 +104,12 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | // Eww... |
| 106 | 106 | $params = m::mock('\Pimple\Container') |
| 107 | - ->shouldReceive('offsetGet')->with('connectionPool')->andReturn($mockConnectionPoolFxn)->getMock() |
|
| 108 | - ->shouldReceive('offsetGet')->with('serializer')->andReturn($mockSerializer)->getMock() |
|
| 109 | - ->shouldReceive('offsetGet')->with('connection')->andReturn($mockConnectionFxn)->getMock() |
|
| 110 | - ->shouldReceive('offsetGet')->with('sniffOnStart')->andReturn(true)->getMock() |
|
| 111 | - ->shouldReceive('offsetExists')->with('retries')->andReturn(true)->getMock() |
|
| 112 | - ->shouldReceive('offsetGet')->with('retries')->andReturn(2)->getMock(); |
|
| 107 | + ->shouldReceive('offsetGet')->with('connectionPool')->andReturn($mockConnectionPoolFxn)->getMock() |
|
| 108 | + ->shouldReceive('offsetGet')->with('serializer')->andReturn($mockSerializer)->getMock() |
|
| 109 | + ->shouldReceive('offsetGet')->with('connection')->andReturn($mockConnectionFxn)->getMock() |
|
| 110 | + ->shouldReceive('offsetGet')->with('sniffOnStart')->andReturn(true)->getMock() |
|
| 111 | + ->shouldReceive('offsetExists')->with('retries')->andReturn(true)->getMock() |
|
| 112 | + ->shouldReceive('offsetGet')->with('retries')->andReturn(2)->getMock(); |
|
| 113 | 113 | |
| 114 | 114 | $transport = new Elasticsearch\Transport($hosts, $params, $log); |
| 115 | 115 | } |
@@ -117,13 +117,13 @@ discard block |
||
| 117 | 117 | public function testNoSniffOnStart() |
| 118 | 118 | { |
| 119 | 119 | $log = $this->getMockBuilder('\Monolog\Logger') |
| 120 | - ->disableOriginalConstructor() |
|
| 121 | - ->getMock(); |
|
| 120 | + ->disableOriginalConstructor() |
|
| 121 | + ->getMock(); |
|
| 122 | 122 | |
| 123 | 123 | $hosts = array(array('host' => 'localhost')); |
| 124 | 124 | |
| 125 | 125 | $mockConnectionPool = m::mock('\Elasticsearch\ConnectionPool\StaticConnectionPool') |
| 126 | - ->shouldReceive('scheduleCheck')->never()->getMock(); |
|
| 126 | + ->shouldReceive('scheduleCheck')->never()->getMock(); |
|
| 127 | 127 | $mockConnectionPoolFxn = function($connections) use ($mockConnectionPool) { |
| 128 | 128 | return $mockConnectionPool; |
| 129 | 129 | }; |
@@ -137,13 +137,13 @@ discard block |
||
| 137 | 137 | |
| 138 | 138 | // Eww... |
| 139 | 139 | $params = m::mock('\Pimple\Container') |
| 140 | - ->shouldReceive('offsetGet')->with('connectionPool')->andReturn($mockConnectionPoolFxn)->getMock() |
|
| 141 | - ->shouldReceive('offsetGet')->with('serializer')->andReturn($mockSerializer)->getMock() |
|
| 142 | - ->shouldReceive('offsetGet')->with('connection')->andReturn($mockConnectionFxn)->getMock() |
|
| 143 | - ->shouldReceive('offsetGet')->with('sniffOnStart')->andReturn(false)->getMock() |
|
| 144 | - ->shouldReceive('offsetExists')->with('retries')->andReturn(false)->getMock() |
|
| 145 | - ->shouldReceive('offsetSet')->with('retries', 0)->getMock() |
|
| 146 | - ->shouldReceive('offsetGet')->with('retries')->andReturn(1)->getMock(); |
|
| 140 | + ->shouldReceive('offsetGet')->with('connectionPool')->andReturn($mockConnectionPoolFxn)->getMock() |
|
| 141 | + ->shouldReceive('offsetGet')->with('serializer')->andReturn($mockSerializer)->getMock() |
|
| 142 | + ->shouldReceive('offsetGet')->with('connection')->andReturn($mockConnectionFxn)->getMock() |
|
| 143 | + ->shouldReceive('offsetGet')->with('sniffOnStart')->andReturn(false)->getMock() |
|
| 144 | + ->shouldReceive('offsetExists')->with('retries')->andReturn(false)->getMock() |
|
| 145 | + ->shouldReceive('offsetSet')->with('retries', 0)->getMock() |
|
| 146 | + ->shouldReceive('offsetGet')->with('retries')->andReturn(1)->getMock(); |
|
| 147 | 147 | |
| 148 | 148 | $transport = new Elasticsearch\Transport($hosts, $params, $log); |
| 149 | 149 | } |
@@ -151,13 +151,13 @@ discard block |
||
| 151 | 151 | public function testMixedHosts() |
| 152 | 152 | { |
| 153 | 153 | $log = $this->getMockBuilder('\Monolog\Logger') |
| 154 | - ->disableOriginalConstructor() |
|
| 155 | - ->getMock(); |
|
| 154 | + ->disableOriginalConstructor() |
|
| 155 | + ->getMock(); |
|
| 156 | 156 | |
| 157 | 157 | $hosts = array(array('host' => 'localhost'), array('host' => 'localhost', 'port' => 9200)); |
| 158 | 158 | |
| 159 | 159 | $mockConnectionPool = m::mock('\Elasticsearch\ConnectionPool\StaticConnectionPool') |
| 160 | - ->shouldReceive('scheduleCheck')->never()->getMock(); |
|
| 160 | + ->shouldReceive('scheduleCheck')->never()->getMock(); |
|
| 161 | 161 | $mockConnectionPoolFxn = function($connections) use ($mockConnectionPool) { |
| 162 | 162 | return $mockConnectionPool; |
| 163 | 163 | }; |
@@ -171,13 +171,13 @@ discard block |
||
| 171 | 171 | |
| 172 | 172 | // Eww... |
| 173 | 173 | $params = m::mock('\Pimple\Container') |
| 174 | - ->shouldReceive('offsetGet')->with('connectionPool')->andReturn($mockConnectionPoolFxn)->getMock() |
|
| 175 | - ->shouldReceive('offsetGet')->with('serializer')->andReturn($mockSerializer)->getMock() |
|
| 176 | - ->shouldReceive('offsetGet')->with('connection')->andReturn($mockConnectionFxn)->getMock() |
|
| 177 | - ->shouldReceive('offsetGet')->with('sniffOnStart')->andReturn(false)->getMock() |
|
| 178 | - ->shouldReceive('offsetExists')->with('retries')->andReturn(false)->getMock() |
|
| 179 | - ->shouldReceive('offsetSet')->with('retries', 1)->getMock() |
|
| 180 | - ->shouldReceive('offsetGet')->with('retries')->andReturn(2)->getMock(); |
|
| 174 | + ->shouldReceive('offsetGet')->with('connectionPool')->andReturn($mockConnectionPoolFxn)->getMock() |
|
| 175 | + ->shouldReceive('offsetGet')->with('serializer')->andReturn($mockSerializer)->getMock() |
|
| 176 | + ->shouldReceive('offsetGet')->with('connection')->andReturn($mockConnectionFxn)->getMock() |
|
| 177 | + ->shouldReceive('offsetGet')->with('sniffOnStart')->andReturn(false)->getMock() |
|
| 178 | + ->shouldReceive('offsetExists')->with('retries')->andReturn(false)->getMock() |
|
| 179 | + ->shouldReceive('offsetSet')->with('retries', 1)->getMock() |
|
| 180 | + ->shouldReceive('offsetGet')->with('retries')->andReturn(2)->getMock(); |
|
| 181 | 181 | |
| 182 | 182 | $transport = new Elasticsearch\Transport($hosts, $params, $log); |
| 183 | 183 | } |
@@ -185,8 +185,8 @@ discard block |
||
| 185 | 185 | public function testPerformRequestNoBody() |
| 186 | 186 | { |
| 187 | 187 | $log = $this->getMockBuilder('\Monolog\Logger') |
| 188 | - ->disableOriginalConstructor() |
|
| 189 | - ->getMock(); |
|
| 188 | + ->disableOriginalConstructor() |
|
| 189 | + ->getMock(); |
|
| 190 | 190 | |
| 191 | 191 | $hosts = array(array('host' => 'localhost')); |
| 192 | 192 | $method = 'GET'; |
@@ -200,34 +200,34 @@ discard block |
||
| 200 | 200 | ); |
| 201 | 201 | |
| 202 | 202 | $mockConnection = m::mock('\Elasticsearch\Connections\AbstractConnection') |
| 203 | - ->shouldReceive('performRequest')->once()->with($method, $uri, $params, $body)->andReturn($response)->getMock() |
|
| 204 | - ->shouldReceive('markAlive')->once()->getMock(); |
|
| 203 | + ->shouldReceive('performRequest')->once()->with($method, $uri, $params, $body)->andReturn($response)->getMock() |
|
| 204 | + ->shouldReceive('markAlive')->once()->getMock(); |
|
| 205 | 205 | |
| 206 | 206 | $mockConnectionFxn = function($host, $port=null) use ($mockConnection) { |
| 207 | 207 | return $mockConnection; |
| 208 | 208 | }; |
| 209 | 209 | |
| 210 | 210 | $mockConnectionPool = m::mock('\Elasticsearch\ConnectionPool\StaticConnectionPool') |
| 211 | - ->shouldReceive('scheduleCheck')->never()->getMock() |
|
| 212 | - ->shouldReceive('nextConnection')->andReturn($mockConnection)->getMock(); |
|
| 211 | + ->shouldReceive('scheduleCheck')->never()->getMock() |
|
| 212 | + ->shouldReceive('nextConnection')->andReturn($mockConnection)->getMock(); |
|
| 213 | 213 | $mockConnectionPoolFxn = function($connections) use ($mockConnectionPool) { |
| 214 | 214 | return $mockConnectionPool; |
| 215 | 215 | }; |
| 216 | 216 | |
| 217 | 217 | $mockSerializer = m::mock('\Elasticsearch\Serializers\SerializerInterface') |
| 218 | - ->shouldReceive('deserialize')->with($response['text'], array())->andReturn('out')->getMock(); |
|
| 218 | + ->shouldReceive('deserialize')->with($response['text'], array())->andReturn('out')->getMock(); |
|
| 219 | 219 | |
| 220 | 220 | |
| 221 | 221 | |
| 222 | 222 | // Eww... |
| 223 | 223 | $pimple = m::mock('\Pimple\Container') |
| 224 | - ->shouldReceive('offsetGet')->with('connectionPool')->andReturn($mockConnectionPoolFxn)->getMock() |
|
| 225 | - ->shouldReceive('offsetGet')->with('serializer')->andReturn($mockSerializer)->getMock() |
|
| 226 | - ->shouldReceive('offsetGet')->with('connection')->andReturn($mockConnectionFxn)->getMock() |
|
| 227 | - ->shouldReceive('offsetGet')->with('sniffOnStart')->andReturn(false)->getMock() |
|
| 228 | - ->shouldReceive('offsetExists')->with('retries')->andReturn(false)->getMock() |
|
| 229 | - ->shouldReceive('offsetSet')->with('retries', 0)->getMock() |
|
| 230 | - ->shouldReceive('offsetGet')->with('retries')->andReturn(1)->getMock(); |
|
| 224 | + ->shouldReceive('offsetGet')->with('connectionPool')->andReturn($mockConnectionPoolFxn)->getMock() |
|
| 225 | + ->shouldReceive('offsetGet')->with('serializer')->andReturn($mockSerializer)->getMock() |
|
| 226 | + ->shouldReceive('offsetGet')->with('connection')->andReturn($mockConnectionFxn)->getMock() |
|
| 227 | + ->shouldReceive('offsetGet')->with('sniffOnStart')->andReturn(false)->getMock() |
|
| 228 | + ->shouldReceive('offsetExists')->with('retries')->andReturn(false)->getMock() |
|
| 229 | + ->shouldReceive('offsetSet')->with('retries', 0)->getMock() |
|
| 230 | + ->shouldReceive('offsetGet')->with('retries')->andReturn(1)->getMock(); |
|
| 231 | 231 | |
| 232 | 232 | $transport = new Elasticsearch\Transport($hosts, $pimple, $log); |
| 233 | 233 | $ret = $transport->performRequest($method, $uri, $params, $body); |
@@ -245,8 +245,8 @@ discard block |
||
| 245 | 245 | public function testPerformRequestWithBody() |
| 246 | 246 | { |
| 247 | 247 | $log = $this->getMockBuilder('\Monolog\Logger') |
| 248 | - ->disableOriginalConstructor() |
|
| 249 | - ->getMock(); |
|
| 248 | + ->disableOriginalConstructor() |
|
| 249 | + ->getMock(); |
|
| 250 | 250 | |
| 251 | 251 | $hosts = array(array('host' => 'localhost')); |
| 252 | 252 | $method = 'GET'; |
@@ -262,35 +262,35 @@ discard block |
||
| 262 | 262 | |
| 263 | 263 | |
| 264 | 264 | $mockConnection = m::mock('\Elasticsearch\Connections\AbstractConnection') |
| 265 | - ->shouldReceive('performRequest')->once()->with($method, $uri, $params, $serializedBody)->andReturn($response)->getMock() |
|
| 266 | - ->shouldReceive('markAlive')->once()->getMock(); |
|
| 265 | + ->shouldReceive('performRequest')->once()->with($method, $uri, $params, $serializedBody)->andReturn($response)->getMock() |
|
| 266 | + ->shouldReceive('markAlive')->once()->getMock(); |
|
| 267 | 267 | |
| 268 | 268 | $mockConnectionFxn = function($host, $port=null) use ($mockConnection) { |
| 269 | 269 | return $mockConnection; |
| 270 | 270 | }; |
| 271 | 271 | |
| 272 | 272 | $mockConnectionPool = m::mock('\Elasticsearch\ConnectionPool\StaticConnectionPool') |
| 273 | - ->shouldReceive('scheduleCheck')->never()->getMock() |
|
| 274 | - ->shouldReceive('nextConnection')->andReturn($mockConnection)->getMock(); |
|
| 273 | + ->shouldReceive('scheduleCheck')->never()->getMock() |
|
| 274 | + ->shouldReceive('nextConnection')->andReturn($mockConnection)->getMock(); |
|
| 275 | 275 | $mockConnectionPoolFxn = function($connections) use ($mockConnectionPool) { |
| 276 | 276 | return $mockConnectionPool; |
| 277 | 277 | }; |
| 278 | 278 | |
| 279 | 279 | $mockSerializer = m::mock('\Elasticsearch\Serializers\SerializerInterface') |
| 280 | - ->shouldReceive('serialize')->with($body)->andReturn($serializedBody)->getMock() |
|
| 281 | - ->shouldReceive('deserialize')->with($response['text'], array())->andReturn('out_deserialize')->getMock(); |
|
| 280 | + ->shouldReceive('serialize')->with($body)->andReturn($serializedBody)->getMock() |
|
| 281 | + ->shouldReceive('deserialize')->with($response['text'], array())->andReturn('out_deserialize')->getMock(); |
|
| 282 | 282 | |
| 283 | 283 | |
| 284 | 284 | |
| 285 | 285 | // Eww... |
| 286 | 286 | $pimple = m::mock('\Pimple\Container') |
| 287 | - ->shouldReceive('offsetGet')->with('connectionPool')->andReturn($mockConnectionPoolFxn)->getMock() |
|
| 288 | - ->shouldReceive('offsetGet')->with('serializer')->andReturn($mockSerializer)->getMock() |
|
| 289 | - ->shouldReceive('offsetGet')->with('connection')->andReturn($mockConnectionFxn)->getMock() |
|
| 290 | - ->shouldReceive('offsetGet')->with('sniffOnStart')->andReturn(false)->getMock() |
|
| 291 | - ->shouldReceive('offsetExists')->with('retries')->andReturn(false)->getMock() |
|
| 292 | - ->shouldReceive('offsetSet')->with('retries', 0)->getMock() |
|
| 293 | - ->shouldReceive('offsetGet')->with('retries')->andReturn(1)->getMock(); |
|
| 287 | + ->shouldReceive('offsetGet')->with('connectionPool')->andReturn($mockConnectionPoolFxn)->getMock() |
|
| 288 | + ->shouldReceive('offsetGet')->with('serializer')->andReturn($mockSerializer)->getMock() |
|
| 289 | + ->shouldReceive('offsetGet')->with('connection')->andReturn($mockConnectionFxn)->getMock() |
|
| 290 | + ->shouldReceive('offsetGet')->with('sniffOnStart')->andReturn(false)->getMock() |
|
| 291 | + ->shouldReceive('offsetExists')->with('retries')->andReturn(false)->getMock() |
|
| 292 | + ->shouldReceive('offsetSet')->with('retries', 0)->getMock() |
|
| 293 | + ->shouldReceive('offsetGet')->with('retries')->andReturn(1)->getMock(); |
|
| 294 | 294 | |
| 295 | 295 | $transport = new Elasticsearch\Transport($hosts, $pimple, $log); |
| 296 | 296 | $ret = $transport->performRequest($method, $uri, $params, $body); |
@@ -307,8 +307,8 @@ discard block |
||
| 307 | 307 | public function testPerformRequestTimeout() |
| 308 | 308 | { |
| 309 | 309 | $log = $this->getMockBuilder('\Monolog\Logger') |
| 310 | - ->disableOriginalConstructor() |
|
| 311 | - ->getMock(); |
|
| 310 | + ->disableOriginalConstructor() |
|
| 311 | + ->getMock(); |
|
| 312 | 312 | |
| 313 | 313 | $hosts = array(array('host' => 'localhost')); |
| 314 | 314 | $method = 'GET'; |
@@ -322,35 +322,35 @@ discard block |
||
| 322 | 322 | ); |
| 323 | 323 | |
| 324 | 324 | $mockConnection = m::mock('\Elasticsearch\Connections\AbstractConnection') |
| 325 | - ->shouldReceive('performRequest')->once()->with($method, $uri, $params, $body)->andThrow(new Elasticsearch\Common\Exceptions\Curl\OperationTimeoutException())->getMock() |
|
| 326 | - ->shouldReceive('performRequest')->once()->with($method, $uri, $params, $body)->andReturn($response)->getMock() |
|
| 327 | - ->shouldReceive('markAlive')->once()->getMock(); |
|
| 325 | + ->shouldReceive('performRequest')->once()->with($method, $uri, $params, $body)->andThrow(new Elasticsearch\Common\Exceptions\Curl\OperationTimeoutException())->getMock() |
|
| 326 | + ->shouldReceive('performRequest')->once()->with($method, $uri, $params, $body)->andReturn($response)->getMock() |
|
| 327 | + ->shouldReceive('markAlive')->once()->getMock(); |
|
| 328 | 328 | |
| 329 | 329 | $mockConnectionFxn = function($host, $port=null) use ($mockConnection) { |
| 330 | 330 | return $mockConnection; |
| 331 | 331 | }; |
| 332 | 332 | |
| 333 | 333 | $mockConnectionPool = m::mock('\Elasticsearch\ConnectionPool\StaticConnectionPool') |
| 334 | - ->shouldReceive('scheduleCheck')->once()->getMock() |
|
| 335 | - ->shouldReceive('nextConnection')->twice()->andReturn($mockConnection)->getMock(); |
|
| 334 | + ->shouldReceive('scheduleCheck')->once()->getMock() |
|
| 335 | + ->shouldReceive('nextConnection')->twice()->andReturn($mockConnection)->getMock(); |
|
| 336 | 336 | $mockConnectionPoolFxn = function($connections) use ($mockConnectionPool) { |
| 337 | 337 | return $mockConnectionPool; |
| 338 | 338 | }; |
| 339 | 339 | |
| 340 | 340 | $mockSerializer = m::mock('\Elasticsearch\Serializers\SerializerInterface') |
| 341 | - ->shouldReceive('deserialize')->with($response['text'], array())->andReturn('out')->getMock(); |
|
| 341 | + ->shouldReceive('deserialize')->with($response['text'], array())->andReturn('out')->getMock(); |
|
| 342 | 342 | |
| 343 | 343 | |
| 344 | 344 | |
| 345 | 345 | // Eww... |
| 346 | 346 | $pimple = m::mock('\Pimple\Container') |
| 347 | - ->shouldReceive('offsetGet')->with('connectionPool')->andReturn($mockConnectionPoolFxn)->getMock() |
|
| 348 | - ->shouldReceive('offsetGet')->with('serializer')->andReturn($mockSerializer)->getMock() |
|
| 349 | - ->shouldReceive('offsetGet')->with('connection')->andReturn($mockConnectionFxn)->getMock() |
|
| 350 | - ->shouldReceive('offsetGet')->with('sniffOnStart')->andReturn(false)->getMock() |
|
| 351 | - ->shouldReceive('offsetExists')->with('retries')->andReturn(false)->getMock() |
|
| 352 | - ->shouldReceive('offsetSet')->with('retries', 0)->getMock() |
|
| 353 | - ->shouldReceive('offsetGet')->with('retries')->andReturn(1)->getMock(); |
|
| 347 | + ->shouldReceive('offsetGet')->with('connectionPool')->andReturn($mockConnectionPoolFxn)->getMock() |
|
| 348 | + ->shouldReceive('offsetGet')->with('serializer')->andReturn($mockSerializer)->getMock() |
|
| 349 | + ->shouldReceive('offsetGet')->with('connection')->andReturn($mockConnectionFxn)->getMock() |
|
| 350 | + ->shouldReceive('offsetGet')->with('sniffOnStart')->andReturn(false)->getMock() |
|
| 351 | + ->shouldReceive('offsetExists')->with('retries')->andReturn(false)->getMock() |
|
| 352 | + ->shouldReceive('offsetSet')->with('retries', 0)->getMock() |
|
| 353 | + ->shouldReceive('offsetGet')->with('retries')->andReturn(1)->getMock(); |
|
| 354 | 354 | |
| 355 | 355 | $transport = new Elasticsearch\Transport($hosts, $pimple, $log); |
| 356 | 356 | $ret = $transport->performRequest($method, $uri, $params, $body); |
@@ -371,8 +371,8 @@ discard block |
||
| 371 | 371 | public function testPerformRequestNoNodesAvailable() |
| 372 | 372 | { |
| 373 | 373 | $log = $this->getMockBuilder('\Monolog\Logger') |
| 374 | - ->disableOriginalConstructor() |
|
| 375 | - ->getMock(); |
|
| 374 | + ->disableOriginalConstructor() |
|
| 375 | + ->getMock(); |
|
| 376 | 376 | |
| 377 | 377 | $hosts = array(array('host' => 'localhost')); |
| 378 | 378 | $method = 'GET'; |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | }; |
| 393 | 393 | |
| 394 | 394 | $mockConnectionPool = m::mock('\Elasticsearch\ConnectionPool\StaticConnectionPool') |
| 395 | - ->shouldReceive('nextConnection')->once()->andThrow(new Elasticsearch\Common\Exceptions\NoNodesAvailableException())->getMock(); |
|
| 395 | + ->shouldReceive('nextConnection')->once()->andThrow(new Elasticsearch\Common\Exceptions\NoNodesAvailableException())->getMock(); |
|
| 396 | 396 | $mockConnectionPoolFxn = function($connections) use ($mockConnectionPool) { |
| 397 | 397 | return $mockConnectionPool; |
| 398 | 398 | }; |
@@ -401,13 +401,13 @@ discard block |
||
| 401 | 401 | |
| 402 | 402 | // Eww... |
| 403 | 403 | $pimple = m::mock('\Pimple\Container') |
| 404 | - ->shouldReceive('offsetGet')->with('connectionPool')->andReturn($mockConnectionPoolFxn)->getMock() |
|
| 405 | - ->shouldReceive('offsetGet')->with('connection')->andReturn($mockConnectionFxn)->getMock() |
|
| 406 | - ->shouldReceive('offsetGet')->with('serializer')->andReturn($mockSerializer)->getMock() |
|
| 407 | - ->shouldReceive('offsetGet')->with('sniffOnStart')->andReturn(false)->getMock() |
|
| 408 | - ->shouldReceive('offsetExists')->with('retries')->andReturn(false)->getMock() |
|
| 409 | - ->shouldReceive('offsetSet')->with('retries', 0)->getMock() |
|
| 410 | - ->shouldReceive('offsetGet')->with('retries')->andReturn(1)->getMock(); |
|
| 404 | + ->shouldReceive('offsetGet')->with('connectionPool')->andReturn($mockConnectionPoolFxn)->getMock() |
|
| 405 | + ->shouldReceive('offsetGet')->with('connection')->andReturn($mockConnectionFxn)->getMock() |
|
| 406 | + ->shouldReceive('offsetGet')->with('serializer')->andReturn($mockSerializer)->getMock() |
|
| 407 | + ->shouldReceive('offsetGet')->with('sniffOnStart')->andReturn(false)->getMock() |
|
| 408 | + ->shouldReceive('offsetExists')->with('retries')->andReturn(false)->getMock() |
|
| 409 | + ->shouldReceive('offsetSet')->with('retries', 0)->getMock() |
|
| 410 | + ->shouldReceive('offsetGet')->with('retries')->andReturn(1)->getMock(); |
|
| 411 | 411 | |
| 412 | 412 | $transport = new Elasticsearch\Transport($hosts, $pimple, $log); |
| 413 | 413 | $transport->performRequest($method, $uri, $params, $body); |
@@ -418,8 +418,8 @@ discard block |
||
| 418 | 418 | public function testPerformRequestTransportException() |
| 419 | 419 | { |
| 420 | 420 | $log = $this->getMockBuilder('\Monolog\Logger') |
| 421 | - ->disableOriginalConstructor() |
|
| 422 | - ->getMock(); |
|
| 421 | + ->disableOriginalConstructor() |
|
| 422 | + ->getMock(); |
|
| 423 | 423 | |
| 424 | 424 | $hosts = array(array('host' => 'localhost')); |
| 425 | 425 | $method = 'GET'; |
@@ -433,36 +433,36 @@ discard block |
||
| 433 | 433 | ); |
| 434 | 434 | |
| 435 | 435 | $mockConnection = m::mock('\Elasticsearch\Connections\AbstractConnection') |
| 436 | - ->shouldReceive('performRequest')->once()->with($method, $uri, $params, $body)->andThrow(new Elasticsearch\Common\Exceptions\TransportException())->getMock() |
|
| 437 | - ->shouldReceive('performRequest')->once()->with($method, $uri, $params, $body)->andReturn($response)->getMock() |
|
| 438 | - ->shouldReceive('markDead')->once()->getMock() |
|
| 439 | - ->shouldReceive('markAlive')->once()->getMock(); |
|
| 436 | + ->shouldReceive('performRequest')->once()->with($method, $uri, $params, $body)->andThrow(new Elasticsearch\Common\Exceptions\TransportException())->getMock() |
|
| 437 | + ->shouldReceive('performRequest')->once()->with($method, $uri, $params, $body)->andReturn($response)->getMock() |
|
| 438 | + ->shouldReceive('markDead')->once()->getMock() |
|
| 439 | + ->shouldReceive('markAlive')->once()->getMock(); |
|
| 440 | 440 | |
| 441 | 441 | $mockConnectionFxn = function($host, $port=null) use ($mockConnection) { |
| 442 | 442 | return $mockConnection; |
| 443 | 443 | }; |
| 444 | 444 | |
| 445 | 445 | $mockConnectionPool = m::mock('\Elasticsearch\ConnectionPool\StaticConnectionPool') |
| 446 | - ->shouldReceive('scheduleCheck')->once()->getMock() |
|
| 447 | - ->shouldReceive('nextConnection')->twice()->andReturn($mockConnection)->getMock(); |
|
| 446 | + ->shouldReceive('scheduleCheck')->once()->getMock() |
|
| 447 | + ->shouldReceive('nextConnection')->twice()->andReturn($mockConnection)->getMock(); |
|
| 448 | 448 | $mockConnectionPoolFxn = function($connections) use ($mockConnectionPool) { |
| 449 | 449 | return $mockConnectionPool; |
| 450 | 450 | }; |
| 451 | 451 | |
| 452 | 452 | $mockSerializer = m::mock('\Elasticsearch\Serializers\SerializerInterface') |
| 453 | - ->shouldReceive('deserialize')->with($response['text'], array())->andReturn('out')->getMock(); |
|
| 453 | + ->shouldReceive('deserialize')->with($response['text'], array())->andReturn('out')->getMock(); |
|
| 454 | 454 | |
| 455 | 455 | |
| 456 | 456 | |
| 457 | 457 | // Eww... |
| 458 | 458 | $pimple = m::mock('\Pimple\Container') |
| 459 | - ->shouldReceive('offsetGet')->with('connectionPool')->andReturn($mockConnectionPoolFxn)->getMock() |
|
| 460 | - ->shouldReceive('offsetGet')->with('serializer')->andReturn($mockSerializer)->getMock() |
|
| 461 | - ->shouldReceive('offsetGet')->with('connection')->andReturn($mockConnectionFxn)->getMock() |
|
| 462 | - ->shouldReceive('offsetGet')->with('sniffOnStart')->andReturn(false)->getMock() |
|
| 463 | - ->shouldReceive('offsetExists')->with('retries')->andReturn(false)->getMock() |
|
| 464 | - ->shouldReceive('offsetSet')->with('retries', 0)->getMock() |
|
| 465 | - ->shouldReceive('offsetGet')->with('retries')->andReturn(1)->getMock(); |
|
| 459 | + ->shouldReceive('offsetGet')->with('connectionPool')->andReturn($mockConnectionPoolFxn)->getMock() |
|
| 460 | + ->shouldReceive('offsetGet')->with('serializer')->andReturn($mockSerializer)->getMock() |
|
| 461 | + ->shouldReceive('offsetGet')->with('connection')->andReturn($mockConnectionFxn)->getMock() |
|
| 462 | + ->shouldReceive('offsetGet')->with('sniffOnStart')->andReturn(false)->getMock() |
|
| 463 | + ->shouldReceive('offsetExists')->with('retries')->andReturn(false)->getMock() |
|
| 464 | + ->shouldReceive('offsetSet')->with('retries', 0)->getMock() |
|
| 465 | + ->shouldReceive('offsetGet')->with('retries')->andReturn(1)->getMock(); |
|
| 466 | 466 | |
| 467 | 467 | $transport = new Elasticsearch\Transport($hosts, $pimple, $log); |
| 468 | 468 | $ret = $transport->performRequest($method, $uri, $params, $body); |
@@ -30,14 +30,14 @@ discard block |
||
| 30 | 30 | $body = 'testQuery'; |
| 31 | 31 | $uri = '/_search'; |
| 32 | 32 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 33 | - ->shouldReceive('performRequest')->once() |
|
| 34 | - ->with( |
|
| 35 | - m::any(), |
|
| 36 | - $uri, |
|
| 37 | - array(), |
|
| 38 | - $body |
|
| 39 | - ) |
|
| 40 | - ->getMock(); |
|
| 33 | + ->shouldReceive('performRequest')->once() |
|
| 34 | + ->with( |
|
| 35 | + m::any(), |
|
| 36 | + $uri, |
|
| 37 | + array(), |
|
| 38 | + $body |
|
| 39 | + ) |
|
| 40 | + ->getMock(); |
|
| 41 | 41 | |
| 42 | 42 | $search = new Search($mockTransport); |
| 43 | 43 | $search->setBody($body) |
@@ -50,14 +50,14 @@ discard block |
||
| 50 | 50 | $query['query'] = 'testQuery'; |
| 51 | 51 | $uri = '/_search'; |
| 52 | 52 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 53 | - ->shouldReceive('performRequest')->once() |
|
| 54 | - ->with( |
|
| 55 | - m::any(), |
|
| 56 | - $uri, |
|
| 57 | - array(), |
|
| 58 | - $query |
|
| 59 | - ) |
|
| 60 | - ->getMock(); |
|
| 53 | + ->shouldReceive('performRequest')->once() |
|
| 54 | + ->with( |
|
| 55 | + m::any(), |
|
| 56 | + $uri, |
|
| 57 | + array(), |
|
| 58 | + $query |
|
| 59 | + ) |
|
| 60 | + ->getMock(); |
|
| 61 | 61 | |
| 62 | 62 | $search = new Search($mockTransport); |
| 63 | 63 | $search->setBody($query) |
@@ -72,14 +72,14 @@ discard block |
||
| 72 | 72 | $uri = '/_search'; |
| 73 | 73 | |
| 74 | 74 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 75 | - ->shouldReceive('performRequest')->once() |
|
| 76 | - ->with( |
|
| 77 | - m::any(), |
|
| 78 | - $uri, |
|
| 79 | - array(), |
|
| 80 | - m::any() |
|
| 81 | - ) |
|
| 82 | - ->getMock(); |
|
| 75 | + ->shouldReceive('performRequest')->once() |
|
| 76 | + ->with( |
|
| 77 | + m::any(), |
|
| 78 | + $uri, |
|
| 79 | + array(), |
|
| 80 | + m::any() |
|
| 81 | + ) |
|
| 82 | + ->getMock(); |
|
| 83 | 83 | |
| 84 | 84 | $search = new Search($mockTransport); |
| 85 | 85 | $search->performRequest(); |
@@ -91,14 +91,14 @@ discard block |
||
| 91 | 91 | $uri = '/testIndex/_search'; |
| 92 | 92 | |
| 93 | 93 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 94 | - ->shouldReceive('performRequest')->once() |
|
| 95 | - ->with( |
|
| 96 | - m::any(), |
|
| 97 | - $uri, |
|
| 98 | - array(), |
|
| 99 | - m::any() |
|
| 100 | - ) |
|
| 101 | - ->getMock(); |
|
| 94 | + ->shouldReceive('performRequest')->once() |
|
| 95 | + ->with( |
|
| 96 | + m::any(), |
|
| 97 | + $uri, |
|
| 98 | + array(), |
|
| 99 | + m::any() |
|
| 100 | + ) |
|
| 101 | + ->getMock(); |
|
| 102 | 102 | |
| 103 | 103 | $search = new Search($mockTransport); |
| 104 | 104 | $search->setIndex('testIndex') |
@@ -112,14 +112,14 @@ discard block |
||
| 112 | 112 | $uri = '/_all/testType/_search'; |
| 113 | 113 | |
| 114 | 114 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 115 | - ->shouldReceive('performRequest')->once() |
|
| 116 | - ->with( |
|
| 117 | - m::any(), |
|
| 118 | - $uri, |
|
| 119 | - array(), |
|
| 120 | - m::any() |
|
| 121 | - ) |
|
| 122 | - ->getMock(); |
|
| 115 | + ->shouldReceive('performRequest')->once() |
|
| 116 | + ->with( |
|
| 117 | + m::any(), |
|
| 118 | + $uri, |
|
| 119 | + array(), |
|
| 120 | + m::any() |
|
| 121 | + ) |
|
| 122 | + ->getMock(); |
|
| 123 | 123 | |
| 124 | 124 | $search = new Search($mockTransport); |
| 125 | 125 | $search->setType('testType') |
@@ -133,14 +133,14 @@ discard block |
||
| 133 | 133 | $uri = '/testIndex/testType/_search'; |
| 134 | 134 | |
| 135 | 135 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 136 | - ->shouldReceive('performRequest')->once() |
|
| 137 | - ->with( |
|
| 138 | - m::any(), |
|
| 139 | - $uri, |
|
| 140 | - array(), |
|
| 141 | - m::any() |
|
| 142 | - ) |
|
| 143 | - ->getMock(); |
|
| 136 | + ->shouldReceive('performRequest')->once() |
|
| 137 | + ->with( |
|
| 138 | + m::any(), |
|
| 139 | + $uri, |
|
| 140 | + array(), |
|
| 141 | + m::any() |
|
| 142 | + ) |
|
| 143 | + ->getMock(); |
|
| 144 | 144 | |
| 145 | 145 | $search = new Search($mockTransport); |
| 146 | 146 | $search->setIndex('testIndex') |
@@ -80,14 +80,14 @@ |
||
| 80 | 80 | public function testValidDelete() |
| 81 | 81 | { |
| 82 | 82 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 83 | - ->shouldReceive('performRequest')->once() |
|
| 84 | - ->with( |
|
| 85 | - 'DELETE', |
|
| 86 | - '/testIndex/testType/testID', |
|
| 87 | - array(), |
|
| 88 | - null |
|
| 89 | - ) |
|
| 90 | - ->getMock(); |
|
| 83 | + ->shouldReceive('performRequest')->once() |
|
| 84 | + ->with( |
|
| 85 | + 'DELETE', |
|
| 86 | + '/testIndex/testType/testID', |
|
| 87 | + array(), |
|
| 88 | + null |
|
| 89 | + ) |
|
| 90 | + ->getMock(); |
|
| 91 | 91 | |
| 92 | 92 | $delete = new Delete($mockTransport); |
| 93 | 93 | $delete->setIndex('testIndex') |
@@ -54,14 +54,14 @@ |
||
| 54 | 54 | { |
| 55 | 55 | $body = 'abc'; |
| 56 | 56 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 57 | - ->shouldReceive('performRequest')->once() |
|
| 58 | - ->with( |
|
| 59 | - 'GET', |
|
| 60 | - '/testIndex/testType/_percolate', |
|
| 61 | - array(), |
|
| 62 | - $body |
|
| 63 | - ) |
|
| 64 | - ->getMock(); |
|
| 57 | + ->shouldReceive('performRequest')->once() |
|
| 58 | + ->with( |
|
| 59 | + 'GET', |
|
| 60 | + '/testIndex/testType/_percolate', |
|
| 61 | + array(), |
|
| 62 | + $body |
|
| 63 | + ) |
|
| 64 | + ->getMock(); |
|
| 65 | 65 | |
| 66 | 66 | $action = new Percolate($mockTransport); |
| 67 | 67 | $action->setBody($body)->setIndex('testIndex') |
@@ -29,14 +29,14 @@ discard block |
||
| 29 | 29 | { |
| 30 | 30 | |
| 31 | 31 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 32 | - ->shouldReceive('performRequest')->once()->once() |
|
| 33 | - ->with( |
|
| 34 | - m::any(), |
|
| 35 | - m::any(), |
|
| 36 | - array(), |
|
| 37 | - 'bulk data' |
|
| 38 | - ) |
|
| 39 | - ->getMock(); |
|
| 32 | + ->shouldReceive('performRequest')->once()->once() |
|
| 33 | + ->with( |
|
| 34 | + m::any(), |
|
| 35 | + m::any(), |
|
| 36 | + array(), |
|
| 37 | + 'bulk data' |
|
| 38 | + ) |
|
| 39 | + ->getMock(); |
|
| 40 | 40 | |
| 41 | 41 | $mockSerializer = m::mock('\Elasticsearch\Serializers\ArrayToJSONSerializer'); |
| 42 | 42 | |
@@ -53,14 +53,14 @@ discard block |
||
| 53 | 53 | $uri = '/_all/_bulk'; |
| 54 | 54 | |
| 55 | 55 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 56 | - ->shouldReceive('performRequest')->once() |
|
| 57 | - ->with( |
|
| 58 | - m::any(), |
|
| 59 | - $uri, |
|
| 60 | - array(), |
|
| 61 | - m::any() |
|
| 62 | - ) |
|
| 63 | - ->getMock(); |
|
| 56 | + ->shouldReceive('performRequest')->once() |
|
| 57 | + ->with( |
|
| 58 | + m::any(), |
|
| 59 | + $uri, |
|
| 60 | + array(), |
|
| 61 | + m::any() |
|
| 62 | + ) |
|
| 63 | + ->getMock(); |
|
| 64 | 64 | $mockSerializer = m::mock('\Elasticsearch\Serializers\ArrayToJSONSerializer'); |
| 65 | 65 | |
| 66 | 66 | $action = new Bulk($mockTransport, $mockSerializer); |
@@ -73,14 +73,14 @@ discard block |
||
| 73 | 73 | $uri = '/testIndex/_bulk'; |
| 74 | 74 | |
| 75 | 75 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 76 | - ->shouldReceive('performRequest')->once() |
|
| 77 | - ->with( |
|
| 78 | - m::any(), |
|
| 79 | - $uri, |
|
| 80 | - array(), |
|
| 81 | - m::any() |
|
| 82 | - ) |
|
| 83 | - ->getMock(); |
|
| 76 | + ->shouldReceive('performRequest')->once() |
|
| 77 | + ->with( |
|
| 78 | + m::any(), |
|
| 79 | + $uri, |
|
| 80 | + array(), |
|
| 81 | + m::any() |
|
| 82 | + ) |
|
| 83 | + ->getMock(); |
|
| 84 | 84 | $mockSerializer = m::mock('\Elasticsearch\Serializers\ArrayToJSONSerializer'); |
| 85 | 85 | |
| 86 | 86 | $action = new Bulk($mockTransport, $mockSerializer); |
@@ -95,14 +95,14 @@ discard block |
||
| 95 | 95 | $uri = '/_all/testType/_bulk'; |
| 96 | 96 | |
| 97 | 97 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 98 | - ->shouldReceive('performRequest')->once() |
|
| 99 | - ->with( |
|
| 100 | - m::any(), |
|
| 101 | - $uri, |
|
| 102 | - array(), |
|
| 103 | - m::any() |
|
| 104 | - ) |
|
| 105 | - ->getMock(); |
|
| 98 | + ->shouldReceive('performRequest')->once() |
|
| 99 | + ->with( |
|
| 100 | + m::any(), |
|
| 101 | + $uri, |
|
| 102 | + array(), |
|
| 103 | + m::any() |
|
| 104 | + ) |
|
| 105 | + ->getMock(); |
|
| 106 | 106 | $mockSerializer = m::mock('\Elasticsearch\Serializers\ArrayToJSONSerializer'); |
| 107 | 107 | |
| 108 | 108 | $action = new Bulk($mockTransport, $mockSerializer); |
@@ -117,14 +117,14 @@ discard block |
||
| 117 | 117 | $uri = '/testIndex/testType/_bulk'; |
| 118 | 118 | |
| 119 | 119 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 120 | - ->shouldReceive('performRequest')->once() |
|
| 121 | - ->with( |
|
| 122 | - m::any(), |
|
| 123 | - $uri, |
|
| 124 | - array(), |
|
| 125 | - m::any() |
|
| 126 | - ) |
|
| 127 | - ->getMock(); |
|
| 120 | + ->shouldReceive('performRequest')->once() |
|
| 121 | + ->with( |
|
| 122 | + m::any(), |
|
| 123 | + $uri, |
|
| 124 | + array(), |
|
| 125 | + m::any() |
|
| 126 | + ) |
|
| 127 | + ->getMock(); |
|
| 128 | 128 | $mockSerializer = m::mock('\Elasticsearch\Serializers\ArrayToJSONSerializer'); |
| 129 | 129 | |
| 130 | 130 | $action = new Bulk($mockTransport, $mockSerializer); |
@@ -30,14 +30,14 @@ discard block |
||
| 30 | 30 | $uri = '/_count'; |
| 31 | 31 | |
| 32 | 32 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 33 | - ->shouldReceive('performRequest')->once() |
|
| 34 | - ->with( |
|
| 35 | - m::any(), |
|
| 36 | - $uri, |
|
| 37 | - array(), |
|
| 38 | - m::any() |
|
| 39 | - ) |
|
| 40 | - ->getMock(); |
|
| 33 | + ->shouldReceive('performRequest')->once() |
|
| 34 | + ->with( |
|
| 35 | + m::any(), |
|
| 36 | + $uri, |
|
| 37 | + array(), |
|
| 38 | + m::any() |
|
| 39 | + ) |
|
| 40 | + ->getMock(); |
|
| 41 | 41 | |
| 42 | 42 | $action = new Count($mockTransport); |
| 43 | 43 | $action->performRequest(); |
@@ -49,14 +49,14 @@ discard block |
||
| 49 | 49 | $uri = '/testIndex/_count'; |
| 50 | 50 | |
| 51 | 51 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 52 | - ->shouldReceive('performRequest')->once() |
|
| 53 | - ->with( |
|
| 54 | - m::any(), |
|
| 55 | - $uri, |
|
| 56 | - array(), |
|
| 57 | - m::any() |
|
| 58 | - ) |
|
| 59 | - ->getMock(); |
|
| 52 | + ->shouldReceive('performRequest')->once() |
|
| 53 | + ->with( |
|
| 54 | + m::any(), |
|
| 55 | + $uri, |
|
| 56 | + array(), |
|
| 57 | + m::any() |
|
| 58 | + ) |
|
| 59 | + ->getMock(); |
|
| 60 | 60 | |
| 61 | 61 | $action = new Count($mockTransport); |
| 62 | 62 | $action->setIndex('testIndex') |
@@ -70,14 +70,14 @@ discard block |
||
| 70 | 70 | $uri = '/_all/testType/_count'; |
| 71 | 71 | |
| 72 | 72 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 73 | - ->shouldReceive('performRequest')->once() |
|
| 74 | - ->with( |
|
| 75 | - m::any(), |
|
| 76 | - $uri, |
|
| 77 | - array(), |
|
| 78 | - m::any() |
|
| 79 | - ) |
|
| 80 | - ->getMock(); |
|
| 73 | + ->shouldReceive('performRequest')->once() |
|
| 74 | + ->with( |
|
| 75 | + m::any(), |
|
| 76 | + $uri, |
|
| 77 | + array(), |
|
| 78 | + m::any() |
|
| 79 | + ) |
|
| 80 | + ->getMock(); |
|
| 81 | 81 | |
| 82 | 82 | $action = new Count($mockTransport); |
| 83 | 83 | $action->setType('testType') |
@@ -91,14 +91,14 @@ discard block |
||
| 91 | 91 | $uri = '/testIndex/testType/_count'; |
| 92 | 92 | |
| 93 | 93 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 94 | - ->shouldReceive('performRequest')->once() |
|
| 95 | - ->with( |
|
| 96 | - m::any(), |
|
| 97 | - $uri, |
|
| 98 | - array(), |
|
| 99 | - m::any() |
|
| 100 | - ) |
|
| 101 | - ->getMock(); |
|
| 94 | + ->shouldReceive('performRequest')->once() |
|
| 95 | + ->with( |
|
| 96 | + m::any(), |
|
| 97 | + $uri, |
|
| 98 | + array(), |
|
| 99 | + m::any() |
|
| 100 | + ) |
|
| 101 | + ->getMock(); |
|
| 102 | 102 | |
| 103 | 103 | $action = new Count($mockTransport); |
| 104 | 104 | $action->setIndex('testIndex') |
@@ -110,14 +110,14 @@ discard block |
||
| 110 | 110 | public function testValidCount() |
| 111 | 111 | { |
| 112 | 112 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 113 | - ->shouldReceive('performRequest')->once() |
|
| 114 | - ->with( |
|
| 115 | - 'GET', |
|
| 116 | - '/testIndex/testType/_count', |
|
| 117 | - array(), |
|
| 118 | - null |
|
| 119 | - ) |
|
| 120 | - ->getMock(); |
|
| 113 | + ->shouldReceive('performRequest')->once() |
|
| 114 | + ->with( |
|
| 115 | + 'GET', |
|
| 116 | + '/testIndex/testType/_count', |
|
| 117 | + array(), |
|
| 118 | + null |
|
| 119 | + ) |
|
| 120 | + ->getMock(); |
|
| 121 | 121 | |
| 122 | 122 | $action = new Count($mockTransport); |
| 123 | 123 | $action->setIndex('testIndex') |
@@ -82,14 +82,14 @@ |
||
| 82 | 82 | public function testValidMlt() |
| 83 | 83 | { |
| 84 | 84 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 85 | - ->shouldReceive('performRequest')->once() |
|
| 86 | - ->with( |
|
| 87 | - 'GET', |
|
| 88 | - '/testIndex/testType/testID/_mlt', |
|
| 89 | - array(), |
|
| 90 | - null |
|
| 91 | - ) |
|
| 92 | - ->getMock(); |
|
| 85 | + ->shouldReceive('performRequest')->once() |
|
| 86 | + ->with( |
|
| 87 | + 'GET', |
|
| 88 | + '/testIndex/testType/testID/_mlt', |
|
| 89 | + array(), |
|
| 90 | + null |
|
| 91 | + ) |
|
| 92 | + ->getMock(); |
|
| 93 | 93 | |
| 94 | 94 | $action = new Mlt($mockTransport); |
| 95 | 95 | $action->setIndex('testIndex') |