@@ -40,7 +40,7 @@ |
||
| 40 | 40 | /** @var AbstractConnection $connection */ |
| 41 | 41 | $connection = $this->selector->select($this->connections); |
| 42 | 42 | if ($connection->isAlive() === true) { |
| 43 | - return $connection; |
|
| 43 | + return $connection; |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | if ($this->readyToRevive($connection) === true) { |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | */ |
| 34 | 34 | public function nextConnection($force = false) |
| 35 | 35 | { |
| 36 | - $skipped = array(); |
|
| 36 | + $skipped = array (); |
|
| 37 | 37 | |
| 38 | 38 | $total = count($this->connections); |
| 39 | 39 | while ($total--) { |
@@ -13,13 +13,11 @@ discard block |
||
| 13 | 13 | use Elasticsearch\Connections\AbstractConnection; |
| 14 | 14 | use Elasticsearch\Connections\ConnectionFactory; |
| 15 | 15 | |
| 16 | -class StaticConnectionPool extends AbstractConnectionPool |
|
| 17 | -{ |
|
| 16 | +class StaticConnectionPool extends AbstractConnectionPool { |
|
| 18 | 17 | private $pingTimeout = 60; |
| 19 | 18 | private $maxPingTimeout = 3600; |
| 20 | 19 | |
| 21 | - public function __construct($connections, SelectorInterface $selector, ConnectionFactory $factory, $connectionPoolParams) |
|
| 22 | - { |
|
| 20 | + public function __construct($connections, SelectorInterface $selector, ConnectionFactory $factory, $connectionPoolParams) { |
|
| 23 | 21 | parent::__construct($connections, $selector, $factory, $connectionPoolParams); |
| 24 | 22 | $this->scheduleCheck(); |
| 25 | 23 | } |
@@ -31,8 +29,7 @@ discard block |
||
| 31 | 29 | * @return AbstractConnection |
| 32 | 30 | * @throws \Elasticsearch\Common\Exceptions\NoNodesAvailableException |
| 33 | 31 | */ |
| 34 | - public function nextConnection($force = false) |
|
| 35 | - { |
|
| 32 | + public function nextConnection($force = false) { |
|
| 36 | 33 | $skipped = array(); |
| 37 | 34 | |
| 38 | 35 | $total = count($this->connections); |
@@ -62,8 +59,7 @@ discard block |
||
| 62 | 59 | throw new NoNodesAvailableException("No alive nodes found in your cluster"); |
| 63 | 60 | } |
| 64 | 61 | |
| 65 | - public function scheduleCheck() |
|
| 66 | - { |
|
| 62 | + public function scheduleCheck() { |
|
| 67 | 63 | foreach ($this->connections as $connection) { |
| 68 | 64 | $connection->markDead(); |
| 69 | 65 | } |
@@ -74,8 +70,7 @@ discard block |
||
| 74 | 70 | * |
| 75 | 71 | * @return bool |
| 76 | 72 | */ |
| 77 | - private function readyToRevive(AbstractConnection $connection) |
|
| 78 | - { |
|
| 73 | + private function readyToRevive(AbstractConnection $connection) { |
|
| 79 | 74 | $timeout = min( |
| 80 | 75 | $this->pingTimeout * pow(2, $connection->getPingFailures()), |
| 81 | 76 | $this->maxPingTimeout |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * @return AbstractConnection |
| 32 | 32 | * @throws \Elasticsearch\Common\Exceptions\NoNodesAvailableException |
| 33 | 33 | */ |
| 34 | - public function nextConnection($force = false) |
|
| 34 | + public function nextConnection($force = FALSE) |
|
| 35 | 35 | { |
| 36 | 36 | $skipped = array(); |
| 37 | 37 | |
@@ -39,12 +39,12 @@ discard block |
||
| 39 | 39 | while ($total--) { |
| 40 | 40 | /** @var AbstractConnection $connection */ |
| 41 | 41 | $connection = $this->selector->select($this->connections); |
| 42 | - if ($connection->isAlive() === true) { |
|
| 42 | + if ($connection->isAlive() === TRUE) { |
|
| 43 | 43 | return $connection; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - if ($this->readyToRevive($connection) === true) { |
|
| 47 | - if ($connection->ping() === true) { |
|
| 46 | + if ($this->readyToRevive($connection) === TRUE) { |
|
| 47 | + if ($connection->ping() === TRUE) { |
|
| 48 | 48 | return $connection; |
| 49 | 49 | } |
| 50 | 50 | } else { |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | // All "alive" nodes failed, force pings on "dead" nodes |
| 56 | 56 | foreach ($skipped as $connection) { |
| 57 | - if ($connection->ping() === true) { |
|
| 57 | + if ($connection->ping() === TRUE) { |
|
| 58 | 58 | return $connection; |
| 59 | 59 | } |
| 60 | 60 | } |
@@ -82,9 +82,9 @@ discard block |
||
| 82 | 82 | ); |
| 83 | 83 | |
| 84 | 84 | if ($connection->getLastPing() + $timeout < time()) { |
| 85 | - return true; |
|
| 85 | + return TRUE; |
|
| 86 | 86 | } else { |
| 87 | - return false; |
|
| 87 | + return FALSE; |
|
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | \ No newline at end of file |
@@ -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(); |
@@ -35,16 +35,16 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | $stub = $this->getMockForAbstractClass( |
| 37 | 37 | 'Elasticsearch\Connections\AbstractConnection', |
| 38 | - array( |
|
| 39 | - array('host' => 'localhost', 'port' => 9200), |
|
| 40 | - array(), |
|
| 38 | + array ( |
|
| 39 | + array ('host' => 'localhost', 'port' => 9200), |
|
| 40 | + array (), |
|
| 41 | 41 | $logger, |
| 42 | 42 | $logger |
| 43 | 43 | ) |
| 44 | 44 | ); |
| 45 | 45 | |
| 46 | - $options = array('timeout' => 1); |
|
| 47 | - $return = array('status' => 200); |
|
| 46 | + $options = array ('timeout' => 1); |
|
| 47 | + $return = array ('status' => 200); |
|
| 48 | 48 | |
| 49 | 49 | $stub->expects($this->once()) |
| 50 | 50 | ->method('performRequest') |
@@ -63,16 +63,16 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | $stub = $this->getMockForAbstractClass( |
| 65 | 65 | 'Elasticsearch\Connections\AbstractConnection', |
| 66 | - array( |
|
| 67 | - array('host' => 'localhost', 'port' => 9200), |
|
| 68 | - array(), |
|
| 66 | + array ( |
|
| 67 | + array ('host' => 'localhost', 'port' => 9200), |
|
| 68 | + array (), |
|
| 69 | 69 | $logger, |
| 70 | 70 | $logger |
| 71 | 71 | ) |
| 72 | 72 | ); |
| 73 | 73 | |
| 74 | - $options = array('timeout' => 1); |
|
| 75 | - $return = array('status' => 400); |
|
| 74 | + $options = array ('timeout' => 1); |
|
| 75 | + $return = array ('status' => 400); |
|
| 76 | 76 | |
| 77 | 77 | $stub->expects($this->once()) |
| 78 | 78 | ->method('performRequest') |
@@ -91,16 +91,16 @@ discard block |
||
| 91 | 91 | $logger = new Elasticsearch\Common\EmptyLogger(); |
| 92 | 92 | $stub = $this->getMockForAbstractClass( |
| 93 | 93 | 'Elasticsearch\Connections\AbstractConnection', |
| 94 | - array( |
|
| 95 | - array('host' => 'localhost', 'port' => 9200), |
|
| 96 | - array(), |
|
| 94 | + array ( |
|
| 95 | + array ('host' => 'localhost', 'port' => 9200), |
|
| 96 | + array (), |
|
| 97 | 97 | $logger, |
| 98 | 98 | $logger |
| 99 | 99 | ) |
| 100 | 100 | ); |
| 101 | 101 | |
| 102 | - $options = array('timeout' => 1); |
|
| 103 | - $return = array('status' => 400); |
|
| 102 | + $options = array ('timeout' => 1); |
|
| 103 | + $return = array ('status' => 400); |
|
| 104 | 104 | |
| 105 | 105 | $stub->expects($this->once()) |
| 106 | 106 | ->method('performRequest') |
@@ -119,9 +119,9 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | $stub = $this->getMockForAbstractClass( |
| 121 | 121 | 'Elasticsearch\Connections\AbstractConnection', |
| 122 | - array( |
|
| 123 | - array('host' => 'localhost', 'port' => 9200, 'path' => '/prefix'), |
|
| 124 | - array(), |
|
| 122 | + array ( |
|
| 123 | + array ('host' => 'localhost', 'port' => 9200, 'path' => '/prefix'), |
|
| 124 | + array (), |
|
| 125 | 125 | $logger, |
| 126 | 126 | $logger |
| 127 | 127 | ) |
@@ -22,15 +22,12 @@ discard block |
||
| 22 | 22 | * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 |
| 23 | 23 | * @link http://elasticsearch.org |
| 24 | 24 | */ |
| 25 | -class AbstractConnectionTest extends \PHPUnit_Framework_TestCase |
|
| 26 | -{ |
|
| 27 | - public function tearDown() |
|
| 28 | - { |
|
| 25 | +class AbstractConnectionTest extends \PHPUnit_Framework_TestCase { |
|
| 26 | + public function tearDown() { |
|
| 29 | 27 | m::close(); |
| 30 | 28 | } |
| 31 | 29 | |
| 32 | - public function testPing() |
|
| 33 | - { |
|
| 30 | + public function testPing() { |
|
| 34 | 31 | $logger = new Elasticsearch\Common\EmptyLogger(); |
| 35 | 32 | |
| 36 | 33 | $stub = $this->getMockForAbstractClass( |
@@ -57,8 +54,7 @@ discard block |
||
| 57 | 54 | $this->assertTrue($ret); |
| 58 | 55 | } |
| 59 | 56 | |
| 60 | - public function testPingBadCode() |
|
| 61 | - { |
|
| 57 | + public function testPingBadCode() { |
|
| 62 | 58 | $logger = new Elasticsearch\Common\EmptyLogger(); |
| 63 | 59 | |
| 64 | 60 | $stub = $this->getMockForAbstractClass( |
@@ -86,8 +82,7 @@ discard block |
||
| 86 | 82 | } |
| 87 | 83 | |
| 88 | 84 | |
| 89 | - public function testPingTimeout() |
|
| 90 | - { |
|
| 85 | + public function testPingTimeout() { |
|
| 91 | 86 | $logger = new Elasticsearch\Common\EmptyLogger(); |
| 92 | 87 | $stub = $this->getMockForAbstractClass( |
| 93 | 88 | 'Elasticsearch\Connections\AbstractConnection', |
@@ -113,8 +108,7 @@ discard block |
||
| 113 | 108 | $this->assertFalse($ret); |
| 114 | 109 | } |
| 115 | 110 | |
| 116 | - public function testURLPrefix() |
|
| 117 | - { |
|
| 111 | + public function testURLPrefix() { |
|
| 118 | 112 | $logger = new Elasticsearch\Common\EmptyLogger(); |
| 119 | 113 | |
| 120 | 114 | $stub = $this->getMockForAbstractClass( |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | $stub->expects($this->once()) |
| 50 | 50 | ->method('performRequest') |
| 51 | - ->with('HEAD', '', null, null, $options) |
|
| 51 | + ->with('HEAD', '', NULL, NULL, $options) |
|
| 52 | 52 | ->will($this->returnValue($return)); |
| 53 | 53 | |
| 54 | 54 | /** @var AbstractConnection $stub */ |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | $stub->expects($this->once()) |
| 78 | 78 | ->method('performRequest') |
| 79 | - ->with('HEAD', '', null, null, $options) |
|
| 79 | + ->with('HEAD', '', NULL, NULL, $options) |
|
| 80 | 80 | ->will($this->returnValue($return)); |
| 81 | 81 | |
| 82 | 82 | /** @var AbstractConnection $stub */ |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | $stub->expects($this->once()) |
| 106 | 106 | ->method('performRequest') |
| 107 | - ->with('HEAD', '', null, null, $options) |
|
| 107 | + ->with('HEAD', '', NULL, NULL, $options) |
|
| 108 | 108 | ->will($this->throwException(new Elasticsearch\Common\Exceptions\Curl\OperationTimeoutException())); |
| 109 | 109 | |
| 110 | 110 | /** @var AbstractConnection $stub */ |
@@ -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', |
@@ -31,11 +31,11 @@ |
||
| 31 | 31 | // Eww... |
| 32 | 32 | $mockPimple = m::mock('\Pimple\Container') |
| 33 | 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(); |
|
| 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 | - $hostDetails = array( |
|
| 38 | + $hostDetails = array ( |
|
| 39 | 39 | 'host' => 'localhost', |
| 40 | 40 | 'port' => 9200 |
| 41 | 41 | ); |
@@ -15,14 +15,12 @@ |
||
| 15 | 15 | * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 |
| 16 | 16 | * @link http://elasticsearch.org |
| 17 | 17 | */ |
| 18 | -class ConnectionFactoryTest extends \PHPUnit_Framework_TestCase |
|
| 19 | -{ |
|
| 18 | +class ConnectionFactoryTest extends \PHPUnit_Framework_TestCase { |
|
| 20 | 19 | public function tearDown() { |
| 21 | 20 | m::close(); |
| 22 | 21 | } |
| 23 | 22 | |
| 24 | - public function testCreate() |
|
| 25 | - { |
|
| 23 | + public function testCreate() { |
|
| 26 | 24 | $mockConnection = m::mock('\Elasticsearch\Connections\AbstractConnection'); |
| 27 | 25 | $mockFunction = function($hostDetails, $params, $log, $trace) use ($mockConnection) { |
| 28 | 26 | return $mockConnection; |
@@ -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); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | ->disableOriginalConstructor() |
| 52 | 52 | ->getMock(); |
| 53 | 53 | |
| 54 | - $hosts = array(array('host' => 'localhost')); |
|
| 54 | + $hosts = array (array ('host' => 'localhost')); |
|
| 55 | 55 | |
| 56 | 56 | $mockConnectionPool = m::mock('\Elasticsearch\ConnectionPool\StaticConnectionPool') |
| 57 | 57 | ->shouldReceive('scheduleCheck')->once()->getMock(); |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | ->disableOriginalConstructor() |
| 87 | 87 | ->getMock(); |
| 88 | 88 | |
| 89 | - $hosts = array(array('host' => 'localhost')); |
|
| 89 | + $hosts = array (array ('host' => 'localhost')); |
|
| 90 | 90 | |
| 91 | 91 | $mockConnectionPool = m::mock('\Elasticsearch\ConnectionPool\StaticConnectionPool') |
| 92 | 92 | ->shouldReceive('scheduleCheck')->once()->getMock(); |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | ->disableOriginalConstructor() |
| 121 | 121 | ->getMock(); |
| 122 | 122 | |
| 123 | - $hosts = array(array('host' => 'localhost')); |
|
| 123 | + $hosts = array (array ('host' => 'localhost')); |
|
| 124 | 124 | |
| 125 | 125 | $mockConnectionPool = m::mock('\Elasticsearch\ConnectionPool\StaticConnectionPool') |
| 126 | 126 | ->shouldReceive('scheduleCheck')->never()->getMock(); |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | $mockSerializer = m::mock('\Elasticsearch\Serializers\SerializerInterface'); |
| 132 | 132 | |
| 133 | 133 | $mockConnection = m::mock('\Elasticsearch\Connections\ConnectionInterface'); |
| 134 | - $mockConnectionFxn = function($host, $port=null) use ($mockConnection) { |
|
| 134 | + $mockConnectionFxn = function($host, $port = null) use ($mockConnection) { |
|
| 135 | 135 | return $mockConnection; |
| 136 | 136 | }; |
| 137 | 137 | |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | ->disableOriginalConstructor() |
| 155 | 155 | ->getMock(); |
| 156 | 156 | |
| 157 | - $hosts = array(array('host' => 'localhost'), array('host' => 'localhost', 'port' => 9200)); |
|
| 157 | + $hosts = array (array ('host' => 'localhost'), array ('host' => 'localhost', 'port' => 9200)); |
|
| 158 | 158 | |
| 159 | 159 | $mockConnectionPool = m::mock('\Elasticsearch\ConnectionPool\StaticConnectionPool') |
| 160 | 160 | ->shouldReceive('scheduleCheck')->never()->getMock(); |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | $mockSerializer = m::mock('\Elasticsearch\Serializers\SerializerInterface'); |
| 166 | 166 | |
| 167 | 167 | $mockConnection = m::mock('\Elasticsearch\Connections\ConnectionInterface'); |
| 168 | - $mockConnectionFxn = function($host, $port=null) use ($mockConnection) { |
|
| 168 | + $mockConnectionFxn = function($host, $port = null) use ($mockConnection) { |
|
| 169 | 169 | return $mockConnection; |
| 170 | 170 | }; |
| 171 | 171 | |
@@ -188,22 +188,22 @@ discard block |
||
| 188 | 188 | ->disableOriginalConstructor() |
| 189 | 189 | ->getMock(); |
| 190 | 190 | |
| 191 | - $hosts = array(array('host' => 'localhost')); |
|
| 191 | + $hosts = array (array ('host' => 'localhost')); |
|
| 192 | 192 | $method = 'GET'; |
| 193 | 193 | $uri = '/'; |
| 194 | 194 | $params = null; |
| 195 | 195 | $body = null; |
| 196 | - $response = array( |
|
| 196 | + $response = array ( |
|
| 197 | 197 | 'text' => 'texty text', |
| 198 | 198 | 'status' => '200', |
| 199 | - 'info' => array() |
|
| 199 | + 'info' => array () |
|
| 200 | 200 | ); |
| 201 | 201 | |
| 202 | 202 | $mockConnection = m::mock('\Elasticsearch\Connections\AbstractConnection') |
| 203 | 203 | ->shouldReceive('performRequest')->once()->with($method, $uri, $params, $body)->andReturn($response)->getMock() |
| 204 | 204 | ->shouldReceive('markAlive')->once()->getMock(); |
| 205 | 205 | |
| 206 | - $mockConnectionFxn = function($host, $port=null) use ($mockConnection) { |
|
| 206 | + $mockConnectionFxn = function($host, $port = null) use ($mockConnection) { |
|
| 207 | 207 | return $mockConnection; |
| 208 | 208 | }; |
| 209 | 209 | |
@@ -215,7 +215,7 @@ discard block |
||
| 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 | |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | $transport = new Elasticsearch\Transport($hosts, $pimple, $log); |
| 233 | 233 | $ret = $transport->performRequest($method, $uri, $params, $body); |
| 234 | 234 | |
| 235 | - $expected = array( |
|
| 235 | + $expected = array ( |
|
| 236 | 236 | 'status' => $response['status'], |
| 237 | 237 | 'data' => 'out', |
| 238 | 238 | 'info' => $response['info'] |
@@ -248,15 +248,15 @@ discard block |
||
| 248 | 248 | ->disableOriginalConstructor() |
| 249 | 249 | ->getMock(); |
| 250 | 250 | |
| 251 | - $hosts = array(array('host' => 'localhost')); |
|
| 251 | + $hosts = array (array ('host' => 'localhost')); |
|
| 252 | 252 | $method = 'GET'; |
| 253 | 253 | $uri = '/'; |
| 254 | 254 | $params = null; |
| 255 | - $body = array('field' => 'value'); |
|
| 256 | - $response = array( |
|
| 255 | + $body = array ('field' => 'value'); |
|
| 256 | + $response = array ( |
|
| 257 | 257 | 'text' => 'texty text', |
| 258 | 258 | 'status' => '200', |
| 259 | - 'info' => array() |
|
| 259 | + 'info' => array () |
|
| 260 | 260 | ); |
| 261 | 261 | $serializedBody = 'out_serialized'; |
| 262 | 262 | |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | ->shouldReceive('performRequest')->once()->with($method, $uri, $params, $serializedBody)->andReturn($response)->getMock() |
| 266 | 266 | ->shouldReceive('markAlive')->once()->getMock(); |
| 267 | 267 | |
| 268 | - $mockConnectionFxn = function($host, $port=null) use ($mockConnection) { |
|
| 268 | + $mockConnectionFxn = function($host, $port = null) use ($mockConnection) { |
|
| 269 | 269 | return $mockConnection; |
| 270 | 270 | }; |
| 271 | 271 | |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | |
| 279 | 279 | $mockSerializer = m::mock('\Elasticsearch\Serializers\SerializerInterface') |
| 280 | 280 | ->shouldReceive('serialize')->with($body)->andReturn($serializedBody)->getMock() |
| 281 | - ->shouldReceive('deserialize')->with($response['text'], array())->andReturn('out_deserialize')->getMock(); |
|
| 281 | + ->shouldReceive('deserialize')->with($response['text'], array ())->andReturn('out_deserialize')->getMock(); |
|
| 282 | 282 | |
| 283 | 283 | |
| 284 | 284 | |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | $transport = new Elasticsearch\Transport($hosts, $pimple, $log); |
| 296 | 296 | $ret = $transport->performRequest($method, $uri, $params, $body); |
| 297 | 297 | |
| 298 | - $expected = array( |
|
| 298 | + $expected = array ( |
|
| 299 | 299 | 'status' => $response['status'], |
| 300 | 300 | 'data' => 'out_deserialize', |
| 301 | 301 | 'info' => $response['info'] |
@@ -310,15 +310,15 @@ discard block |
||
| 310 | 310 | ->disableOriginalConstructor() |
| 311 | 311 | ->getMock(); |
| 312 | 312 | |
| 313 | - $hosts = array(array('host' => 'localhost')); |
|
| 313 | + $hosts = array (array ('host' => 'localhost')); |
|
| 314 | 314 | $method = 'GET'; |
| 315 | 315 | $uri = '/'; |
| 316 | 316 | $params = null; |
| 317 | 317 | $body = null; |
| 318 | - $response = array( |
|
| 318 | + $response = array ( |
|
| 319 | 319 | 'text' => 'texty text', |
| 320 | 320 | 'status' => '200', |
| 321 | - 'info' => array() |
|
| 321 | + 'info' => array () |
|
| 322 | 322 | ); |
| 323 | 323 | |
| 324 | 324 | $mockConnection = m::mock('\Elasticsearch\Connections\AbstractConnection') |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | ->shouldReceive('performRequest')->once()->with($method, $uri, $params, $body)->andReturn($response)->getMock() |
| 327 | 327 | ->shouldReceive('markAlive')->once()->getMock(); |
| 328 | 328 | |
| 329 | - $mockConnectionFxn = function($host, $port=null) use ($mockConnection) { |
|
| 329 | + $mockConnectionFxn = function($host, $port = null) use ($mockConnection) { |
|
| 330 | 330 | return $mockConnection; |
| 331 | 331 | }; |
| 332 | 332 | |
@@ -338,7 +338,7 @@ discard block |
||
| 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 | |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | $transport = new Elasticsearch\Transport($hosts, $pimple, $log); |
| 356 | 356 | $ret = $transport->performRequest($method, $uri, $params, $body); |
| 357 | 357 | |
| 358 | - $expected = array( |
|
| 358 | + $expected = array ( |
|
| 359 | 359 | 'status' => $response['status'], |
| 360 | 360 | 'data' => 'out', |
| 361 | 361 | 'info' => $response['info'] |
@@ -374,20 +374,20 @@ discard block |
||
| 374 | 374 | ->disableOriginalConstructor() |
| 375 | 375 | ->getMock(); |
| 376 | 376 | |
| 377 | - $hosts = array(array('host' => 'localhost')); |
|
| 377 | + $hosts = array (array ('host' => 'localhost')); |
|
| 378 | 378 | $method = 'GET'; |
| 379 | 379 | $uri = '/'; |
| 380 | 380 | $params = null; |
| 381 | 381 | $body = null; |
| 382 | - $response = array( |
|
| 382 | + $response = array ( |
|
| 383 | 383 | 'text' => 'texty text', |
| 384 | 384 | 'status' => '200', |
| 385 | - 'info' => array() |
|
| 385 | + 'info' => array () |
|
| 386 | 386 | ); |
| 387 | 387 | |
| 388 | 388 | $mockConnection = m::mock('\Elasticsearch\Connections\AbstractConnection'); |
| 389 | 389 | |
| 390 | - $mockConnectionFxn = function($host, $port=null) use ($mockConnection) { |
|
| 390 | + $mockConnectionFxn = function($host, $port = null) use ($mockConnection) { |
|
| 391 | 391 | return $mockConnection; |
| 392 | 392 | }; |
| 393 | 393 | |
@@ -421,15 +421,15 @@ discard block |
||
| 421 | 421 | ->disableOriginalConstructor() |
| 422 | 422 | ->getMock(); |
| 423 | 423 | |
| 424 | - $hosts = array(array('host' => 'localhost')); |
|
| 424 | + $hosts = array (array ('host' => 'localhost')); |
|
| 425 | 425 | $method = 'GET'; |
| 426 | 426 | $uri = '/'; |
| 427 | 427 | $params = null; |
| 428 | 428 | $body = null; |
| 429 | - $response = array( |
|
| 429 | + $response = array ( |
|
| 430 | 430 | 'text' => 'texty text', |
| 431 | 431 | 'status' => '200', |
| 432 | - 'info' => array() |
|
| 432 | + 'info' => array () |
|
| 433 | 433 | ); |
| 434 | 434 | |
| 435 | 435 | $mockConnection = m::mock('\Elasticsearch\Connections\AbstractConnection') |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | ->shouldReceive('markDead')->once()->getMock() |
| 439 | 439 | ->shouldReceive('markAlive')->once()->getMock(); |
| 440 | 440 | |
| 441 | - $mockConnectionFxn = function($host, $port=null) use ($mockConnection) { |
|
| 441 | + $mockConnectionFxn = function($host, $port = null) use ($mockConnection) { |
|
| 442 | 442 | return $mockConnection; |
| 443 | 443 | }; |
| 444 | 444 | |
@@ -450,7 +450,7 @@ discard block |
||
| 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 | |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | $transport = new Elasticsearch\Transport($hosts, $pimple, $log); |
| 468 | 468 | $ret = $transport->performRequest($method, $uri, $params, $body); |
| 469 | 469 | |
| 470 | - $expected = array( |
|
| 470 | + $expected = array ( |
|
| 471 | 471 | 'status' => $response['status'], |
| 472 | 472 | 'data' => 'out', |
| 473 | 473 | 'info' => $response['info'] |
@@ -15,11 +15,9 @@ discard block |
||
| 15 | 15 | * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 |
| 16 | 16 | * @link http://elasticsearch.org |
| 17 | 17 | */ |
| 18 | -class TransportTest extends \PHPUnit_Framework_TestCase |
|
| 19 | -{ |
|
| 18 | +class TransportTest extends \PHPUnit_Framework_TestCase { |
|
| 20 | 19 | |
| 21 | - public function tearDown() |
|
| 22 | - { |
|
| 20 | + public function tearDown() { |
|
| 23 | 21 | m::close(); |
| 24 | 22 | } |
| 25 | 23 | |
@@ -33,8 +31,7 @@ discard block |
||
| 33 | 31 | * @covers \Elasticsearch\Transport::__construct |
| 34 | 32 | * @return void |
| 35 | 33 | */ |
| 36 | - public function testStringConstructor() |
|
| 37 | - { |
|
| 34 | + public function testStringConstructor() { |
|
| 38 | 35 | $hosts = 'arbitrary string'; |
| 39 | 36 | $params = 'arbitrary string'; |
| 40 | 37 | $log = $this->getMockBuilder('\Monolog\Logger') |
@@ -45,8 +42,7 @@ discard block |
||
| 45 | 42 | }//end testStringConstructor() |
| 46 | 43 | |
| 47 | 44 | |
| 48 | - public function testSniffOnStart() |
|
| 49 | - { |
|
| 45 | + public function testSniffOnStart() { |
|
| 50 | 46 | $log = $this->getMockBuilder('\Monolog\Logger') |
| 51 | 47 | ->disableOriginalConstructor() |
| 52 | 48 | ->getMock(); |
@@ -80,8 +76,7 @@ discard block |
||
| 80 | 76 | $transport = new Elasticsearch\Transport($hosts, $params, $log); |
| 81 | 77 | } |
| 82 | 78 | |
| 83 | - public function testSetRetries() |
|
| 84 | - { |
|
| 79 | + public function testSetRetries() { |
|
| 85 | 80 | $log = $this->getMockBuilder('\Monolog\Logger') |
| 86 | 81 | ->disableOriginalConstructor() |
| 87 | 82 | ->getMock(); |
@@ -114,8 +109,7 @@ discard block |
||
| 114 | 109 | $transport = new Elasticsearch\Transport($hosts, $params, $log); |
| 115 | 110 | } |
| 116 | 111 | |
| 117 | - public function testNoSniffOnStart() |
|
| 118 | - { |
|
| 112 | + public function testNoSniffOnStart() { |
|
| 119 | 113 | $log = $this->getMockBuilder('\Monolog\Logger') |
| 120 | 114 | ->disableOriginalConstructor() |
| 121 | 115 | ->getMock(); |
@@ -148,8 +142,7 @@ discard block |
||
| 148 | 142 | $transport = new Elasticsearch\Transport($hosts, $params, $log); |
| 149 | 143 | } |
| 150 | 144 | |
| 151 | - public function testMixedHosts() |
|
| 152 | - { |
|
| 145 | + public function testMixedHosts() { |
|
| 153 | 146 | $log = $this->getMockBuilder('\Monolog\Logger') |
| 154 | 147 | ->disableOriginalConstructor() |
| 155 | 148 | ->getMock(); |
@@ -182,8 +175,7 @@ discard block |
||
| 182 | 175 | $transport = new Elasticsearch\Transport($hosts, $params, $log); |
| 183 | 176 | } |
| 184 | 177 | |
| 185 | - public function testPerformRequestNoBody() |
|
| 186 | - { |
|
| 178 | + public function testPerformRequestNoBody() { |
|
| 187 | 179 | $log = $this->getMockBuilder('\Monolog\Logger') |
| 188 | 180 | ->disableOriginalConstructor() |
| 189 | 181 | ->getMock(); |
@@ -242,8 +234,7 @@ discard block |
||
| 242 | 234 | |
| 243 | 235 | } |
| 244 | 236 | |
| 245 | - public function testPerformRequestWithBody() |
|
| 246 | - { |
|
| 237 | + public function testPerformRequestWithBody() { |
|
| 247 | 238 | $log = $this->getMockBuilder('\Monolog\Logger') |
| 248 | 239 | ->disableOriginalConstructor() |
| 249 | 240 | ->getMock(); |
@@ -304,8 +295,7 @@ discard block |
||
| 304 | 295 | $this->assertEquals($expected, $ret); |
| 305 | 296 | } |
| 306 | 297 | |
| 307 | - public function testPerformRequestTimeout() |
|
| 308 | - { |
|
| 298 | + public function testPerformRequestTimeout() { |
|
| 309 | 299 | $log = $this->getMockBuilder('\Monolog\Logger') |
| 310 | 300 | ->disableOriginalConstructor() |
| 311 | 301 | ->getMock(); |
@@ -368,8 +358,7 @@ discard block |
||
| 368 | 358 | /** |
| 369 | 359 | * @expectedException \Elasticsearch\Common\Exceptions\NoNodesAvailableException |
| 370 | 360 | */ |
| 371 | - public function testPerformRequestNoNodesAvailable() |
|
| 372 | - { |
|
| 361 | + public function testPerformRequestNoNodesAvailable() { |
|
| 373 | 362 | $log = $this->getMockBuilder('\Monolog\Logger') |
| 374 | 363 | ->disableOriginalConstructor() |
| 375 | 364 | ->getMock(); |
@@ -415,8 +404,7 @@ discard block |
||
| 415 | 404 | |
| 416 | 405 | } |
| 417 | 406 | |
| 418 | - public function testPerformRequestTransportException() |
|
| 419 | - { |
|
| 407 | + public function testPerformRequestTransportException() { |
|
| 420 | 408 | $log = $this->getMockBuilder('\Monolog\Logger') |
| 421 | 409 | ->disableOriginalConstructor() |
| 422 | 410 | ->getMock(); |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $mockSerializer = m::mock('\Elasticsearch\Serializers\SerializerInterface'); |
| 64 | 64 | |
| 65 | 65 | $mockConnection = m::mock('\Elasticsearch\Connections\ConnectionInterface'); |
| 66 | - $mockConnectionFxn = function($host, $port = null) use ($mockConnection) { |
|
| 66 | + $mockConnectionFxn = function($host, $port = NULL) use ($mockConnection) { |
|
| 67 | 67 | return $mockConnection; |
| 68 | 68 | }; |
| 69 | 69 | |
@@ -72,8 +72,8 @@ discard block |
||
| 72 | 72 | ->shouldReceive('offsetGet')->with('connectionPool')->andReturn($mockConnectionPoolFxn)->getMock() |
| 73 | 73 | ->shouldReceive('offsetGet')->with('serializer')->andReturn($mockSerializer)->getMock() |
| 74 | 74 | ->shouldReceive('offsetGet')->with('connection')->andReturn($mockConnectionFxn)->getMock() |
| 75 | - ->shouldReceive('offsetGet')->with('sniffOnStart')->andReturn(true)->getMock() |
|
| 76 | - ->shouldReceive('offsetExists')->with('retries')->andReturn(false)->getMock() |
|
| 75 | + ->shouldReceive('offsetGet')->with('sniffOnStart')->andReturn(TRUE)->getMock() |
|
| 76 | + ->shouldReceive('offsetExists')->with('retries')->andReturn(FALSE)->getMock() |
|
| 77 | 77 | ->shouldReceive('offsetSet')->with('retries', 0)->getMock() |
| 78 | 78 | ->shouldReceive('offsetGet')->with('retries')->andReturn(1)->getMock(); |
| 79 | 79 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $mockSerializer = m::mock('\Elasticsearch\Serializers\SerializerInterface'); |
| 99 | 99 | |
| 100 | 100 | $mockConnection = m::mock('\Elasticsearch\Connections\ConnectionInterface'); |
| 101 | - $mockConnectionFxn = function($host, $port = null) use ($mockConnection) { |
|
| 101 | + $mockConnectionFxn = function($host, $port = NULL) use ($mockConnection) { |
|
| 102 | 102 | return $mockConnection; |
| 103 | 103 | }; |
| 104 | 104 | |
@@ -107,8 +107,8 @@ discard block |
||
| 107 | 107 | ->shouldReceive('offsetGet')->with('connectionPool')->andReturn($mockConnectionPoolFxn)->getMock() |
| 108 | 108 | ->shouldReceive('offsetGet')->with('serializer')->andReturn($mockSerializer)->getMock() |
| 109 | 109 | ->shouldReceive('offsetGet')->with('connection')->andReturn($mockConnectionFxn)->getMock() |
| 110 | - ->shouldReceive('offsetGet')->with('sniffOnStart')->andReturn(true)->getMock() |
|
| 111 | - ->shouldReceive('offsetExists')->with('retries')->andReturn(true)->getMock() |
|
| 110 | + ->shouldReceive('offsetGet')->with('sniffOnStart')->andReturn(TRUE)->getMock() |
|
| 111 | + ->shouldReceive('offsetExists')->with('retries')->andReturn(TRUE)->getMock() |
|
| 112 | 112 | ->shouldReceive('offsetGet')->with('retries')->andReturn(2)->getMock(); |
| 113 | 113 | |
| 114 | 114 | $transport = new Elasticsearch\Transport($hosts, $params, $log); |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | $mockSerializer = m::mock('\Elasticsearch\Serializers\SerializerInterface'); |
| 132 | 132 | |
| 133 | 133 | $mockConnection = m::mock('\Elasticsearch\Connections\ConnectionInterface'); |
| 134 | - $mockConnectionFxn = function($host, $port=null) use ($mockConnection) { |
|
| 134 | + $mockConnectionFxn = function($host, $port=NULL) use ($mockConnection) { |
|
| 135 | 135 | return $mockConnection; |
| 136 | 136 | }; |
| 137 | 137 | |
@@ -140,8 +140,8 @@ discard block |
||
| 140 | 140 | ->shouldReceive('offsetGet')->with('connectionPool')->andReturn($mockConnectionPoolFxn)->getMock() |
| 141 | 141 | ->shouldReceive('offsetGet')->with('serializer')->andReturn($mockSerializer)->getMock() |
| 142 | 142 | ->shouldReceive('offsetGet')->with('connection')->andReturn($mockConnectionFxn)->getMock() |
| 143 | - ->shouldReceive('offsetGet')->with('sniffOnStart')->andReturn(false)->getMock() |
|
| 144 | - ->shouldReceive('offsetExists')->with('retries')->andReturn(false)->getMock() |
|
| 143 | + ->shouldReceive('offsetGet')->with('sniffOnStart')->andReturn(FALSE)->getMock() |
|
| 144 | + ->shouldReceive('offsetExists')->with('retries')->andReturn(FALSE)->getMock() |
|
| 145 | 145 | ->shouldReceive('offsetSet')->with('retries', 0)->getMock() |
| 146 | 146 | ->shouldReceive('offsetGet')->with('retries')->andReturn(1)->getMock(); |
| 147 | 147 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | $mockSerializer = m::mock('\Elasticsearch\Serializers\SerializerInterface'); |
| 166 | 166 | |
| 167 | 167 | $mockConnection = m::mock('\Elasticsearch\Connections\ConnectionInterface'); |
| 168 | - $mockConnectionFxn = function($host, $port=null) use ($mockConnection) { |
|
| 168 | + $mockConnectionFxn = function($host, $port=NULL) use ($mockConnection) { |
|
| 169 | 169 | return $mockConnection; |
| 170 | 170 | }; |
| 171 | 171 | |
@@ -174,8 +174,8 @@ discard block |
||
| 174 | 174 | ->shouldReceive('offsetGet')->with('connectionPool')->andReturn($mockConnectionPoolFxn)->getMock() |
| 175 | 175 | ->shouldReceive('offsetGet')->with('serializer')->andReturn($mockSerializer)->getMock() |
| 176 | 176 | ->shouldReceive('offsetGet')->with('connection')->andReturn($mockConnectionFxn)->getMock() |
| 177 | - ->shouldReceive('offsetGet')->with('sniffOnStart')->andReturn(false)->getMock() |
|
| 178 | - ->shouldReceive('offsetExists')->with('retries')->andReturn(false)->getMock() |
|
| 177 | + ->shouldReceive('offsetGet')->with('sniffOnStart')->andReturn(FALSE)->getMock() |
|
| 178 | + ->shouldReceive('offsetExists')->with('retries')->andReturn(FALSE)->getMock() |
|
| 179 | 179 | ->shouldReceive('offsetSet')->with('retries', 1)->getMock() |
| 180 | 180 | ->shouldReceive('offsetGet')->with('retries')->andReturn(2)->getMock(); |
| 181 | 181 | |
@@ -191,8 +191,8 @@ discard block |
||
| 191 | 191 | $hosts = array(array('host' => 'localhost')); |
| 192 | 192 | $method = 'GET'; |
| 193 | 193 | $uri = '/'; |
| 194 | - $params = null; |
|
| 195 | - $body = null; |
|
| 194 | + $params = NULL; |
|
| 195 | + $body = NULL; |
|
| 196 | 196 | $response = array( |
| 197 | 197 | 'text' => 'texty text', |
| 198 | 198 | 'status' => '200', |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | ->shouldReceive('performRequest')->once()->with($method, $uri, $params, $body)->andReturn($response)->getMock() |
| 204 | 204 | ->shouldReceive('markAlive')->once()->getMock(); |
| 205 | 205 | |
| 206 | - $mockConnectionFxn = function($host, $port=null) use ($mockConnection) { |
|
| 206 | + $mockConnectionFxn = function($host, $port=NULL) use ($mockConnection) { |
|
| 207 | 207 | return $mockConnection; |
| 208 | 208 | }; |
| 209 | 209 | |
@@ -224,8 +224,8 @@ discard block |
||
| 224 | 224 | ->shouldReceive('offsetGet')->with('connectionPool')->andReturn($mockConnectionPoolFxn)->getMock() |
| 225 | 225 | ->shouldReceive('offsetGet')->with('serializer')->andReturn($mockSerializer)->getMock() |
| 226 | 226 | ->shouldReceive('offsetGet')->with('connection')->andReturn($mockConnectionFxn)->getMock() |
| 227 | - ->shouldReceive('offsetGet')->with('sniffOnStart')->andReturn(false)->getMock() |
|
| 228 | - ->shouldReceive('offsetExists')->with('retries')->andReturn(false)->getMock() |
|
| 227 | + ->shouldReceive('offsetGet')->with('sniffOnStart')->andReturn(FALSE)->getMock() |
|
| 228 | + ->shouldReceive('offsetExists')->with('retries')->andReturn(FALSE)->getMock() |
|
| 229 | 229 | ->shouldReceive('offsetSet')->with('retries', 0)->getMock() |
| 230 | 230 | ->shouldReceive('offsetGet')->with('retries')->andReturn(1)->getMock(); |
| 231 | 231 | |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | $hosts = array(array('host' => 'localhost')); |
| 252 | 252 | $method = 'GET'; |
| 253 | 253 | $uri = '/'; |
| 254 | - $params = null; |
|
| 254 | + $params = NULL; |
|
| 255 | 255 | $body = array('field' => 'value'); |
| 256 | 256 | $response = array( |
| 257 | 257 | 'text' => 'texty text', |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | ->shouldReceive('performRequest')->once()->with($method, $uri, $params, $serializedBody)->andReturn($response)->getMock() |
| 266 | 266 | ->shouldReceive('markAlive')->once()->getMock(); |
| 267 | 267 | |
| 268 | - $mockConnectionFxn = function($host, $port=null) use ($mockConnection) { |
|
| 268 | + $mockConnectionFxn = function($host, $port=NULL) use ($mockConnection) { |
|
| 269 | 269 | return $mockConnection; |
| 270 | 270 | }; |
| 271 | 271 | |
@@ -287,8 +287,8 @@ discard block |
||
| 287 | 287 | ->shouldReceive('offsetGet')->with('connectionPool')->andReturn($mockConnectionPoolFxn)->getMock() |
| 288 | 288 | ->shouldReceive('offsetGet')->with('serializer')->andReturn($mockSerializer)->getMock() |
| 289 | 289 | ->shouldReceive('offsetGet')->with('connection')->andReturn($mockConnectionFxn)->getMock() |
| 290 | - ->shouldReceive('offsetGet')->with('sniffOnStart')->andReturn(false)->getMock() |
|
| 291 | - ->shouldReceive('offsetExists')->with('retries')->andReturn(false)->getMock() |
|
| 290 | + ->shouldReceive('offsetGet')->with('sniffOnStart')->andReturn(FALSE)->getMock() |
|
| 291 | + ->shouldReceive('offsetExists')->with('retries')->andReturn(FALSE)->getMock() |
|
| 292 | 292 | ->shouldReceive('offsetSet')->with('retries', 0)->getMock() |
| 293 | 293 | ->shouldReceive('offsetGet')->with('retries')->andReturn(1)->getMock(); |
| 294 | 294 | |
@@ -313,8 +313,8 @@ discard block |
||
| 313 | 313 | $hosts = array(array('host' => 'localhost')); |
| 314 | 314 | $method = 'GET'; |
| 315 | 315 | $uri = '/'; |
| 316 | - $params = null; |
|
| 317 | - $body = null; |
|
| 316 | + $params = NULL; |
|
| 317 | + $body = NULL; |
|
| 318 | 318 | $response = array( |
| 319 | 319 | 'text' => 'texty text', |
| 320 | 320 | 'status' => '200', |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | ->shouldReceive('performRequest')->once()->with($method, $uri, $params, $body)->andReturn($response)->getMock() |
| 327 | 327 | ->shouldReceive('markAlive')->once()->getMock(); |
| 328 | 328 | |
| 329 | - $mockConnectionFxn = function($host, $port=null) use ($mockConnection) { |
|
| 329 | + $mockConnectionFxn = function($host, $port=NULL) use ($mockConnection) { |
|
| 330 | 330 | return $mockConnection; |
| 331 | 331 | }; |
| 332 | 332 | |
@@ -347,8 +347,8 @@ discard block |
||
| 347 | 347 | ->shouldReceive('offsetGet')->with('connectionPool')->andReturn($mockConnectionPoolFxn)->getMock() |
| 348 | 348 | ->shouldReceive('offsetGet')->with('serializer')->andReturn($mockSerializer)->getMock() |
| 349 | 349 | ->shouldReceive('offsetGet')->with('connection')->andReturn($mockConnectionFxn)->getMock() |
| 350 | - ->shouldReceive('offsetGet')->with('sniffOnStart')->andReturn(false)->getMock() |
|
| 351 | - ->shouldReceive('offsetExists')->with('retries')->andReturn(false)->getMock() |
|
| 350 | + ->shouldReceive('offsetGet')->with('sniffOnStart')->andReturn(FALSE)->getMock() |
|
| 351 | + ->shouldReceive('offsetExists')->with('retries')->andReturn(FALSE)->getMock() |
|
| 352 | 352 | ->shouldReceive('offsetSet')->with('retries', 0)->getMock() |
| 353 | 353 | ->shouldReceive('offsetGet')->with('retries')->andReturn(1)->getMock(); |
| 354 | 354 | |
@@ -377,8 +377,8 @@ discard block |
||
| 377 | 377 | $hosts = array(array('host' => 'localhost')); |
| 378 | 378 | $method = 'GET'; |
| 379 | 379 | $uri = '/'; |
| 380 | - $params = null; |
|
| 381 | - $body = null; |
|
| 380 | + $params = NULL; |
|
| 381 | + $body = NULL; |
|
| 382 | 382 | $response = array( |
| 383 | 383 | 'text' => 'texty text', |
| 384 | 384 | 'status' => '200', |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | |
| 388 | 388 | $mockConnection = m::mock('\Elasticsearch\Connections\AbstractConnection'); |
| 389 | 389 | |
| 390 | - $mockConnectionFxn = function($host, $port=null) use ($mockConnection) { |
|
| 390 | + $mockConnectionFxn = function($host, $port=NULL) use ($mockConnection) { |
|
| 391 | 391 | return $mockConnection; |
| 392 | 392 | }; |
| 393 | 393 | |
@@ -404,8 +404,8 @@ discard block |
||
| 404 | 404 | ->shouldReceive('offsetGet')->with('connectionPool')->andReturn($mockConnectionPoolFxn)->getMock() |
| 405 | 405 | ->shouldReceive('offsetGet')->with('connection')->andReturn($mockConnectionFxn)->getMock() |
| 406 | 406 | ->shouldReceive('offsetGet')->with('serializer')->andReturn($mockSerializer)->getMock() |
| 407 | - ->shouldReceive('offsetGet')->with('sniffOnStart')->andReturn(false)->getMock() |
|
| 408 | - ->shouldReceive('offsetExists')->with('retries')->andReturn(false)->getMock() |
|
| 407 | + ->shouldReceive('offsetGet')->with('sniffOnStart')->andReturn(FALSE)->getMock() |
|
| 408 | + ->shouldReceive('offsetExists')->with('retries')->andReturn(FALSE)->getMock() |
|
| 409 | 409 | ->shouldReceive('offsetSet')->with('retries', 0)->getMock() |
| 410 | 410 | ->shouldReceive('offsetGet')->with('retries')->andReturn(1)->getMock(); |
| 411 | 411 | |
@@ -424,8 +424,8 @@ discard block |
||
| 424 | 424 | $hosts = array(array('host' => 'localhost')); |
| 425 | 425 | $method = 'GET'; |
| 426 | 426 | $uri = '/'; |
| 427 | - $params = null; |
|
| 428 | - $body = null; |
|
| 427 | + $params = NULL; |
|
| 428 | + $body = NULL; |
|
| 429 | 429 | $response = array( |
| 430 | 430 | 'text' => 'texty text', |
| 431 | 431 | 'status' => '200', |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | ->shouldReceive('markDead')->once()->getMock() |
| 439 | 439 | ->shouldReceive('markAlive')->once()->getMock(); |
| 440 | 440 | |
| 441 | - $mockConnectionFxn = function($host, $port=null) use ($mockConnection) { |
|
| 441 | + $mockConnectionFxn = function($host, $port=NULL) use ($mockConnection) { |
|
| 442 | 442 | return $mockConnection; |
| 443 | 443 | }; |
| 444 | 444 | |
@@ -459,8 +459,8 @@ discard block |
||
| 459 | 459 | ->shouldReceive('offsetGet')->with('connectionPool')->andReturn($mockConnectionPoolFxn)->getMock() |
| 460 | 460 | ->shouldReceive('offsetGet')->with('serializer')->andReturn($mockSerializer)->getMock() |
| 461 | 461 | ->shouldReceive('offsetGet')->with('connection')->andReturn($mockConnectionFxn)->getMock() |
| 462 | - ->shouldReceive('offsetGet')->with('sniffOnStart')->andReturn(false)->getMock() |
|
| 463 | - ->shouldReceive('offsetExists')->with('retries')->andReturn(false)->getMock() |
|
| 462 | + ->shouldReceive('offsetGet')->with('sniffOnStart')->andReturn(FALSE)->getMock() |
|
| 463 | + ->shouldReceive('offsetExists')->with('retries')->andReturn(FALSE)->getMock() |
|
| 464 | 464 | ->shouldReceive('offsetSet')->with('retries', 0)->getMock() |
| 465 | 465 | ->shouldReceive('offsetGet')->with('retries')->andReturn(1)->getMock(); |
| 466 | 466 | |
@@ -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') |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | ->with( |
| 35 | 35 | m::any(), |
| 36 | 36 | $uri, |
| 37 | - array(), |
|
| 37 | + array (), |
|
| 38 | 38 | $body |
| 39 | 39 | ) |
| 40 | 40 | ->getMock(); |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | ->with( |
| 55 | 55 | m::any(), |
| 56 | 56 | $uri, |
| 57 | - array(), |
|
| 57 | + array (), |
|
| 58 | 58 | $query |
| 59 | 59 | ) |
| 60 | 60 | ->getMock(); |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | ->with( |
| 77 | 77 | m::any(), |
| 78 | 78 | $uri, |
| 79 | - array(), |
|
| 79 | + array (), |
|
| 80 | 80 | m::any() |
| 81 | 81 | ) |
| 82 | 82 | ->getMock(); |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | ->with( |
| 96 | 96 | m::any(), |
| 97 | 97 | $uri, |
| 98 | - array(), |
|
| 98 | + array (), |
|
| 99 | 99 | m::any() |
| 100 | 100 | ) |
| 101 | 101 | ->getMock(); |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | ->with( |
| 117 | 117 | m::any(), |
| 118 | 118 | $uri, |
| 119 | - array(), |
|
| 119 | + array (), |
|
| 120 | 120 | m::any() |
| 121 | 121 | ) |
| 122 | 122 | ->getMock(); |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | ->with( |
| 138 | 138 | m::any(), |
| 139 | 139 | $uri, |
| 140 | - array(), |
|
| 140 | + array (), |
|
| 141 | 141 | m::any() |
| 142 | 142 | ) |
| 143 | 143 | ->getMock(); |
@@ -18,15 +18,13 @@ discard block |
||
| 18 | 18 | * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 |
| 19 | 19 | * @link http://elasticsearch.org |
| 20 | 20 | */ |
| 21 | -class SearchTest extends \PHPUnit_Framework_TestCase |
|
| 22 | -{ |
|
| 21 | +class SearchTest extends \PHPUnit_Framework_TestCase { |
|
| 23 | 22 | |
| 24 | 23 | public function tearDown() { |
| 25 | 24 | m::close(); |
| 26 | 25 | } |
| 27 | 26 | |
| 28 | - public function testSetStringBody() |
|
| 29 | - { |
|
| 27 | + public function testSetStringBody() { |
|
| 30 | 28 | $body = 'testQuery'; |
| 31 | 29 | $uri = '/_search'; |
| 32 | 30 | $mockTransport = m::mock('\Elasticsearch\Transport') |
@@ -45,8 +43,7 @@ discard block |
||
| 45 | 43 | |
| 46 | 44 | } |
| 47 | 45 | |
| 48 | - public function testSetArrayQuery() |
|
| 49 | - { |
|
| 46 | + public function testSetArrayQuery() { |
|
| 50 | 47 | $query['query'] = 'testQuery'; |
| 51 | 48 | $uri = '/_search'; |
| 52 | 49 | $mockTransport = m::mock('\Elasticsearch\Transport') |
@@ -66,8 +63,7 @@ discard block |
||
| 66 | 63 | } |
| 67 | 64 | |
| 68 | 65 | |
| 69 | - public function testGetURIWithNoIndexOrType() |
|
| 70 | - { |
|
| 66 | + public function testGetURIWithNoIndexOrType() { |
|
| 71 | 67 | |
| 72 | 68 | $uri = '/_search'; |
| 73 | 69 | |
@@ -86,8 +82,7 @@ discard block |
||
| 86 | 82 | |
| 87 | 83 | } |
| 88 | 84 | |
| 89 | - public function testGetURIWithIndexButNoType() |
|
| 90 | - { |
|
| 85 | + public function testGetURIWithIndexButNoType() { |
|
| 91 | 86 | $uri = '/testIndex/_search'; |
| 92 | 87 | |
| 93 | 88 | $mockTransport = m::mock('\Elasticsearch\Transport') |
@@ -106,8 +101,7 @@ discard block |
||
| 106 | 101 | |
| 107 | 102 | } |
| 108 | 103 | |
| 109 | - public function testGetURIWithTypeButNoIndex() |
|
| 110 | - { |
|
| 104 | + public function testGetURIWithTypeButNoIndex() { |
|
| 111 | 105 | |
| 112 | 106 | $uri = '/_all/testType/_search'; |
| 113 | 107 | |
@@ -127,8 +121,7 @@ discard block |
||
| 127 | 121 | |
| 128 | 122 | } |
| 129 | 123 | |
| 130 | - public function testGetURIWithBothTypeAndIndex() |
|
| 131 | - { |
|
| 124 | + public function testGetURIWithBothTypeAndIndex() { |
|
| 132 | 125 | |
| 133 | 126 | $uri = '/testIndex/testType/_search'; |
| 134 | 127 | |
@@ -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') |
@@ -84,7 +84,7 @@ |
||
| 84 | 84 | ->with( |
| 85 | 85 | 'DELETE', |
| 86 | 86 | '/testIndex/testType/testID', |
| 87 | - array(), |
|
| 87 | + array (), |
|
| 88 | 88 | null |
| 89 | 89 | ) |
| 90 | 90 | ->getMock(); |
@@ -18,8 +18,7 @@ discard block |
||
| 18 | 18 | * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 |
| 19 | 19 | * @link http://elasticsearch.org |
| 20 | 20 | */ |
| 21 | -class DeleteTest extends \PHPUnit_Framework_TestCase |
|
| 22 | -{ |
|
| 21 | +class DeleteTest extends \PHPUnit_Framework_TestCase { |
|
| 23 | 22 | public function tearDown() { |
| 24 | 23 | m::close(); |
| 25 | 24 | } |
@@ -28,8 +27,7 @@ discard block |
||
| 28 | 27 | /** |
| 29 | 28 | * @expectedException RuntimeException |
| 30 | 29 | */ |
| 31 | - public function testNoIndexTypeOrID() |
|
| 32 | - { |
|
| 30 | + public function testNoIndexTypeOrID() { |
|
| 33 | 31 | |
| 34 | 32 | $mockTransport = m::mock('\Elasticsearch\Transport'); |
| 35 | 33 | |
@@ -41,8 +39,7 @@ discard block |
||
| 41 | 39 | /** |
| 42 | 40 | * @expectedException RuntimeException |
| 43 | 41 | */ |
| 44 | - public function testNoIndex() |
|
| 45 | - { |
|
| 42 | + public function testNoIndex() { |
|
| 46 | 43 | |
| 47 | 44 | $mockTransport = m::mock('\Elasticsearch\Transport'); |
| 48 | 45 | |
@@ -54,8 +51,7 @@ discard block |
||
| 54 | 51 | /** |
| 55 | 52 | * @expectedException RuntimeException |
| 56 | 53 | */ |
| 57 | - public function testNoType() |
|
| 58 | - { |
|
| 54 | + public function testNoType() { |
|
| 59 | 55 | |
| 60 | 56 | $mockTransport = m::mock('\Elasticsearch\Transport'); |
| 61 | 57 | |
@@ -67,8 +63,7 @@ discard block |
||
| 67 | 63 | /** |
| 68 | 64 | * @expectedException RuntimeException |
| 69 | 65 | */ |
| 70 | - public function testNoID() |
|
| 71 | - { |
|
| 66 | + public function testNoID() { |
|
| 72 | 67 | |
| 73 | 68 | $mockTransport = m::mock('\Elasticsearch\Transport'); |
| 74 | 69 | |
@@ -77,8 +72,7 @@ discard block |
||
| 77 | 72 | |
| 78 | 73 | } |
| 79 | 74 | |
| 80 | - public function testValidDelete() |
|
| 81 | - { |
|
| 75 | + public function testValidDelete() { |
|
| 82 | 76 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 83 | 77 | ->shouldReceive('performRequest')->once() |
| 84 | 78 | ->with( |
@@ -85,7 +85,7 @@ |
||
| 85 | 85 | 'DELETE', |
| 86 | 86 | '/testIndex/testType/testID', |
| 87 | 87 | array(), |
| 88 | - null |
|
| 88 | + NULL |
|
| 89 | 89 | ) |
| 90 | 90 | ->getMock(); |
| 91 | 91 | |
@@ -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') |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | ->with( |
| 59 | 59 | 'GET', |
| 60 | 60 | '/testIndex/testType/_percolate', |
| 61 | - array(), |
|
| 61 | + array (), |
|
| 62 | 62 | $body |
| 63 | 63 | ) |
| 64 | 64 | ->getMock(); |
@@ -18,8 +18,7 @@ discard block |
||
| 18 | 18 | * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 |
| 19 | 19 | * @link http://elasticsearch.org |
| 20 | 20 | */ |
| 21 | -class PercolateTest extends \PHPUnit_Framework_TestCase |
|
| 22 | -{ |
|
| 21 | +class PercolateTest extends \PHPUnit_Framework_TestCase { |
|
| 23 | 22 | public function tearDown() { |
| 24 | 23 | m::close(); |
| 25 | 24 | } |
@@ -27,8 +26,7 @@ discard block |
||
| 27 | 26 | /** |
| 28 | 27 | * @expectedException RuntimeException |
| 29 | 28 | */ |
| 30 | - public function testNoIndex() |
|
| 31 | - { |
|
| 29 | + public function testNoIndex() { |
|
| 32 | 30 | |
| 33 | 31 | $mockTransport = m::mock('\Elasticsearch\Transport'); |
| 34 | 32 | |
@@ -40,8 +38,7 @@ discard block |
||
| 40 | 38 | /** |
| 41 | 39 | * @expectedException RuntimeException |
| 42 | 40 | */ |
| 43 | - public function testNoType() |
|
| 44 | - { |
|
| 41 | + public function testNoType() { |
|
| 45 | 42 | |
| 46 | 43 | $mockTransport = m::mock('\Elasticsearch\Transport'); |
| 47 | 44 | |
@@ -50,8 +47,7 @@ discard block |
||
| 50 | 47 | |
| 51 | 48 | } |
| 52 | 49 | |
| 53 | - public function testValidPercolate() |
|
| 54 | - { |
|
| 50 | + public function testValidPercolate() { |
|
| 55 | 51 | $body = 'abc'; |
| 56 | 52 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 57 | 53 | ->shouldReceive('performRequest')->once() |
@@ -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); |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | ->with( |
| 34 | 34 | m::any(), |
| 35 | 35 | m::any(), |
| 36 | - array(), |
|
| 36 | + array (), |
|
| 37 | 37 | 'bulk data' |
| 38 | 38 | ) |
| 39 | 39 | ->getMock(); |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | ->with( |
| 58 | 58 | m::any(), |
| 59 | 59 | $uri, |
| 60 | - array(), |
|
| 60 | + array (), |
|
| 61 | 61 | m::any() |
| 62 | 62 | ) |
| 63 | 63 | ->getMock(); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | ->with( |
| 78 | 78 | m::any(), |
| 79 | 79 | $uri, |
| 80 | - array(), |
|
| 80 | + array (), |
|
| 81 | 81 | m::any() |
| 82 | 82 | ) |
| 83 | 83 | ->getMock(); |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | ->with( |
| 100 | 100 | m::any(), |
| 101 | 101 | $uri, |
| 102 | - array(), |
|
| 102 | + array (), |
|
| 103 | 103 | m::any() |
| 104 | 104 | ) |
| 105 | 105 | ->getMock(); |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | ->with( |
| 122 | 122 | m::any(), |
| 123 | 123 | $uri, |
| 124 | - array(), |
|
| 124 | + array (), |
|
| 125 | 125 | m::any() |
| 126 | 126 | ) |
| 127 | 127 | ->getMock(); |
@@ -18,15 +18,13 @@ discard block |
||
| 18 | 18 | * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 |
| 19 | 19 | * @link http://elasticsearch.org |
| 20 | 20 | */ |
| 21 | -class BulkTest extends \PHPUnit_Framework_TestCase |
|
| 22 | -{ |
|
| 21 | +class BulkTest extends \PHPUnit_Framework_TestCase { |
|
| 23 | 22 | |
| 24 | 23 | public function tearDown() { |
| 25 | 24 | m::close(); |
| 26 | 25 | } |
| 27 | 26 | |
| 28 | - public function testSetBody() |
|
| 29 | - { |
|
| 27 | + public function testSetBody() { |
|
| 30 | 28 | |
| 31 | 29 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 32 | 30 | ->shouldReceive('performRequest')->once()->once() |
@@ -47,8 +45,7 @@ discard block |
||
| 47 | 45 | } |
| 48 | 46 | |
| 49 | 47 | |
| 50 | - public function testGetURIWithNoIndexOrType() |
|
| 51 | - { |
|
| 48 | + public function testGetURIWithNoIndexOrType() { |
|
| 52 | 49 | |
| 53 | 50 | $uri = '/_all/_bulk'; |
| 54 | 51 | |
@@ -68,8 +65,7 @@ discard block |
||
| 68 | 65 | |
| 69 | 66 | } |
| 70 | 67 | |
| 71 | - public function testGetURIWithIndexButNoType() |
|
| 72 | - { |
|
| 68 | + public function testGetURIWithIndexButNoType() { |
|
| 73 | 69 | $uri = '/testIndex/_bulk'; |
| 74 | 70 | |
| 75 | 71 | $mockTransport = m::mock('\Elasticsearch\Transport') |
@@ -89,8 +85,7 @@ discard block |
||
| 89 | 85 | |
| 90 | 86 | } |
| 91 | 87 | |
| 92 | - public function testGetURIWithTypeButNoIndex() |
|
| 93 | - { |
|
| 88 | + public function testGetURIWithTypeButNoIndex() { |
|
| 94 | 89 | |
| 95 | 90 | $uri = '/_all/testType/_bulk'; |
| 96 | 91 | |
@@ -111,8 +106,7 @@ discard block |
||
| 111 | 106 | |
| 112 | 107 | } |
| 113 | 108 | |
| 114 | - public function testGetURIWithBothTypeAndIndex() |
|
| 115 | - { |
|
| 109 | + public function testGetURIWithBothTypeAndIndex() { |
|
| 116 | 110 | |
| 117 | 111 | $uri = '/testIndex/testType/_bulk'; |
| 118 | 112 | |
@@ -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') |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | ->with( |
| 35 | 35 | m::any(), |
| 36 | 36 | $uri, |
| 37 | - array(), |
|
| 37 | + array (), |
|
| 38 | 38 | m::any() |
| 39 | 39 | ) |
| 40 | 40 | ->getMock(); |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | ->with( |
| 54 | 54 | m::any(), |
| 55 | 55 | $uri, |
| 56 | - array(), |
|
| 56 | + array (), |
|
| 57 | 57 | m::any() |
| 58 | 58 | ) |
| 59 | 59 | ->getMock(); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | ->with( |
| 75 | 75 | m::any(), |
| 76 | 76 | $uri, |
| 77 | - array(), |
|
| 77 | + array (), |
|
| 78 | 78 | m::any() |
| 79 | 79 | ) |
| 80 | 80 | ->getMock(); |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | ->with( |
| 96 | 96 | m::any(), |
| 97 | 97 | $uri, |
| 98 | - array(), |
|
| 98 | + array (), |
|
| 99 | 99 | m::any() |
| 100 | 100 | ) |
| 101 | 101 | ->getMock(); |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | ->with( |
| 115 | 115 | 'GET', |
| 116 | 116 | '/testIndex/testType/_count', |
| 117 | - array(), |
|
| 117 | + array (), |
|
| 118 | 118 | null |
| 119 | 119 | ) |
| 120 | 120 | ->getMock(); |
@@ -17,15 +17,13 @@ discard block |
||
| 17 | 17 | * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 |
| 18 | 18 | * @link http://elasticsearch.org |
| 19 | 19 | */ |
| 20 | -class CountTest extends \PHPUnit_Framework_TestCase |
|
| 21 | -{ |
|
| 20 | +class CountTest extends \PHPUnit_Framework_TestCase { |
|
| 22 | 21 | public function tearDown() { |
| 23 | 22 | m::close(); |
| 24 | 23 | } |
| 25 | 24 | |
| 26 | 25 | |
| 27 | - public function testGetURIWithNoIndexOrType() |
|
| 28 | - { |
|
| 26 | + public function testGetURIWithNoIndexOrType() { |
|
| 29 | 27 | |
| 30 | 28 | $uri = '/_count'; |
| 31 | 29 | |
@@ -44,8 +42,7 @@ discard block |
||
| 44 | 42 | |
| 45 | 43 | } |
| 46 | 44 | |
| 47 | - public function testGetURIWithIndexButNoType() |
|
| 48 | - { |
|
| 45 | + public function testGetURIWithIndexButNoType() { |
|
| 49 | 46 | $uri = '/testIndex/_count'; |
| 50 | 47 | |
| 51 | 48 | $mockTransport = m::mock('\Elasticsearch\Transport') |
@@ -64,8 +61,7 @@ discard block |
||
| 64 | 61 | |
| 65 | 62 | } |
| 66 | 63 | |
| 67 | - public function testGetURIWithTypeButNoIndex() |
|
| 68 | - { |
|
| 64 | + public function testGetURIWithTypeButNoIndex() { |
|
| 69 | 65 | |
| 70 | 66 | $uri = '/_all/testType/_count'; |
| 71 | 67 | |
@@ -85,8 +81,7 @@ discard block |
||
| 85 | 81 | |
| 86 | 82 | } |
| 87 | 83 | |
| 88 | - public function testGetURIWithBothTypeAndIndex() |
|
| 89 | - { |
|
| 84 | + public function testGetURIWithBothTypeAndIndex() { |
|
| 90 | 85 | |
| 91 | 86 | $uri = '/testIndex/testType/_count'; |
| 92 | 87 | |
@@ -107,8 +102,7 @@ discard block |
||
| 107 | 102 | |
| 108 | 103 | } |
| 109 | 104 | |
| 110 | - public function testValidCount() |
|
| 111 | - { |
|
| 105 | + public function testValidCount() { |
|
| 112 | 106 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 113 | 107 | ->shouldReceive('performRequest')->once() |
| 114 | 108 | ->with( |
@@ -115,7 +115,7 @@ |
||
| 115 | 115 | 'GET', |
| 116 | 116 | '/testIndex/testType/_count', |
| 117 | 117 | array(), |
| 118 | - null |
|
| 118 | + NULL |
|
| 119 | 119 | ) |
| 120 | 120 | ->getMock(); |
| 121 | 121 | |