Skip to content

Commit 049a49d

Browse files
Added 5.2 version. (#116)
1 parent b222239 commit 049a49d

File tree

4 files changed

+59
-4
lines changed

4 files changed

+59
-4
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ all available versions and keep up with protocol messages architecture and speci
1616

1717
## Version support
1818

19-
We are trying to keep up and this library supports **Neo4j <= 5.6** with **Bolt <= 5.1**.
19+
We are trying to keep up and this library supports **Neo4j <= 5.7** with **Bolt <= 5.2**.
2020

2121
https://www.neo4j.com/docs/bolt/current/bolt-compatibility/
2222

@@ -59,8 +59,7 @@ Concept of usage is based on Bolt messages. Available protocol methods depends o
5959
in [pipeline](https://www.neo4j.com/docs/bolt/current/bolt/message/#pipelining) and you can chain multiple Bolt messages
6060
before fetching response from the server.
6161

62-
Main `Bolt` class serves as Factory design pattern and it returns instance of protocol class by requested Bolt version (
63-
default is 4 latest versions). Query execution and fetching response is split in two methods. First message `run` is for
62+
Main `Bolt` class serves as Factory design pattern and it returns instance of protocol class by requested Bolt version. Query execution and fetching response is split in two methods. First message `run` is for
6463
sending queries. Second message `pull` is for fetching response from last executed query on database.
6564
Response from database for Bolt message `pull` always contains n+1 rows because last entry is `success` message with
6665
meta informations.

src/protocol/V5_2.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
namespace Bolt\protocol;
4+
5+
/**
6+
* Class Protocol version 5.2
7+
*
8+
* @author Michal Stefanak
9+
* @link https://github.com/neo4j-php/Bolt
10+
* @see https://www.neo4j.com/docs/bolt/current/bolt/message/
11+
* @package Bolt\protocol
12+
*/
13+
class V5_2 extends AProtocol
14+
{
15+
use \Bolt\protocol\v5\AvailableStructures;
16+
17+
use \Bolt\protocol\v1\ResetMessage;
18+
19+
use \Bolt\protocol\v3\RunMessage;
20+
use \Bolt\protocol\v3\BeginMessage;
21+
use \Bolt\protocol\v3\CommitMessage;
22+
use \Bolt\protocol\v3\RollbackMessage;
23+
use \Bolt\protocol\v3\GoodbyeMessage;
24+
25+
use \Bolt\protocol\v4\PullMessage;
26+
use \Bolt\protocol\v4\DiscardMessage;
27+
28+
use \Bolt\protocol\v4_4\RouteMessage;
29+
30+
use \Bolt\protocol\v5_1\HelloMessage;
31+
use \Bolt\protocol\v5_1\LogonMessage;
32+
use \Bolt\protocol\v5_1\LogoffMessage;
33+
}

tests/protocol/V5_1Test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use Bolt\protocol\V5_1;
88

99
/**
10-
* Class V5Test
10+
* Class V5_1Test
1111
*
1212
* @author Michal Stefanak
1313
* @link https://github.com/neo4j-php/Bolt

tests/protocol/V5_2Test.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
use Bolt\protocol\V5_2;
4+
5+
/**
6+
* Class V5_2Test
7+
*
8+
* @author Michal Stefanak
9+
* @link https://github.com/neo4j-php/Bolt
10+
* @package Bolt\tests\protocol
11+
*/
12+
class V5_2Test extends \Bolt\tests\protocol\ATest
13+
{
14+
public function test__construct(): V5_2
15+
{
16+
$cls = new V5_2(1, $this->mockConnection(), new \Bolt\protocol\ServerState());
17+
$this->assertInstanceOf(V5_2::class, $cls);
18+
$cls->serverState->expectedServerStateMismatchCallback = function (string $current, array $expected) {
19+
$this->markTestIncomplete('Server in ' . $current . ' state. Expected ' . implode(' or ', $expected) . '.');
20+
};
21+
return $cls;
22+
}
23+
}

0 commit comments

Comments
 (0)