@@ -30,14 +30,14 @@ discard block |
||
| 30 | 30 | $body['docs'] = '1'; |
| 31 | 31 | |
| 32 | 32 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 33 | - ->shouldReceive('performRequest')->once() |
|
| 34 | - ->with( |
|
| 35 | - m::any(), |
|
| 36 | - m::any(), |
|
| 37 | - array(), |
|
| 38 | - $body |
|
| 39 | - ) |
|
| 40 | - ->getMock(); |
|
| 33 | + ->shouldReceive('performRequest')->once() |
|
| 34 | + ->with( |
|
| 35 | + m::any(), |
|
| 36 | + m::any(), |
|
| 37 | + array(), |
|
| 38 | + $body |
|
| 39 | + ) |
|
| 40 | + ->getMock(); |
|
| 41 | 41 | |
| 42 | 42 | $action = new Mget($mockTransport); |
| 43 | 43 | $action->setBody($body) |
@@ -52,14 +52,14 @@ discard block |
||
| 52 | 52 | $uri = '/_mget'; |
| 53 | 53 | $body['docs'] = '1'; |
| 54 | 54 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 55 | - ->shouldReceive('performRequest')->once() |
|
| 56 | - ->with( |
|
| 57 | - m::any(), |
|
| 58 | - $uri, |
|
| 59 | - array(), |
|
| 60 | - $body |
|
| 61 | - ) |
|
| 62 | - ->getMock(); |
|
| 55 | + ->shouldReceive('performRequest')->once() |
|
| 56 | + ->with( |
|
| 57 | + m::any(), |
|
| 58 | + $uri, |
|
| 59 | + array(), |
|
| 60 | + $body |
|
| 61 | + ) |
|
| 62 | + ->getMock(); |
|
| 63 | 63 | |
| 64 | 64 | $action = new Mget($mockTransport); |
| 65 | 65 | $action->setBody($body)->performRequest(); |
@@ -71,14 +71,14 @@ discard block |
||
| 71 | 71 | $uri = '/testIndex/_mget'; |
| 72 | 72 | $body['docs'] = '1'; |
| 73 | 73 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 74 | - ->shouldReceive('performRequest')->once() |
|
| 75 | - ->with( |
|
| 76 | - m::any(), |
|
| 77 | - $uri, |
|
| 78 | - array(), |
|
| 79 | - $body |
|
| 80 | - ) |
|
| 81 | - ->getMock(); |
|
| 74 | + ->shouldReceive('performRequest')->once() |
|
| 75 | + ->with( |
|
| 76 | + m::any(), |
|
| 77 | + $uri, |
|
| 78 | + array(), |
|
| 79 | + $body |
|
| 80 | + ) |
|
| 81 | + ->getMock(); |
|
| 82 | 82 | |
| 83 | 83 | $action = new Mget($mockTransport); |
| 84 | 84 | $action->setBody($body)->setIndex('testIndex') |
@@ -92,14 +92,14 @@ discard block |
||
| 92 | 92 | $uri = '/_all/testType/_mget'; |
| 93 | 93 | $body['docs'] = '1'; |
| 94 | 94 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 95 | - ->shouldReceive('performRequest')->once() |
|
| 96 | - ->with( |
|
| 97 | - m::any(), |
|
| 98 | - $uri, |
|
| 99 | - array(), |
|
| 100 | - $body |
|
| 101 | - ) |
|
| 102 | - ->getMock(); |
|
| 95 | + ->shouldReceive('performRequest')->once() |
|
| 96 | + ->with( |
|
| 97 | + m::any(), |
|
| 98 | + $uri, |
|
| 99 | + array(), |
|
| 100 | + $body |
|
| 101 | + ) |
|
| 102 | + ->getMock(); |
|
| 103 | 103 | |
| 104 | 104 | $action = new Mget($mockTransport); |
| 105 | 105 | $action->setBody($body)->setType('testType') |
@@ -113,14 +113,14 @@ discard block |
||
| 113 | 113 | $uri = '/testIndex/testType/_mget'; |
| 114 | 114 | $body['docs'] = '1'; |
| 115 | 115 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 116 | - ->shouldReceive('performRequest')->once() |
|
| 117 | - ->with( |
|
| 118 | - m::any(), |
|
| 119 | - $uri, |
|
| 120 | - array(), |
|
| 121 | - m::any() |
|
| 122 | - ) |
|
| 123 | - ->getMock(); |
|
| 116 | + ->shouldReceive('performRequest')->once() |
|
| 117 | + ->with( |
|
| 118 | + m::any(), |
|
| 119 | + $uri, |
|
| 120 | + array(), |
|
| 121 | + m::any() |
|
| 122 | + ) |
|
| 123 | + ->getMock(); |
|
| 124 | 124 | |
| 125 | 125 | $action = new Mget($mockTransport); |
| 126 | 126 | $action->setBody($body)->setIndex('testIndex') |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | ->with( |
| 35 | 35 | m::any(), |
| 36 | 36 | m::any(), |
| 37 | - array(), |
|
| 37 | + array (), |
|
| 38 | 38 | $body |
| 39 | 39 | ) |
| 40 | 40 | ->getMock(); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | ->with( |
| 57 | 57 | m::any(), |
| 58 | 58 | $uri, |
| 59 | - array(), |
|
| 59 | + array (), |
|
| 60 | 60 | $body |
| 61 | 61 | ) |
| 62 | 62 | ->getMock(); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | ->with( |
| 76 | 76 | m::any(), |
| 77 | 77 | $uri, |
| 78 | - array(), |
|
| 78 | + array (), |
|
| 79 | 79 | $body |
| 80 | 80 | ) |
| 81 | 81 | ->getMock(); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | ->with( |
| 97 | 97 | m::any(), |
| 98 | 98 | $uri, |
| 99 | - array(), |
|
| 99 | + array (), |
|
| 100 | 100 | $body |
| 101 | 101 | ) |
| 102 | 102 | ->getMock(); |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | ->with( |
| 118 | 118 | m::any(), |
| 119 | 119 | $uri, |
| 120 | - array(), |
|
| 120 | + array (), |
|
| 121 | 121 | m::any() |
| 122 | 122 | ) |
| 123 | 123 | ->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 MgetTest extends \PHPUnit_Framework_TestCase |
|
| 22 | -{ |
|
| 21 | +class MgetTest 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 | $body['docs'] = '1'; |
| 31 | 29 | |
| 32 | 30 | $mockTransport = m::mock('\Elasticsearch\Transport') |
@@ -46,8 +44,7 @@ discard block |
||
| 46 | 44 | } |
| 47 | 45 | |
| 48 | 46 | |
| 49 | - public function testGetURIWithNoIndexOrType() |
|
| 50 | - { |
|
| 47 | + public function testGetURIWithNoIndexOrType() { |
|
| 51 | 48 | |
| 52 | 49 | $uri = '/_mget'; |
| 53 | 50 | $body['docs'] = '1'; |
@@ -66,8 +63,7 @@ discard block |
||
| 66 | 63 | |
| 67 | 64 | } |
| 68 | 65 | |
| 69 | - public function testGetURIWithIndexButNoType() |
|
| 70 | - { |
|
| 66 | + public function testGetURIWithIndexButNoType() { |
|
| 71 | 67 | $uri = '/testIndex/_mget'; |
| 72 | 68 | $body['docs'] = '1'; |
| 73 | 69 | $mockTransport = m::mock('\Elasticsearch\Transport') |
@@ -86,8 +82,7 @@ discard block |
||
| 86 | 82 | |
| 87 | 83 | } |
| 88 | 84 | |
| 89 | - public function testGetURIWithTypeButNoIndex() |
|
| 90 | - { |
|
| 85 | + public function testGetURIWithTypeButNoIndex() { |
|
| 91 | 86 | |
| 92 | 87 | $uri = '/_all/testType/_mget'; |
| 93 | 88 | $body['docs'] = '1'; |
@@ -107,8 +102,7 @@ discard block |
||
| 107 | 102 | |
| 108 | 103 | } |
| 109 | 104 | |
| 110 | - public function testGetURIWithBothTypeAndIndex() |
|
| 111 | - { |
|
| 105 | + public function testGetURIWithBothTypeAndIndex() { |
|
| 112 | 106 | |
| 113 | 107 | $uri = '/testIndex/testType/_mget'; |
| 114 | 108 | $body['docs'] = '1'; |
@@ -46,14 +46,14 @@ discard block |
||
| 46 | 46 | $uri = '/_msearch'; |
| 47 | 47 | $body = 'abc'; |
| 48 | 48 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 49 | - ->shouldReceive('performRequest')->once() |
|
| 50 | - ->with( |
|
| 51 | - m::any(), |
|
| 52 | - $uri, |
|
| 53 | - array(), |
|
| 54 | - $body |
|
| 55 | - ) |
|
| 56 | - ->getMock(); |
|
| 49 | + ->shouldReceive('performRequest')->once() |
|
| 50 | + ->with( |
|
| 51 | + m::any(), |
|
| 52 | + $uri, |
|
| 53 | + array(), |
|
| 54 | + $body |
|
| 55 | + ) |
|
| 56 | + ->getMock(); |
|
| 57 | 57 | $mockSerializer = m::mock('\Elasticsearch\Serializers\ArrayToJSONSerializer'); |
| 58 | 58 | |
| 59 | 59 | $action = new Msearch($mockTransport, $mockSerializer); |
@@ -66,14 +66,14 @@ discard block |
||
| 66 | 66 | $uri = '/testIndex/_msearch'; |
| 67 | 67 | $body = 'abc'; |
| 68 | 68 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 69 | - ->shouldReceive('performRequest')->once() |
|
| 70 | - ->with( |
|
| 71 | - m::any(), |
|
| 72 | - $uri, |
|
| 73 | - array(), |
|
| 74 | - $body |
|
| 75 | - ) |
|
| 76 | - ->getMock(); |
|
| 69 | + ->shouldReceive('performRequest')->once() |
|
| 70 | + ->with( |
|
| 71 | + m::any(), |
|
| 72 | + $uri, |
|
| 73 | + array(), |
|
| 74 | + $body |
|
| 75 | + ) |
|
| 76 | + ->getMock(); |
|
| 77 | 77 | |
| 78 | 78 | $mockSerializer = m::mock('\Elasticsearch\Serializers\ArrayToJSONSerializer'); |
| 79 | 79 | |
@@ -89,14 +89,14 @@ discard block |
||
| 89 | 89 | $uri = '/_all/testType/_msearch'; |
| 90 | 90 | $body = 'abc'; |
| 91 | 91 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 92 | - ->shouldReceive('performRequest')->once() |
|
| 93 | - ->with( |
|
| 94 | - m::any(), |
|
| 95 | - $uri, |
|
| 96 | - array(), |
|
| 97 | - $body |
|
| 98 | - ) |
|
| 99 | - ->getMock(); |
|
| 92 | + ->shouldReceive('performRequest')->once() |
|
| 93 | + ->with( |
|
| 94 | + m::any(), |
|
| 95 | + $uri, |
|
| 96 | + array(), |
|
| 97 | + $body |
|
| 98 | + ) |
|
| 99 | + ->getMock(); |
|
| 100 | 100 | |
| 101 | 101 | $mockSerializer = m::mock('\Elasticsearch\Serializers\ArrayToJSONSerializer'); |
| 102 | 102 | |
@@ -112,14 +112,14 @@ discard block |
||
| 112 | 112 | $uri = '/testIndex/testType/_msearch'; |
| 113 | 113 | $body = 'abc'; |
| 114 | 114 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 115 | - ->shouldReceive('performRequest')->once() |
|
| 116 | - ->with( |
|
| 117 | - m::any(), |
|
| 118 | - $uri, |
|
| 119 | - array(), |
|
| 120 | - $body |
|
| 121 | - ) |
|
| 122 | - ->getMock(); |
|
| 115 | + ->shouldReceive('performRequest')->once() |
|
| 116 | + ->with( |
|
| 117 | + m::any(), |
|
| 118 | + $uri, |
|
| 119 | + array(), |
|
| 120 | + $body |
|
| 121 | + ) |
|
| 122 | + ->getMock(); |
|
| 123 | 123 | |
| 124 | 124 | $mockSerializer = m::mock('\Elasticsearch\Serializers\ArrayToJSONSerializer'); |
| 125 | 125 | |
@@ -135,14 +135,14 @@ discard block |
||
| 135 | 135 | { |
| 136 | 136 | $body = 'abc'; |
| 137 | 137 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 138 | - ->shouldReceive('performRequest')->once() |
|
| 139 | - ->with( |
|
| 140 | - 'GET', |
|
| 141 | - '/testIndex/testType/_msearch', |
|
| 142 | - array(), |
|
| 143 | - $body |
|
| 144 | - ) |
|
| 145 | - ->getMock(); |
|
| 138 | + ->shouldReceive('performRequest')->once() |
|
| 139 | + ->with( |
|
| 140 | + 'GET', |
|
| 141 | + '/testIndex/testType/_msearch', |
|
| 142 | + array(), |
|
| 143 | + $body |
|
| 144 | + ) |
|
| 145 | + ->getMock(); |
|
| 146 | 146 | |
| 147 | 147 | $mockSerializer = m::mock('\Elasticsearch\Serializers\ArrayToJSONSerializer'); |
| 148 | 148 | |
@@ -159,26 +159,26 @@ discard block |
||
| 159 | 159 | $body = array(array('query'=>array('match_all' => array())),array('query'=>array('match_all' => array()))); |
| 160 | 160 | $serializedBody = json_encode($body[0])."\n".json_encode($body[1])."\n"; |
| 161 | 161 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 162 | - ->shouldReceive('performRequest')->once() |
|
| 163 | - ->with( |
|
| 164 | - m::any(), |
|
| 165 | - $uri, |
|
| 166 | - array(), |
|
| 167 | - $serializedBody |
|
| 168 | - ) |
|
| 169 | - ->getMock(); |
|
| 162 | + ->shouldReceive('performRequest')->once() |
|
| 163 | + ->with( |
|
| 164 | + m::any(), |
|
| 165 | + $uri, |
|
| 166 | + array(), |
|
| 167 | + $serializedBody |
|
| 168 | + ) |
|
| 169 | + ->getMock(); |
|
| 170 | 170 | |
| 171 | 171 | $mockSerializer = m::mock('\Elasticsearch\Serializers\ArrayToJSONSerializer') |
| 172 | - ->shouldReceive('serialize') |
|
| 173 | - ->once() |
|
| 174 | - ->with($body[0]) |
|
| 175 | - ->andReturn(json_encode($body[0])) |
|
| 176 | - ->getMock() |
|
| 177 | - ->shouldReceive('serialize') |
|
| 178 | - ->once() |
|
| 179 | - ->with($body[1]) |
|
| 180 | - ->andReturn(json_encode($body[1])) |
|
| 181 | - ->getMock(); |
|
| 172 | + ->shouldReceive('serialize') |
|
| 173 | + ->once() |
|
| 174 | + ->with($body[0]) |
|
| 175 | + ->andReturn(json_encode($body[0])) |
|
| 176 | + ->getMock() |
|
| 177 | + ->shouldReceive('serialize') |
|
| 178 | + ->once() |
|
| 179 | + ->with($body[1]) |
|
| 180 | + ->andReturn(json_encode($body[1])) |
|
| 181 | + ->getMock(); |
|
| 182 | 182 | |
| 183 | 183 | $action = new Msearch($mockTransport, $mockSerializer); |
| 184 | 184 | $action->setBody($body)->performRequest(); |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | ->with( |
| 51 | 51 | m::any(), |
| 52 | 52 | $uri, |
| 53 | - array(), |
|
| 53 | + array (), |
|
| 54 | 54 | $body |
| 55 | 55 | ) |
| 56 | 56 | ->getMock(); |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | ->with( |
| 71 | 71 | m::any(), |
| 72 | 72 | $uri, |
| 73 | - array(), |
|
| 73 | + array (), |
|
| 74 | 74 | $body |
| 75 | 75 | ) |
| 76 | 76 | ->getMock(); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | ->with( |
| 94 | 94 | m::any(), |
| 95 | 95 | $uri, |
| 96 | - array(), |
|
| 96 | + array (), |
|
| 97 | 97 | $body |
| 98 | 98 | ) |
| 99 | 99 | ->getMock(); |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | ->with( |
| 117 | 117 | m::any(), |
| 118 | 118 | $uri, |
| 119 | - array(), |
|
| 119 | + array (), |
|
| 120 | 120 | $body |
| 121 | 121 | ) |
| 122 | 122 | ->getMock(); |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | ->with( |
| 140 | 140 | 'GET', |
| 141 | 141 | '/testIndex/testType/_msearch', |
| 142 | - array(), |
|
| 142 | + array (), |
|
| 143 | 143 | $body |
| 144 | 144 | ) |
| 145 | 145 | ->getMock(); |
@@ -156,14 +156,14 @@ discard block |
||
| 156 | 156 | public function testSerializeArrayBody() |
| 157 | 157 | { |
| 158 | 158 | $uri = '/_msearch'; |
| 159 | - $body = array(array('query'=>array('match_all' => array())),array('query'=>array('match_all' => array()))); |
|
| 160 | - $serializedBody = json_encode($body[0])."\n".json_encode($body[1])."\n"; |
|
| 159 | + $body = array (array ('query'=>array ('match_all' => array ())), array ('query'=>array ('match_all' => array ()))); |
|
| 160 | + $serializedBody = json_encode($body[0]) . "\n" . json_encode($body[1]) . "\n"; |
|
| 161 | 161 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 162 | 162 | ->shouldReceive('performRequest')->once() |
| 163 | 163 | ->with( |
| 164 | 164 | m::any(), |
| 165 | 165 | $uri, |
| 166 | - array(), |
|
| 166 | + array (), |
|
| 167 | 167 | $serializedBody |
| 168 | 168 | ) |
| 169 | 169 | ->getMock(); |
@@ -19,8 +19,7 @@ discard block |
||
| 19 | 19 | * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 |
| 20 | 20 | * @link http://elasticsearch.org |
| 21 | 21 | */ |
| 22 | -class MsearchTest extends \PHPUnit_Framework_TestCase |
|
| 23 | -{ |
|
| 22 | +class MsearchTest extends \PHPUnit_Framework_TestCase { |
|
| 24 | 23 | |
| 25 | 24 | public function tearDown() { |
| 26 | 25 | m::close(); |
@@ -30,8 +29,7 @@ discard block |
||
| 30 | 29 | /** |
| 31 | 30 | * @expectedException RuntimeException |
| 32 | 31 | */ |
| 33 | - public function testGetURIWithNoIndexTypeOrBody() |
|
| 34 | - { |
|
| 32 | + public function testGetURIWithNoIndexTypeOrBody() { |
|
| 35 | 33 | $mockTransport = m::mock('\Elasticsearch\Transport'); |
| 36 | 34 | $mockSerializer = m::mock('\Elasticsearch\Serializers\ArrayToJSONSerializer'); |
| 37 | 35 | |
@@ -40,8 +38,7 @@ discard block |
||
| 40 | 38 | |
| 41 | 39 | } |
| 42 | 40 | |
| 43 | - public function testGetURIWithNoIndexOrType() |
|
| 44 | - { |
|
| 41 | + public function testGetURIWithNoIndexOrType() { |
|
| 45 | 42 | |
| 46 | 43 | $uri = '/_msearch'; |
| 47 | 44 | $body = 'abc'; |
@@ -61,8 +58,7 @@ discard block |
||
| 61 | 58 | |
| 62 | 59 | } |
| 63 | 60 | |
| 64 | - public function testGetURIWithIndexButNoType() |
|
| 65 | - { |
|
| 61 | + public function testGetURIWithIndexButNoType() { |
|
| 66 | 62 | $uri = '/testIndex/_msearch'; |
| 67 | 63 | $body = 'abc'; |
| 68 | 64 | $mockTransport = m::mock('\Elasticsearch\Transport') |
@@ -83,8 +79,7 @@ discard block |
||
| 83 | 79 | |
| 84 | 80 | } |
| 85 | 81 | |
| 86 | - public function testGetURIWithTypeButNoIndex() |
|
| 87 | - { |
|
| 82 | + public function testGetURIWithTypeButNoIndex() { |
|
| 88 | 83 | |
| 89 | 84 | $uri = '/_all/testType/_msearch'; |
| 90 | 85 | $body = 'abc'; |
@@ -106,8 +101,7 @@ discard block |
||
| 106 | 101 | |
| 107 | 102 | } |
| 108 | 103 | |
| 109 | - public function testGetURIWithBothTypeAndIndex() |
|
| 110 | - { |
|
| 104 | + public function testGetURIWithBothTypeAndIndex() { |
|
| 111 | 105 | |
| 112 | 106 | $uri = '/testIndex/testType/_msearch'; |
| 113 | 107 | $body = 'abc'; |
@@ -131,8 +125,7 @@ discard block |
||
| 131 | 125 | } |
| 132 | 126 | |
| 133 | 127 | |
| 134 | - public function testValidMsearch() |
|
| 135 | - { |
|
| 128 | + public function testValidMsearch() { |
|
| 136 | 129 | $body = 'abc'; |
| 137 | 130 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 138 | 131 | ->shouldReceive('performRequest')->once() |
@@ -153,8 +146,7 @@ discard block |
||
| 153 | 146 | |
| 154 | 147 | } |
| 155 | 148 | |
| 156 | - public function testSerializeArrayBody() |
|
| 157 | - { |
|
| 149 | + public function testSerializeArrayBody() { |
|
| 158 | 150 | $uri = '/_msearch'; |
| 159 | 151 | $body = array(array('query'=>array('match_all' => array())),array('query'=>array('match_all' => array()))); |
| 160 | 152 | $serializedBody = json_encode($body[0])."\n".json_encode($body[1])."\n"; |
@@ -29,14 +29,14 @@ discard block |
||
| 29 | 29 | public function testPerformRequest() |
| 30 | 30 | { |
| 31 | 31 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 32 | - ->shouldReceive('performRequest')->once()->once() |
|
| 33 | - ->with( |
|
| 34 | - 'GET', |
|
| 35 | - '/testIndex/', |
|
| 36 | - array(), |
|
| 37 | - null |
|
| 38 | - ) |
|
| 39 | - ->getMock(); |
|
| 32 | + ->shouldReceive('performRequest')->once()->once() |
|
| 33 | + ->with( |
|
| 34 | + 'GET', |
|
| 35 | + '/testIndex/', |
|
| 36 | + array(), |
|
| 37 | + null |
|
| 38 | + ) |
|
| 39 | + ->getMock(); |
|
| 40 | 40 | |
| 41 | 41 | $stub = $this->getMockForAbstractClass('\Elasticsearch\Endpoints\AbstractEndpoint', array($mockTransport)); |
| 42 | 42 | |
@@ -138,14 +138,14 @@ discard block |
||
| 138 | 138 | ); |
| 139 | 139 | |
| 140 | 140 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 141 | - ->shouldReceive('performRequest')->once()->once() |
|
| 142 | - ->with( |
|
| 143 | - 'GET', |
|
| 144 | - '/testIndex/', |
|
| 145 | - $params, |
|
| 146 | - null |
|
| 147 | - ) |
|
| 148 | - ->getMock(); |
|
| 141 | + ->shouldReceive('performRequest')->once()->once() |
|
| 142 | + ->with( |
|
| 143 | + 'GET', |
|
| 144 | + '/testIndex/', |
|
| 145 | + $params, |
|
| 146 | + null |
|
| 147 | + ) |
|
| 148 | + ->getMock(); |
|
| 149 | 149 | |
| 150 | 150 | |
| 151 | 151 | $stub = $this->getMockForAbstractClass('\Elasticsearch\Endpoints\AbstractEndpoint', array($mockTransport)); |
@@ -157,16 +157,16 @@ discard block |
||
| 157 | 157 | ); |
| 158 | 158 | |
| 159 | 159 | $stub->expects($this->once()) |
| 160 | - ->method('getParamWhitelist') |
|
| 161 | - ->will($this->returnValue($paramWhiteList)); |
|
| 160 | + ->method('getParamWhitelist') |
|
| 161 | + ->will($this->returnValue($paramWhiteList)); |
|
| 162 | 162 | |
| 163 | 163 | $stub->expects($this->once()) |
| 164 | - ->method('getURI') |
|
| 165 | - ->will($this->returnValue('/testIndex/')); |
|
| 164 | + ->method('getURI') |
|
| 165 | + ->will($this->returnValue('/testIndex/')); |
|
| 166 | 166 | |
| 167 | 167 | $stub->expects($this->once()) |
| 168 | - ->method('getMethod') |
|
| 169 | - ->will($this->returnValue('GET')); |
|
| 168 | + ->method('getMethod') |
|
| 169 | + ->will($this->returnValue('GET')); |
|
| 170 | 170 | |
| 171 | 171 | /** @var AbstractEndpoint $stub */ |
| 172 | 172 | $stub->setParams($params); |
@@ -206,14 +206,14 @@ discard block |
||
| 206 | 206 | ); |
| 207 | 207 | |
| 208 | 208 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 209 | - ->shouldReceive('performRequest')->once()->once() |
|
| 210 | - ->with( |
|
| 211 | - 'GET', |
|
| 212 | - '/testIndex/', |
|
| 213 | - $expected, |
|
| 214 | - null |
|
| 215 | - ) |
|
| 216 | - ->getMock(); |
|
| 209 | + ->shouldReceive('performRequest')->once()->once() |
|
| 210 | + ->with( |
|
| 211 | + 'GET', |
|
| 212 | + '/testIndex/', |
|
| 213 | + $expected, |
|
| 214 | + null |
|
| 215 | + ) |
|
| 216 | + ->getMock(); |
|
| 217 | 217 | |
| 218 | 218 | |
| 219 | 219 | $stub = $this->getMockForAbstractClass('\Elasticsearch\Endpoints\AbstractEndpoint', array($mockTransport)); |
@@ -33,12 +33,12 @@ discard block |
||
| 33 | 33 | ->with( |
| 34 | 34 | 'GET', |
| 35 | 35 | '/testIndex/', |
| 36 | - array(), |
|
| 36 | + array (), |
|
| 37 | 37 | null |
| 38 | 38 | ) |
| 39 | 39 | ->getMock(); |
| 40 | 40 | |
| 41 | - $stub = $this->getMockForAbstractClass('\Elasticsearch\Endpoints\AbstractEndpoint', array($mockTransport)); |
|
| 41 | + $stub = $this->getMockForAbstractClass('\Elasticsearch\Endpoints\AbstractEndpoint', array ($mockTransport)); |
|
| 42 | 42 | |
| 43 | 43 | $stub->expects($this->once()) |
| 44 | 44 | ->method('getURI') |
@@ -56,9 +56,9 @@ discard block |
||
| 56 | 56 | { |
| 57 | 57 | $mockTransport = m::mock('\Elasticsearch\Transport'); |
| 58 | 58 | |
| 59 | - $stub = $this->getMockForAbstractClass('\Elasticsearch\Endpoints\AbstractEndpoint', array($mockTransport)); |
|
| 59 | + $stub = $this->getMockForAbstractClass('\Elasticsearch\Endpoints\AbstractEndpoint', array ($mockTransport)); |
|
| 60 | 60 | |
| 61 | - $paramWhiteList = array( |
|
| 61 | + $paramWhiteList = array ( |
|
| 62 | 62 | 'param1', |
| 63 | 63 | 'param2', |
| 64 | 64 | 'param3' |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | ->will($this->returnValue($paramWhiteList)); |
| 70 | 70 | |
| 71 | 71 | |
| 72 | - $params = array('param1'=>'value'); |
|
| 72 | + $params = array ('param1'=>'value'); |
|
| 73 | 73 | $stub->setParams($params); |
| 74 | 74 | |
| 75 | 75 | } |
@@ -78,9 +78,9 @@ discard block |
||
| 78 | 78 | { |
| 79 | 79 | $mockTransport = m::mock('\Elasticsearch\Transport'); |
| 80 | 80 | |
| 81 | - $stub = $this->getMockForAbstractClass('\Elasticsearch\Endpoints\AbstractEndpoint', array($mockTransport)); |
|
| 81 | + $stub = $this->getMockForAbstractClass('\Elasticsearch\Endpoints\AbstractEndpoint', array ($mockTransport)); |
|
| 82 | 82 | |
| 83 | - $paramWhiteList = array( |
|
| 83 | + $paramWhiteList = array ( |
|
| 84 | 84 | 'param1', |
| 85 | 85 | 'param2', |
| 86 | 86 | 'param3' |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | ->method('getParamWhitelist') |
| 91 | 91 | ->will($this->returnValue($paramWhiteList)); |
| 92 | 92 | |
| 93 | - $params = array( |
|
| 93 | + $params = array ( |
|
| 94 | 94 | 'param1' => 'value', |
| 95 | 95 | 'param2' => 'value', |
| 96 | 96 | 'param3' => 'value' |
@@ -107,9 +107,9 @@ discard block |
||
| 107 | 107 | { |
| 108 | 108 | $mockTransport = m::mock('\Elasticsearch\Transport'); |
| 109 | 109 | |
| 110 | - $stub = $this->getMockForAbstractClass('\Elasticsearch\Endpoints\AbstractEndpoint', array($mockTransport)); |
|
| 110 | + $stub = $this->getMockForAbstractClass('\Elasticsearch\Endpoints\AbstractEndpoint', array ($mockTransport)); |
|
| 111 | 111 | |
| 112 | - $paramWhiteList = array( |
|
| 112 | + $paramWhiteList = array ( |
|
| 113 | 113 | 'param1', |
| 114 | 114 | 'param2', |
| 115 | 115 | 'param3' |
@@ -119,17 +119,17 @@ discard block |
||
| 119 | 119 | ->method('getParamWhitelist') |
| 120 | 120 | ->will($this->returnValue($paramWhiteList)); |
| 121 | 121 | |
| 122 | - $params = array('param10' => 'value'); |
|
| 122 | + $params = array ('param10' => 'value'); |
|
| 123 | 123 | $stub->setParams($params); |
| 124 | 124 | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | public function testSetSortParam() |
| 128 | 128 | { |
| 129 | - $params = array( |
|
| 130 | - 'sort' => array( |
|
| 129 | + $params = array ( |
|
| 130 | + 'sort' => array ( |
|
| 131 | 131 | 'field' => 'value2', |
| 132 | - 'field2' => array( |
|
| 132 | + 'field2' => array ( |
|
| 133 | 133 | 'field3' => 'value3' |
| 134 | 134 | ) |
| 135 | 135 | ), |
@@ -148,9 +148,9 @@ discard block |
||
| 148 | 148 | ->getMock(); |
| 149 | 149 | |
| 150 | 150 | |
| 151 | - $stub = $this->getMockForAbstractClass('\Elasticsearch\Endpoints\AbstractEndpoint', array($mockTransport)); |
|
| 151 | + $stub = $this->getMockForAbstractClass('\Elasticsearch\Endpoints\AbstractEndpoint', array ($mockTransport)); |
|
| 152 | 152 | |
| 153 | - $paramWhiteList = array( |
|
| 153 | + $paramWhiteList = array ( |
|
| 154 | 154 | 'sort', |
| 155 | 155 | 'param2', |
| 156 | 156 | 'param3' |
@@ -180,24 +180,24 @@ discard block |
||
| 180 | 180 | |
| 181 | 181 | public function testSetSortParamWithImplodeList() |
| 182 | 182 | { |
| 183 | - $params = array( |
|
| 184 | - 'sort' => array( |
|
| 183 | + $params = array ( |
|
| 184 | + 'sort' => array ( |
|
| 185 | 185 | 'field' => 'value2', |
| 186 | - 'field2' => array( |
|
| 186 | + 'field2' => array ( |
|
| 187 | 187 | 'field3' => 'value3' |
| 188 | 188 | ) |
| 189 | 189 | ), |
| 190 | - 'param2' => array( |
|
| 190 | + 'param2' => array ( |
|
| 191 | 191 | 'implode1', |
| 192 | 192 | 'implode2' |
| 193 | 193 | ), |
| 194 | 194 | 'param3' => 'value' |
| 195 | 195 | ); |
| 196 | 196 | |
| 197 | - $expected = array( |
|
| 198 | - 'sort' => array( |
|
| 197 | + $expected = array ( |
|
| 198 | + 'sort' => array ( |
|
| 199 | 199 | 'field' => 'value2', |
| 200 | - 'field2' => array( |
|
| 200 | + 'field2' => array ( |
|
| 201 | 201 | 'field3' => 'value3' |
| 202 | 202 | ) |
| 203 | 203 | ), |
@@ -216,9 +216,9 @@ discard block |
||
| 216 | 216 | ->getMock(); |
| 217 | 217 | |
| 218 | 218 | |
| 219 | - $stub = $this->getMockForAbstractClass('\Elasticsearch\Endpoints\AbstractEndpoint', array($mockTransport)); |
|
| 219 | + $stub = $this->getMockForAbstractClass('\Elasticsearch\Endpoints\AbstractEndpoint', array ($mockTransport)); |
|
| 220 | 220 | |
| 221 | - $paramWhiteList = array( |
|
| 221 | + $paramWhiteList = array ( |
|
| 222 | 222 | 'sort', |
| 223 | 223 | 'param2', |
| 224 | 224 | 'param3' |
@@ -19,15 +19,13 @@ discard block |
||
| 19 | 19 | * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 |
| 20 | 20 | * @link http://elasticsearch.org |
| 21 | 21 | */ |
| 22 | -class AbstractEndpointTest extends \PHPUnit_Framework_TestCase |
|
| 23 | -{ |
|
| 22 | +class AbstractEndpointTest extends \PHPUnit_Framework_TestCase { |
|
| 24 | 23 | |
| 25 | 24 | public function tearDown() { |
| 26 | 25 | m::close(); |
| 27 | 26 | } |
| 28 | 27 | |
| 29 | - public function testPerformRequest() |
|
| 30 | - { |
|
| 28 | + public function testPerformRequest() { |
|
| 31 | 29 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 32 | 30 | ->shouldReceive('performRequest')->once()->once() |
| 33 | 31 | ->with( |
@@ -52,8 +50,7 @@ discard block |
||
| 52 | 50 | |
| 53 | 51 | } |
| 54 | 52 | |
| 55 | - public function testSetOneParam() |
|
| 56 | - { |
|
| 53 | + public function testSetOneParam() { |
|
| 57 | 54 | $mockTransport = m::mock('\Elasticsearch\Transport'); |
| 58 | 55 | |
| 59 | 56 | $stub = $this->getMockForAbstractClass('\Elasticsearch\Endpoints\AbstractEndpoint', array($mockTransport)); |
@@ -74,8 +71,7 @@ discard block |
||
| 74 | 71 | |
| 75 | 72 | } |
| 76 | 73 | |
| 77 | - public function testSetMultipleParam() |
|
| 78 | - { |
|
| 74 | + public function testSetMultipleParam() { |
|
| 79 | 75 | $mockTransport = m::mock('\Elasticsearch\Transport'); |
| 80 | 76 | |
| 81 | 77 | $stub = $this->getMockForAbstractClass('\Elasticsearch\Endpoints\AbstractEndpoint', array($mockTransport)); |
@@ -103,8 +99,7 @@ discard block |
||
| 103 | 99 | /** |
| 104 | 100 | * @expectedException UnexpectedValueException |
| 105 | 101 | */ |
| 106 | - public function testSetInvalidParam() |
|
| 107 | - { |
|
| 102 | + public function testSetInvalidParam() { |
|
| 108 | 103 | $mockTransport = m::mock('\Elasticsearch\Transport'); |
| 109 | 104 | |
| 110 | 105 | $stub = $this->getMockForAbstractClass('\Elasticsearch\Endpoints\AbstractEndpoint', array($mockTransport)); |
@@ -124,8 +119,7 @@ discard block |
||
| 124 | 119 | |
| 125 | 120 | } |
| 126 | 121 | |
| 127 | - public function testSetSortParam() |
|
| 128 | - { |
|
| 122 | + public function testSetSortParam() { |
|
| 129 | 123 | $params = array( |
| 130 | 124 | 'sort' => array( |
| 131 | 125 | 'field' => 'value2', |
@@ -178,8 +172,7 @@ discard block |
||
| 178 | 172 | } |
| 179 | 173 | } |
| 180 | 174 | |
| 181 | - public function testSetSortParamWithImplodeList() |
|
| 182 | - { |
|
| 175 | + public function testSetSortParamWithImplodeList() { |
|
| 183 | 176 | $params = array( |
| 184 | 177 | 'sort' => array( |
| 185 | 178 | 'field' => 'value2', |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | 'GET', |
| 35 | 35 | '/testIndex/', |
| 36 | 36 | array(), |
| 37 | - null |
|
| 37 | + NULL |
|
| 38 | 38 | ) |
| 39 | 39 | ->getMock(); |
| 40 | 40 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | 'GET', |
| 144 | 144 | '/testIndex/', |
| 145 | 145 | $params, |
| 146 | - null |
|
| 146 | + NULL |
|
| 147 | 147 | ) |
| 148 | 148 | ->getMock(); |
| 149 | 149 | |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | 'GET', |
| 212 | 212 | '/testIndex/', |
| 213 | 213 | $expected, |
| 214 | - null |
|
| 214 | + NULL |
|
| 215 | 215 | ) |
| 216 | 216 | ->getMock(); |
| 217 | 217 | |
@@ -80,14 +80,14 @@ |
||
| 80 | 80 | public function testValidUpdate() |
| 81 | 81 | { |
| 82 | 82 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 83 | - ->shouldReceive('performRequest')->once() |
|
| 84 | - ->with( |
|
| 85 | - 'POST', |
|
| 86 | - '/testIndex/testType/testID/_update', |
|
| 87 | - array(), |
|
| 88 | - null |
|
| 89 | - ) |
|
| 90 | - ->getMock(); |
|
| 83 | + ->shouldReceive('performRequest')->once() |
|
| 84 | + ->with( |
|
| 85 | + 'POST', |
|
| 86 | + '/testIndex/testType/testID/_update', |
|
| 87 | + array(), |
|
| 88 | + null |
|
| 89 | + ) |
|
| 90 | + ->getMock(); |
|
| 91 | 91 | |
| 92 | 92 | $action = new Update($mockTransport); |
| 93 | 93 | $action->setIndex('testIndex') |
@@ -84,7 +84,7 @@ |
||
| 84 | 84 | ->with( |
| 85 | 85 | 'POST', |
| 86 | 86 | '/testIndex/testType/testID/_update', |
| 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 UpdateTest extends \PHPUnit_Framework_TestCase |
|
| 22 | -{ |
|
| 21 | +class UpdateTest 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 testValidUpdate() |
|
| 81 | - { |
|
| 75 | + public function testValidUpdate() { |
|
| 82 | 76 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 83 | 77 | ->shouldReceive('performRequest')->once() |
| 84 | 78 | ->with( |
@@ -85,7 +85,7 @@ |
||
| 85 | 85 | 'POST', |
| 86 | 86 | '/testIndex/testType/testID/_update', |
| 87 | 87 | array(), |
| 88 | - null |
|
| 88 | + NULL |
|
| 89 | 89 | ) |
| 90 | 90 | ->getMock(); |
| 91 | 91 | |
@@ -81,14 +81,14 @@ discard block |
||
| 81 | 81 | { |
| 82 | 82 | |
| 83 | 83 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 84 | - ->shouldReceive('performRequest')->once() |
|
| 85 | - ->with( |
|
| 86 | - 'GET', |
|
| 87 | - '/testIndex/testType/abc', |
|
| 88 | - array(), |
|
| 89 | - null |
|
| 90 | - ) |
|
| 91 | - ->getMock(); |
|
| 84 | + ->shouldReceive('performRequest')->once() |
|
| 85 | + ->with( |
|
| 86 | + 'GET', |
|
| 87 | + '/testIndex/testType/abc', |
|
| 88 | + array(), |
|
| 89 | + null |
|
| 90 | + ) |
|
| 91 | + ->getMock(); |
|
| 92 | 92 | |
| 93 | 93 | |
| 94 | 94 | |
@@ -103,14 +103,14 @@ discard block |
||
| 103 | 103 | public function testValidIndexWithSourceOnly() |
| 104 | 104 | { |
| 105 | 105 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 106 | - ->shouldReceive('performRequest')->once() |
|
| 107 | - ->with( |
|
| 108 | - 'GET', |
|
| 109 | - '/testIndex/testType/abc/_source', |
|
| 110 | - array(), |
|
| 111 | - null |
|
| 112 | - ) |
|
| 113 | - ->getMock(); |
|
| 106 | + ->shouldReceive('performRequest')->once() |
|
| 107 | + ->with( |
|
| 108 | + 'GET', |
|
| 109 | + '/testIndex/testType/abc/_source', |
|
| 110 | + array(), |
|
| 111 | + null |
|
| 112 | + ) |
|
| 113 | + ->getMock(); |
|
| 114 | 114 | |
| 115 | 115 | |
| 116 | 116 | |
@@ -126,14 +126,14 @@ discard block |
||
| 126 | 126 | public function testValidIndexWithExistenceOnly() |
| 127 | 127 | { |
| 128 | 128 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 129 | - ->shouldReceive('performRequest')->once() |
|
| 130 | - ->with( |
|
| 131 | - 'HEAD', |
|
| 132 | - '/testIndex/testType/abc', |
|
| 133 | - array(), |
|
| 134 | - null |
|
| 135 | - ) |
|
| 136 | - ->getMock(); |
|
| 129 | + ->shouldReceive('performRequest')->once() |
|
| 130 | + ->with( |
|
| 131 | + 'HEAD', |
|
| 132 | + '/testIndex/testType/abc', |
|
| 133 | + array(), |
|
| 134 | + null |
|
| 135 | + ) |
|
| 136 | + ->getMock(); |
|
| 137 | 137 | |
| 138 | 138 | |
| 139 | 139 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | ->with( |
| 86 | 86 | 'GET', |
| 87 | 87 | '/testIndex/testType/abc', |
| 88 | - array(), |
|
| 88 | + array (), |
|
| 89 | 89 | null |
| 90 | 90 | ) |
| 91 | 91 | ->getMock(); |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | ->with( |
| 108 | 108 | 'GET', |
| 109 | 109 | '/testIndex/testType/abc/_source', |
| 110 | - array(), |
|
| 110 | + array (), |
|
| 111 | 111 | null |
| 112 | 112 | ) |
| 113 | 113 | ->getMock(); |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | ->with( |
| 131 | 131 | 'HEAD', |
| 132 | 132 | '/testIndex/testType/abc', |
| 133 | - array(), |
|
| 133 | + array (), |
|
| 134 | 134 | null |
| 135 | 135 | ) |
| 136 | 136 | ->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 GetTest extends \PHPUnit_Framework_TestCase |
|
| 22 | -{ |
|
| 21 | +class GetTest 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 testValidGet() |
|
| 81 | - { |
|
| 75 | + public function testValidGet() { |
|
| 82 | 76 | |
| 83 | 77 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 84 | 78 | ->shouldReceive('performRequest')->once() |
@@ -100,8 +94,7 @@ discard block |
||
| 100 | 94 | |
| 101 | 95 | } |
| 102 | 96 | |
| 103 | - public function testValidIndexWithSourceOnly() |
|
| 104 | - { |
|
| 97 | + public function testValidIndexWithSourceOnly() { |
|
| 105 | 98 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 106 | 99 | ->shouldReceive('performRequest')->once() |
| 107 | 100 | ->with( |
@@ -123,8 +116,7 @@ discard block |
||
| 123 | 116 | |
| 124 | 117 | } |
| 125 | 118 | |
| 126 | - public function testValidIndexWithExistenceOnly() |
|
| 127 | - { |
|
| 119 | + public function testValidIndexWithExistenceOnly() { |
|
| 128 | 120 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 129 | 121 | ->shouldReceive('performRequest')->once() |
| 130 | 122 | ->with( |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | 'GET', |
| 87 | 87 | '/testIndex/testType/abc', |
| 88 | 88 | array(), |
| 89 | - null |
|
| 89 | + NULL |
|
| 90 | 90 | ) |
| 91 | 91 | ->getMock(); |
| 92 | 92 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | 'GET', |
| 109 | 109 | '/testIndex/testType/abc/_source', |
| 110 | 110 | array(), |
| 111 | - null |
|
| 111 | + NULL |
|
| 112 | 112 | ) |
| 113 | 113 | ->getMock(); |
| 114 | 114 | |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | 'HEAD', |
| 132 | 132 | '/testIndex/testType/abc', |
| 133 | 133 | array(), |
| 134 | - null |
|
| 134 | + NULL |
|
| 135 | 135 | ) |
| 136 | 136 | ->getMock(); |
| 137 | 137 | |
@@ -45,14 +45,14 @@ discard block |
||
| 45 | 45 | $uri = '/_search/scroll'; |
| 46 | 46 | |
| 47 | 47 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 48 | - ->shouldReceive('performRequest')->once() |
|
| 49 | - ->with( |
|
| 50 | - 'GET', |
|
| 51 | - $uri, |
|
| 52 | - array(), |
|
| 53 | - $body |
|
| 54 | - ) |
|
| 55 | - ->getMock(); |
|
| 48 | + ->shouldReceive('performRequest')->once() |
|
| 49 | + ->with( |
|
| 50 | + 'GET', |
|
| 51 | + $uri, |
|
| 52 | + array(), |
|
| 53 | + $body |
|
| 54 | + ) |
|
| 55 | + ->getMock(); |
|
| 56 | 56 | |
| 57 | 57 | |
| 58 | 58 | |
@@ -68,14 +68,14 @@ discard block |
||
| 68 | 68 | $uri = "/_search/scroll/$body"; |
| 69 | 69 | |
| 70 | 70 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 71 | - ->shouldReceive('performRequest')->once() |
|
| 72 | - ->with( |
|
| 73 | - 'GET', |
|
| 74 | - $uri, |
|
| 75 | - array(), |
|
| 76 | - $body |
|
| 77 | - ) |
|
| 78 | - ->getMock(); |
|
| 71 | + ->shouldReceive('performRequest')->once() |
|
| 72 | + ->with( |
|
| 73 | + 'GET', |
|
| 74 | + $uri, |
|
| 75 | + array(), |
|
| 76 | + $body |
|
| 77 | + ) |
|
| 78 | + ->getMock(); |
|
| 79 | 79 | |
| 80 | 80 | |
| 81 | 81 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | ->with( |
| 50 | 50 | 'GET', |
| 51 | 51 | $uri, |
| 52 | - array(), |
|
| 52 | + array (), |
|
| 53 | 53 | $body |
| 54 | 54 | ) |
| 55 | 55 | ->getMock(); |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | ->with( |
| 73 | 73 | 'GET', |
| 74 | 74 | $uri, |
| 75 | - array(), |
|
| 75 | + array (), |
|
| 76 | 76 | $body |
| 77 | 77 | ) |
| 78 | 78 | ->getMock(); |
@@ -19,15 +19,13 @@ discard block |
||
| 19 | 19 | * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 |
| 20 | 20 | * @link http://Elasticsearch.org |
| 21 | 21 | */ |
| 22 | -class ScrollTest extends \PHPUnit_Framework_TestCase |
|
| 23 | -{ |
|
| 22 | +class ScrollTest extends \PHPUnit_Framework_TestCase { |
|
| 24 | 23 | |
| 25 | 24 | public function tearDown() { |
| 26 | 25 | m::close(); |
| 27 | 26 | } |
| 28 | 27 | |
| 29 | - public function testSetStringBody() |
|
| 30 | - { |
|
| 28 | + public function testSetStringBody() { |
|
| 31 | 29 | $body = 'scrollid'; |
| 32 | 30 | |
| 33 | 31 | $mockTransport = m::mock('\Elasticsearch\Transport'); |
@@ -39,8 +37,7 @@ discard block |
||
| 39 | 37 | } |
| 40 | 38 | |
| 41 | 39 | |
| 42 | - public function testWithBodyNoScrollID() |
|
| 43 | - { |
|
| 40 | + public function testWithBodyNoScrollID() { |
|
| 44 | 41 | $body = 'scrollID'; |
| 45 | 42 | $uri = '/_search/scroll'; |
| 46 | 43 | |
@@ -62,8 +59,7 @@ discard block |
||
| 62 | 59 | |
| 63 | 60 | } |
| 64 | 61 | |
| 65 | - public function testWithBodyAndScrollID() |
|
| 66 | - { |
|
| 62 | + public function testWithBodyAndScrollID() { |
|
| 67 | 63 | $body = 'scrollID'; |
| 68 | 64 | $uri = "/_search/scroll/$body"; |
| 69 | 65 | |
@@ -80,14 +80,14 @@ |
||
| 80 | 80 | public function testValidExplain() |
| 81 | 81 | { |
| 82 | 82 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 83 | - ->shouldReceive('performRequest')->once() |
|
| 84 | - ->with( |
|
| 85 | - 'GET', |
|
| 86 | - '/testIndex/testType/testID/_explain', |
|
| 87 | - array(), |
|
| 88 | - null |
|
| 89 | - ) |
|
| 90 | - ->getMock(); |
|
| 83 | + ->shouldReceive('performRequest')->once() |
|
| 84 | + ->with( |
|
| 85 | + 'GET', |
|
| 86 | + '/testIndex/testType/testID/_explain', |
|
| 87 | + array(), |
|
| 88 | + null |
|
| 89 | + ) |
|
| 90 | + ->getMock(); |
|
| 91 | 91 | |
| 92 | 92 | $action = new Explain($mockTransport); |
| 93 | 93 | $action->setIndex('testIndex') |
@@ -84,7 +84,7 @@ |
||
| 84 | 84 | ->with( |
| 85 | 85 | 'GET', |
| 86 | 86 | '/testIndex/testType/testID/_explain', |
| 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 ExplainTest extends \PHPUnit_Framework_TestCase |
|
| 22 | -{ |
|
| 21 | +class ExplainTest 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 testValidExplain() |
|
| 81 | - { |
|
| 75 | + public function testValidExplain() { |
|
| 82 | 76 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 83 | 77 | ->shouldReceive('performRequest')->once() |
| 84 | 78 | ->with( |
@@ -85,7 +85,7 @@ |
||
| 85 | 85 | 'GET', |
| 86 | 86 | '/testIndex/testType/testID/_explain', |
| 87 | 87 | array(), |
| 88 | - null |
|
| 88 | + NULL |
|
| 89 | 89 | ) |
| 90 | 90 | ->getMock(); |
| 91 | 91 | |
@@ -27,14 +27,14 @@ discard block |
||
| 27 | 27 | { |
| 28 | 28 | |
| 29 | 29 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 30 | - ->shouldReceive('performRequest')->once() |
|
| 31 | - ->with( |
|
| 32 | - 'DELETE', |
|
| 33 | - '/', |
|
| 34 | - array(), |
|
| 35 | - null |
|
| 36 | - ) |
|
| 37 | - ->getMock(); |
|
| 30 | + ->shouldReceive('performRequest')->once() |
|
| 31 | + ->with( |
|
| 32 | + 'DELETE', |
|
| 33 | + '/', |
|
| 34 | + array(), |
|
| 35 | + null |
|
| 36 | + ) |
|
| 37 | + ->getMock(); |
|
| 38 | 38 | |
| 39 | 39 | $action = new Delete($mockTransport); |
| 40 | 40 | $action->performRequest(); |
@@ -45,14 +45,14 @@ discard block |
||
| 45 | 45 | { |
| 46 | 46 | |
| 47 | 47 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 48 | - ->shouldReceive('performRequest')->once() |
|
| 49 | - ->with( |
|
| 50 | - 'DELETE', |
|
| 51 | - '/testIndex', |
|
| 52 | - array(), |
|
| 53 | - null |
|
| 54 | - ) |
|
| 55 | - ->getMock(); |
|
| 48 | + ->shouldReceive('performRequest')->once() |
|
| 49 | + ->with( |
|
| 50 | + 'DELETE', |
|
| 51 | + '/testIndex', |
|
| 52 | + array(), |
|
| 53 | + null |
|
| 54 | + ) |
|
| 55 | + ->getMock(); |
|
| 56 | 56 | |
| 57 | 57 | $action = new Delete($mockTransport); |
| 58 | 58 | $action->setIndex('testIndex') |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | ->with( |
| 32 | 32 | 'DELETE', |
| 33 | 33 | '/', |
| 34 | - array(), |
|
| 34 | + array (), |
|
| 35 | 35 | null |
| 36 | 36 | ) |
| 37 | 37 | ->getMock(); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | ->with( |
| 50 | 50 | 'DELETE', |
| 51 | 51 | '/testIndex', |
| 52 | - array(), |
|
| 52 | + array (), |
|
| 53 | 53 | null |
| 54 | 54 | ) |
| 55 | 55 | ->getMock(); |
@@ -17,14 +17,12 @@ discard block |
||
| 17 | 17 | * @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 |
| 18 | 18 | * @link http://elasticsearch.org |
| 19 | 19 | */ |
| 20 | -class DeleteTest extends \PHPUnit_Framework_TestCase |
|
| 21 | -{ |
|
| 20 | +class DeleteTest extends \PHPUnit_Framework_TestCase { |
|
| 22 | 21 | public function tearDown() { |
| 23 | 22 | m::close(); |
| 24 | 23 | } |
| 25 | 24 | |
| 26 | - public function testValidDeleteWithNoIndex() |
|
| 27 | - { |
|
| 25 | + public function testValidDeleteWithNoIndex() { |
|
| 28 | 26 | |
| 29 | 27 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 30 | 28 | ->shouldReceive('performRequest')->once() |
@@ -41,8 +39,7 @@ discard block |
||
| 41 | 39 | |
| 42 | 40 | } |
| 43 | 41 | |
| 44 | - public function testValidDeleteWithIndex() |
|
| 45 | - { |
|
| 42 | + public function testValidDeleteWithIndex() { |
|
| 46 | 43 | |
| 47 | 44 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 48 | 45 | ->shouldReceive('performRequest')->once() |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | 'DELETE', |
| 33 | 33 | '/', |
| 34 | 34 | array(), |
| 35 | - null |
|
| 35 | + NULL |
|
| 36 | 36 | ) |
| 37 | 37 | ->getMock(); |
| 38 | 38 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | 'DELETE', |
| 51 | 51 | '/testIndex', |
| 52 | 52 | array(), |
| 53 | - null |
|
| 53 | + NULL |
|
| 54 | 54 | ) |
| 55 | 55 | ->getMock(); |
| 56 | 56 | |
@@ -41,14 +41,14 @@ |
||
| 41 | 41 | { |
| 42 | 42 | |
| 43 | 43 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 44 | - ->shouldReceive('performRequest')->once() |
|
| 45 | - ->with( |
|
| 46 | - 'POST', |
|
| 47 | - '/testIndex/_open', |
|
| 48 | - array(), |
|
| 49 | - null |
|
| 50 | - ) |
|
| 51 | - ->getMock(); |
|
| 44 | + ->shouldReceive('performRequest')->once() |
|
| 45 | + ->with( |
|
| 46 | + 'POST', |
|
| 47 | + '/testIndex/_open', |
|
| 48 | + array(), |
|
| 49 | + null |
|
| 50 | + ) |
|
| 51 | + ->getMock(); |
|
| 52 | 52 | |
| 53 | 53 | |
| 54 | 54 | |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | ->with( |
| 46 | 46 | 'POST', |
| 47 | 47 | '/testIndex/_open', |
| 48 | - array(), |
|
| 48 | + array (), |
|
| 49 | 49 | null |
| 50 | 50 | ) |
| 51 | 51 | ->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 OpenTest extends \PHPUnit_Framework_TestCase |
|
| 22 | -{ |
|
| 21 | +class OpenTest 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 | |
@@ -37,8 +35,7 @@ discard block |
||
| 37 | 35 | |
| 38 | 36 | } |
| 39 | 37 | |
| 40 | - public function testValidOpen() |
|
| 41 | - { |
|
| 38 | + public function testValidOpen() { |
|
| 42 | 39 | |
| 43 | 40 | $mockTransport = m::mock('\Elasticsearch\Transport') |
| 44 | 41 | ->shouldReceive('performRequest')->once() |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | 'POST', |
| 47 | 47 | '/testIndex/_open', |
| 48 | 48 | array(), |
| 49 | - null |
|
| 49 | + NULL |
|
| 50 | 50 | ) |
| 51 | 51 | ->getMock(); |
| 52 | 52 | |