Skip to content

Commit aac968f

Browse files
committed
fixed parse errors for PHP 5.3
1 parent be6c1a4 commit aac968f

File tree

3 files changed

+45
-31
lines changed

3 files changed

+45
-31
lines changed

lib/triagens/ArangoDb/HttpHelper.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,9 @@ public static function parseHttpMessage($httpMessage)
275275

276276
$barrier = HttpHelper::EOL . HttpHelper::EOL;
277277
$parts = explode($barrier, $httpMessage, 2);
278-
if (HttpHelper::parseHeaders($parts[0])[0] == 304 ||
279-
HttpHelper::parseHeaders($parts[0])[0] == 204) {
278+
$parsed = HttpHelper::parseHeaders($parts[0]);
279+
if ($parsed[0] == 304 ||
280+
$parsed[0] == 204) {
280281
return $parts;
281282
}
282283

tests/CollectionExtendedTest.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2096,16 +2096,18 @@ public function testFulltextQuery()
20962096
$this->assertTrue($e->getCode() === 400);
20972097

20982098
// Now we create an index
2099-
$fulltextIndexId = $collectionHandler->createFulltextIndex($collection->getId(), array("someOtherAttribute"))["id"];
2099+
$fulltextIndexId = $collectionHandler->createFulltextIndex($collection->getId(), array("someOtherAttribute"));
2100+
$fulltextIndexId = $fulltextIndexId["id"];
21002101
$cursor = $collectionHandler->fulltext(
21012102
$collection->getId(),
21022103
"someOtherAttribute",
21032104
"someOtherValue",
21042105
array("index" => $fulltextIndexId)
21052106
);
21062107

2107-
$this->assertTrue($cursor->getMetadata()["count"] == 2);
2108-
$this->assertTrue($cursor->getMetadata()["hasMore"] == false);
2108+
$m = $cursor->getMetadata();
2109+
$this->assertTrue($m["count"] == 2);
2110+
$this->assertTrue($m["hasMore"] == false);
21092111

21102112
// Now we pass some options
21112113
$cursor = $collectionHandler->fulltext(
@@ -2115,8 +2117,9 @@ public function testFulltextQuery()
21152117
array("index" => $fulltextIndexId, "skip" => 1, )
21162118
);
21172119

2118-
$this->assertTrue($cursor->getMetadata()["count"] == 1);
2119-
$this->assertTrue($cursor->getMetadata()["hasMore"] == false);
2120+
$m = $cursor->getMetadata();
2121+
$this->assertTrue($m["count"] == 1);
2122+
$this->assertTrue($m["hasMore"] == false);
21202123

21212124
$cursor = $collectionHandler->fulltext(
21222125
$collection->getId(),
@@ -2125,9 +2128,10 @@ public function testFulltextQuery()
21252128
array("batchSize" => 1)
21262129
);
21272130

2128-
$this->assertTrue($cursor->getMetadata()["count"] == 2);
2129-
$this->assertTrue(count($cursor->getMetadata()["result"]) == 1);
2130-
$this->assertTrue($cursor->getMetadata()["hasMore"] == true);
2131+
$m = $cursor->getMetadata();
2132+
$this->assertTrue($m["count"] == 2);
2133+
$this->assertTrue(count($m["result"]) == 1);
2134+
$this->assertTrue($m["hasMore"] == true);
21312135

21322136
}
21332137

tests/GraphExtendedTest.php

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,17 +1267,19 @@ public function testCreateGraphAndQueryVertices()
12671267
$cursor = $this->graphHandler->getVertices($this->graphName, $options);
12681268
$this->assertInstanceOf('triagens\ArangoDb\Cursor', $cursor);
12691269

1270-
$this->assertTrue(count($cursor->getMetadata()["result"]) == 1);
1271-
$this->assertTrue($cursor->getMetadata()["hasMore"] == true);
1270+
$m = $cursor->getMetadata();
1271+
$this->assertTrue(count($m["result"]) == 1);
1272+
$this->assertTrue($m["hasMore"] == true);
12721273

12731274

12741275
// Test options->limit
12751276
unset($resultingDocument);
12761277
$options = array('limit' => 1);
12771278
$cursor = $this->graphHandler->getVertices($this->graphName, $options);
1279+
$m = $cursor->getMetadata();
12781280
$this->assertInstanceOf('triagens\ArangoDb\Cursor', $cursor);
1279-
$this->assertTrue(count($cursor->getMetadata()["result"]) == 1);
1280-
$this->assertTrue($cursor->getMetadata()["hasMore"] == false);;
1281+
$this->assertTrue(count($m["result"]) == 1);
1282+
$this->assertTrue($m["hasMore"] == false);;
12811283

12821284

12831285
// Test options->count
@@ -1286,9 +1288,9 @@ public function testCreateGraphAndQueryVertices()
12861288
$cursor = $this->graphHandler->getVertices($this->graphName, $options);
12871289
$this->assertInstanceOf('triagens\ArangoDb\Cursor', $cursor);
12881290

1289-
1290-
$this->assertTrue(count($cursor->getMetadata()["result"]) == 4);
1291-
$this->assertTrue($cursor->getMetadata()["hasMore"] == false);
1291+
$m = $cursor->getMetadata();
1292+
$this->assertTrue(count($m["result"]) == 4);
1293+
$this->assertTrue($m["hasMore"] == false);
12921294

12931295
// Test options->properties
12941296
unset($resultingDocument);
@@ -1298,8 +1300,9 @@ public function testCreateGraphAndQueryVertices()
12981300

12991301
$cursor = $this->graphHandler->getVertices($this->graphName, $options);
13001302
$this->assertInstanceOf('triagens\ArangoDb\Cursor', $cursor);
1301-
$this->assertTrue(count($cursor->getMetadata()["result"]) == 1);
1302-
$this->assertTrue($cursor->getMetadata()["hasMore"] == false);;
1303+
$m = $cursor->getMetadata();
1304+
$this->assertTrue(count($m["result"]) == 1);
1305+
$this->assertTrue($m["hasMore"] == false);
13031306
}
13041307

13051308

@@ -1313,8 +1316,9 @@ public function testCreateGraphAndQueryEdges()
13131316
$cursor = $this->graphHandler->getEdges($this->graphName);
13141317
$this->assertInstanceOf('triagens\ArangoDb\Cursor', $cursor);
13151318
$this->assertInstanceOf('triagens\ArangoDb\Cursor', $cursor);
1316-
$this->assertTrue(count($cursor->getMetadata()["result"]) == 3);
1317-
$this->assertTrue($cursor->getMetadata()["hasMore"] == false);
1319+
$m = $cursor->getMetadata();
1320+
$this->assertTrue(count($m["result"]) == 3);
1321+
$this->assertTrue($m["hasMore"] == false);
13181322

13191323

13201324
// Test options->batchSize
@@ -1323,17 +1327,19 @@ public function testCreateGraphAndQueryEdges()
13231327
$cursor = $this->graphHandler->getEdges($this->graphName, $options);
13241328
$this->assertInstanceOf('triagens\ArangoDb\Cursor', $cursor);
13251329
$this->assertInstanceOf('triagens\ArangoDb\Cursor', $cursor);
1326-
$this->assertTrue(count($cursor->getMetadata()["result"]) == 1);
1327-
$this->assertTrue($cursor->getMetadata()["hasMore"] == true);
1330+
$m = $cursor->getMetadata();
1331+
$this->assertTrue(count($m["result"]) == 1);
1332+
$this->assertTrue($m["hasMore"] == true);
13281333

13291334
// Test options->limit
13301335
unset($resultingDocument);
13311336
$options = array('limit' => 1);
13321337
$cursor = $this->graphHandler->getEdges($this->graphName, $options);
13331338
$this->assertInstanceOf('triagens\ArangoDb\Cursor', $cursor);
13341339
$this->assertInstanceOf('triagens\ArangoDb\Cursor', $cursor);
1335-
$this->assertTrue(count($cursor->getMetadata()["result"]) == 1);
1336-
$this->assertTrue($cursor->getMetadata()["hasMore"] == false);
1340+
$m = $cursor->getMetadata();
1341+
$this->assertTrue(count($m["result"]) == 1);
1342+
$this->assertTrue($m["hasMore"] == false);
13371343

13381344

13391345
// Test options->count
@@ -1342,8 +1348,9 @@ public function testCreateGraphAndQueryEdges()
13421348
$cursor = $this->graphHandler->getEdges($this->graphName, $options);
13431349
$this->assertInstanceOf('triagens\ArangoDb\Cursor', $cursor);
13441350
$this->assertInstanceOf('triagens\ArangoDb\Cursor', $cursor);
1345-
$this->assertTrue(count($cursor->getMetadata()["result"]) == 3);
1346-
$this->assertTrue($cursor->getMetadata()["hasMore"] == false);
1351+
$m = $cursor->getMetadata();
1352+
$this->assertTrue(count($m["result"]) == 3);
1353+
$this->assertTrue($m["hasMore"] == false);
13471354

13481355
// Test options->filter
13491356
unset($resultingDocument);
@@ -1353,8 +1360,9 @@ public function testCreateGraphAndQueryEdges()
13531360
$cursor = $this->graphHandler->getEdges($this->graphName, $options);
13541361
$this->assertInstanceOf('triagens\ArangoDb\Cursor', $cursor);
13551362
$this->assertInstanceOf('triagens\ArangoDb\Cursor', $cursor);
1356-
$this->assertTrue(count($cursor->getMetadata()["result"]) == 1);
1357-
$this->assertTrue($cursor->getMetadata()["hasMore"] == false);
1363+
$m = $cursor->getMetadata();
1364+
$this->assertTrue(count($m["result"]) == 1);
1365+
$this->assertTrue($m["hasMore"] == false);
13581366

13591367

13601368
// Test options->properties
@@ -1366,8 +1374,9 @@ public function testCreateGraphAndQueryEdges()
13661374
$cursor = $this->graphHandler->getEdges($this->graphName, $options);
13671375
$this->assertInstanceOf('triagens\ArangoDb\Cursor', $cursor);
13681376
$this->assertInstanceOf('triagens\ArangoDb\Cursor', $cursor);
1369-
$this->assertTrue(count($cursor->getMetadata()["result"]) == 1);
1370-
$this->assertTrue($cursor->getMetadata()["hasMore"] == false);;
1377+
$m = $cursor->getMetadata();
1378+
$this->assertTrue(count($m["result"]) == 1);
1379+
$this->assertTrue($m["hasMore"] == false);
13711380
}
13721381

13731382

0 commit comments

Comments
 (0)