Skip to content

Commit

Permalink
Added 5.2 version. (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanak-michal authored Apr 29, 2023
1 parent b222239 commit 049a49d
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 4 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ all available versions and keep up with protocol messages architecture and speci

## Version support

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

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

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

Main `Bolt` class serves as Factory design pattern and it returns instance of protocol class by requested Bolt version (
default is 4 latest versions). Query execution and fetching response is split in two methods. First message `run` is for
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
sending queries. Second message `pull` is for fetching response from last executed query on database.
Response from database for Bolt message `pull` always contains n+1 rows because last entry is `success` message with
meta informations.
Expand Down
33 changes: 33 additions & 0 deletions src/protocol/V5_2.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace Bolt\protocol;

/**
* Class Protocol version 5.2
*
* @author Michal Stefanak
* @link https://github.com/neo4j-php/Bolt
* @see https://www.neo4j.com/docs/bolt/current/bolt/message/
* @package Bolt\protocol
*/
class V5_2 extends AProtocol
{
use \Bolt\protocol\v5\AvailableStructures;

use \Bolt\protocol\v1\ResetMessage;

use \Bolt\protocol\v3\RunMessage;
use \Bolt\protocol\v3\BeginMessage;
use \Bolt\protocol\v3\CommitMessage;
use \Bolt\protocol\v3\RollbackMessage;
use \Bolt\protocol\v3\GoodbyeMessage;

use \Bolt\protocol\v4\PullMessage;
use \Bolt\protocol\v4\DiscardMessage;

use \Bolt\protocol\v4_4\RouteMessage;

use \Bolt\protocol\v5_1\HelloMessage;
use \Bolt\protocol\v5_1\LogonMessage;
use \Bolt\protocol\v5_1\LogoffMessage;
}
2 changes: 1 addition & 1 deletion tests/protocol/V5_1Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Bolt\protocol\V5_1;

/**
* Class V5Test
* Class V5_1Test
*
* @author Michal Stefanak
* @link https://github.com/neo4j-php/Bolt
Expand Down
23 changes: 23 additions & 0 deletions tests/protocol/V5_2Test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

use Bolt\protocol\V5_2;

/**
* Class V5_2Test
*
* @author Michal Stefanak
* @link https://github.com/neo4j-php/Bolt
* @package Bolt\tests\protocol
*/
class V5_2Test extends \Bolt\tests\protocol\ATest
{
public function test__construct(): V5_2
{
$cls = new V5_2(1, $this->mockConnection(), new \Bolt\protocol\ServerState());
$this->assertInstanceOf(V5_2::class, $cls);
$cls->serverState->expectedServerStateMismatchCallback = function (string $current, array $expected) {
$this->markTestIncomplete('Server in ' . $current . ' state. Expected ' . implode(' or ', $expected) . '.');
};
return $cls;
}
}

0 comments on commit 049a49d

Please sign in to comment.