Skip to content

Commit 06b5eef

Browse files
changed default requested protocol versions to avoid breaking changes. updated readme. (#114)
1 parent 87e8e48 commit 06b5eef

File tree

11 files changed

+184
-130
lines changed

11 files changed

+184
-130
lines changed

README.md

Lines changed: 106 additions & 52 deletions
Large diffs are not rendered by default.

src/Bolt.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ final class Bolt
2626

2727
public function __construct(private IConnection $connection)
2828
{
29-
$this->setProtocolVersions(5.1, 5, 4.4);
29+
$this->setProtocolVersions(5, 4.4);
3030
}
3131

3232
/**

tests/BoltTest.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Bolt\Bolt;
66
use Exception;
7-
use Bolt\protocol\{AProtocol, Response, V1, V2, V3, V4, V4_1, V4_2, V4_3, V4_4, V5, V5_1};
7+
use Bolt\protocol\{AProtocol, Response, V4_4, V5, V5_1};
88

99
/**
1010
* Class BoltTest
@@ -26,8 +26,8 @@ public function testSockets(): void
2626
$bolt = new Bolt($conn);
2727
$this->assertInstanceOf(Bolt::class, $bolt);
2828

29-
/** @var AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1 $protocol */
30-
$protocol = $bolt->build();
29+
/** @var AProtocol|V4_4|V5|V5_1 $protocol */
30+
$protocol = $bolt->setProtocolVersions(5.1, 5, 4.4)->build();
3131
$this->assertInstanceOf(AProtocol::class, $protocol);
3232

3333
$this->sayHello($protocol, $GLOBALS['NEO_USER'], $GLOBALS['NEO_PASS']);
@@ -46,25 +46,25 @@ public function testAura(): void
4646
$bolt = new Bolt($conn);
4747
$this->assertInstanceOf(Bolt::class, $bolt);
4848

49-
/** @var AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|v5_1 $protocol */
50-
$protocol = $bolt->build();
49+
/** @var AProtocol|V4_4|V5|v5_1 $protocol */
50+
$protocol = $bolt->setProtocolVersions(5.1, 5, 4.4)->build();
5151
$this->assertInstanceOf(AProtocol::class, $protocol);
5252

5353
$this->sayHello($protocol, 'movies', 'movies');
5454

5555
$protocol->goodbye();
5656
}
5757

58-
public function testHello(): AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1
58+
public function testHello(): AProtocol|V4_4|V5|V5_1
5959
{
6060
$conn = new \Bolt\connection\StreamSocket($GLOBALS['NEO_HOST'] ?? '127.0.0.1', $GLOBALS['NEO_PORT'] ?? 7687);
6161
$this->assertInstanceOf(\Bolt\connection\StreamSocket::class, $conn);
6262

6363
$bolt = new Bolt($conn);
6464
$this->assertInstanceOf(Bolt::class, $bolt);
6565

66-
/** @var AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1 $protocol */
67-
$protocol = $bolt->build();
66+
/** @var AProtocol|V4_4|V5|V5_1 $protocol */
67+
$protocol = $bolt->setProtocolVersions(5.1, 5, 4.4)->build();
6868
$this->assertInstanceOf(AProtocol::class, $protocol);
6969

7070
$this->sayHello($protocol, $GLOBALS['NEO_USER'], $GLOBALS['NEO_PASS']);
@@ -75,7 +75,7 @@ public function testHello(): AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1
7575
/**
7676
* @depends testHello
7777
*/
78-
public function testPull(AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1 $protocol): void
78+
public function testPull(AProtocol|V4_4|V5|V5_1 $protocol): void
7979
{
8080
$protocol
8181
->run('RETURN 1 AS num, 2 AS cnt', [], ['mode' => 'r'])
@@ -92,7 +92,7 @@ public function testPull(AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1 $prot
9292
/**
9393
* @depends testHello
9494
*/
95-
public function testDiscard(AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1 $protocol): void
95+
public function testDiscard(AProtocol|V4_4|V5|V5_1 $protocol): void
9696
{
9797
$gen = $protocol
9898
->run('MATCH (a:Test) RETURN *', [], ['mode' => 'r'])
@@ -108,7 +108,7 @@ public function testDiscard(AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1 $p
108108
* @depends testHello
109109
* @throws Exception
110110
*/
111-
public function testTransaction(AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1 $protocol): void
111+
public function testTransaction(AProtocol|V4_4|V5|V5_1 $protocol): void
112112
{
113113
if (version_compare($protocol->getVersion(), 3, '<')) {
114114
$this->markTestSkipped('Old Neo4j version does not support transactions');
@@ -145,7 +145,7 @@ public function testTransaction(AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_
145145
/**
146146
* @depends testHello
147147
*/
148-
public function testRoute(AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1 $protocol): void
148+
public function testRoute(AProtocol|V4_4|V5|V5_1 $protocol): void
149149
{
150150
if (version_compare($protocol->getVersion(), 4.3, '>=')) {
151151
$response = $protocol
@@ -162,7 +162,7 @@ public function testRoute(AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1 $pro
162162
/**
163163
* @depends testHello
164164
*/
165-
public function testReset(AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1 $protocol): void
165+
public function testReset(AProtocol|V4_4|V5|V5_1 $protocol): void
166166
{
167167
$response = $protocol
168168
->reset()
@@ -175,7 +175,7 @@ public function testReset(AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1 $pro
175175
* @depends testHello
176176
* @throws Exception
177177
*/
178-
public function testChunking(AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1 $protocol): void
178+
public function testChunking(AProtocol|V4_4|V5|V5_1 $protocol): void
179179
{
180180
$gen = $protocol
181181
->begin()
@@ -205,7 +205,7 @@ public function testChunking(AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1 $
205205
/**
206206
* @depends testHello
207207
*/
208-
public function testServerStateMismatchCallback(AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1 $protocol): void
208+
public function testServerStateMismatchCallback(AProtocol|V4_4|V5|V5_1 $protocol): void
209209
{
210210
$protocol->serverState->set(\Bolt\protocol\ServerState::FAILED);
211211
$protocol->serverState->expectedServerStateMismatchCallback = function (string $current, array $expected) {

tests/PerformanceTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Bolt\Bolt;
66
use Bolt\connection\Socket;
7-
use Bolt\protocol\{AProtocol, Response, V1, V2, V3, V4, V4_1, V4_2, V4_3, V4_4, V5, V5_1};
7+
use Bolt\protocol\{AProtocol, Response, V4_4, V5, V5_1};
88
use Bolt\tests\packstream\v1\generators\RandomDataGenerator;
99

1010
/**
@@ -20,8 +20,8 @@ public function test50KRecords(): void
2020
$amount = 50000;
2121

2222
$conn = new Socket($GLOBALS['NEO_HOST'] ?? 'localhost', $GLOBALS['NEO_PORT'] ?? 7687, 60);
23-
/** @var AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1 $protocol */
24-
$protocol = (new Bolt($conn))->build();
23+
/** @var AProtocol|V4_4|V5|V5_1 $protocol */
24+
$protocol = (new Bolt($conn))->setProtocolVersions(5.1, 5, 4.4)->build();
2525

2626
$this->sayHello($protocol, $GLOBALS['NEO_USER'], $GLOBALS['NEO_PASS']);
2727

tests/connection/ConnectionTest.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Bolt\tests\connection;
44

55
use Bolt\Bolt;
6-
use Bolt\protocol\{AProtocol, Response, V1, V2, V3, V4, V4_1, V4_2, V4_3, V4_4, V5, V5_1};
6+
use Bolt\protocol\{AProtocol, Response, V4_4, V5, V5_1};
77
use Bolt\tests\ATest;
88
use Bolt\connection\{
99
IConnection,
@@ -35,8 +35,8 @@ public function testMillisecondTimeout(string $alias): void
3535
{
3636
$conn = $this->getConnection($alias);
3737
$conn->setTimeout(1.5);
38-
/** @var AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1 $protocol */
39-
$protocol = (new Bolt($conn))->build();
38+
/** @var AProtocol|V4_4|V5|V5_1 $protocol */
39+
$protocol = (new Bolt($conn))->setProtocolVersions(5.1, 5, 4.4)->build();
4040
$this->sayHello($protocol, $GLOBALS['NEO_USER'], $GLOBALS['NEO_PASS']);
4141
$this->expectException(ConnectionTimeoutException::class);
4242
$protocol
@@ -50,8 +50,8 @@ public function testMillisecondTimeout(string $alias): void
5050
public function testLongNoTimeout(string $alias): void
5151
{
5252
$conn = $this->getConnection($alias);
53-
/** @var AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1 $protocol */
54-
$protocol = (new Bolt($conn))->build();
53+
/** @var AProtocol|V4_4|V5|V5_1 $protocol */
54+
$protocol = (new Bolt($conn))->setProtocolVersions(5.1, 5, 4.4)->build();
5555
$this->sayHello($protocol, $GLOBALS['NEO_USER'], $GLOBALS['NEO_PASS']);
5656
$conn->setTimeout(200);
5757
$protocol
@@ -66,8 +66,8 @@ public function testSecondsTimeout(string $alias): void
6666
{
6767
$conn = $this->getConnection($alias);
6868
$conn->setTimeout(1);
69-
/** @var AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1 $protocol */
70-
$protocol = (new Bolt($conn))->build();
69+
/** @var AProtocol|V4_4|V5|V5_1 $protocol */
70+
$protocol = (new Bolt($conn))->setProtocolVersions(5.1, 5, 4.4)->build();
7171
$this->sayHello($protocol, $GLOBALS['NEO_USER'], $GLOBALS['NEO_PASS']);
7272
$this->expectException(ConnectionTimeoutException::class);
7373
$protocol
@@ -81,8 +81,8 @@ public function testSecondsTimeout(string $alias): void
8181
public function testTimeoutRecoverAndReset(string $alias): void
8282
{
8383
$conn = $this->getConnection($alias);
84-
/** @var AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1 $protocol */
85-
$protocol = (new Bolt($conn))->build();
84+
/** @var AProtocol|V4_4|V5|V5_1 $protocol */
85+
$protocol = (new Bolt($conn))->setProtocolVersions(5.1, 5, 4.4)->build();
8686
$this->sayHello($protocol, $GLOBALS['NEO_USER'], $GLOBALS['NEO_PASS']);
8787

8888
$conn->setTimeout(1.5);
@@ -106,8 +106,8 @@ public function testTimeoutRecoverAndReset(string $alias): void
106106
->getResponse();
107107

108108
$this->assertEquals(Response::SIGNATURE_FAILURE, $response->getSignature());
109-
/** @var AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1 $protocol */
110-
$protocol = (new Bolt($conn))->build();
109+
/** @var AProtocol|V4_4|V5|V5_1 $protocol */
110+
$protocol = (new Bolt($conn))->setProtocolVersions(5.1, 5, 4.4)->build();
111111
$this->sayHello($protocol, $GLOBALS['NEO_USER'], $GLOBALS['NEO_PASS']);
112112

113113
$conn->setTimeout(1.5);

tests/packstream/v1/BytesTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Bolt\Bolt;
66
use Bolt\packstream\Bytes;
7-
use Bolt\protocol\{AProtocol, V1, V2, V3, V4, V4_1, V4_2, V4_3, V4_4, V5, V5_1};
7+
use Bolt\protocol\{AProtocol, V4_4, V5, V5_1};
88
use Bolt\tests\ATest;
99

1010
/**
@@ -13,16 +13,16 @@
1313
*/
1414
class BytesTest extends ATest
1515
{
16-
public function testInit(): AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1
16+
public function testInit(): AProtocol|V4_4|V5|v5_1
1717
{
1818
$conn = new \Bolt\connection\StreamSocket($GLOBALS['NEO_HOST'] ?? '127.0.0.1', $GLOBALS['NEO_PORT'] ?? 7687);
1919
$this->assertInstanceOf(\Bolt\connection\StreamSocket::class, $conn);
2020

2121
$bolt = new Bolt($conn);
2222
$this->assertInstanceOf(Bolt::class, $bolt);
2323

24-
/** @var AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1 $protocol */
25-
$protocol = $bolt->build();
24+
/** @var AProtocol|V4_4|V5|v5_1 $protocol */
25+
$protocol = $bolt->setProtocolVersions(5.1, 5, 4.4)->build();
2626
$this->assertInstanceOf(AProtocol::class, $protocol);
2727

2828
$this->sayHello($protocol, $GLOBALS['NEO_USER'], $GLOBALS['NEO_PASS']);
@@ -34,7 +34,7 @@ public function testInit(): AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1
3434
* @depends testInit
3535
* @dataProvider providerBytes
3636
*/
37-
public function testBytes(Bytes $arr, AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1 $protocol)
37+
public function testBytes(Bytes $arr, AProtocol|V4_4|V5|v5_1 $protocol)
3838
{
3939
$res = iterator_to_array(
4040
$protocol

tests/packstream/v1/PackerTest.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Bolt\tests\packstream\v1;
44

55
use Bolt\Bolt;
6-
use Bolt\protocol\{AProtocol, V1, V2, V3, V4, V4_1, V4_2, V4_3, V4_4, V5, V5_1};
6+
use Bolt\protocol\{AProtocol, V4_4, V5, V5_1};
77
use Bolt\tests\ATest;
88

99
/**
@@ -15,16 +15,16 @@
1515
*/
1616
class PackerTest extends ATest
1717
{
18-
public function testInit(): AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1
18+
public function testInit(): AProtocol|V4_4|V5|v5_1
1919
{
2020
$conn = new \Bolt\connection\StreamSocket($GLOBALS['NEO_HOST'] ?? '127.0.0.1', $GLOBALS['NEO_PORT'] ?? 7687);
2121
$this->assertInstanceOf(\Bolt\connection\StreamSocket::class, $conn);
2222

2323
$bolt = new Bolt($conn);
2424
$this->assertInstanceOf(Bolt::class, $bolt);
2525

26-
/** @var AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1 $protocol */
27-
$protocol = $bolt->build();
26+
/** @var AProtocol|V4_4|V5|v5_1 $protocol */
27+
$protocol = $bolt->setProtocolVersions(5.1, 5, 4.4)->build();
2828
$this->assertInstanceOf(AProtocol::class, $protocol);
2929

3030
$this->sayHello($protocol, $GLOBALS['NEO_USER'], $GLOBALS['NEO_PASS']);
@@ -35,7 +35,7 @@ public function testInit(): AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1
3535
/**
3636
* @depends testInit
3737
*/
38-
public function testNull(AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1 $protocol): void
38+
public function testNull(AProtocol|V4_4|V5|v5_1 $protocol): void
3939
{
4040
$res = iterator_to_array(
4141
$protocol
@@ -50,7 +50,7 @@ public function testNull(AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1 $prot
5050
/**
5151
* @depends testInit
5252
*/
53-
public function testBoolean(AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1 $protocol): void
53+
public function testBoolean(AProtocol|V4_4|V5|v5_1 $protocol): void
5454
{
5555
$res = iterator_to_array(
5656
$protocol
@@ -75,7 +75,7 @@ public function testBoolean(AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1 $p
7575
* @depends testInit
7676
* @dataProvider providerInteger
7777
*/
78-
public function testInteger(int $i, AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1 $protocol): void
78+
public function testInteger(int $i, AProtocol|V4_4|V5|v5_1 $protocol): void
7979
{
8080
$res = iterator_to_array(
8181
$protocol
@@ -98,7 +98,7 @@ public function providerInteger(): \Generator
9898
/**
9999
* @depends testInit
100100
*/
101-
public function testFloat(AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1 $protocol): void
101+
public function testFloat(AProtocol|V4_4|V5|v5_1 $protocol): void
102102
{
103103
for ($i = 0; $i < 10; $i++) {
104104
$num = mt_rand(-mt_getrandmax(), mt_getrandmax()) / mt_getrandmax();
@@ -116,7 +116,7 @@ public function testFloat(AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1 $pro
116116
/**
117117
* @depends testInit
118118
*/
119-
public function testString(AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1 $protocol): void
119+
public function testString(AProtocol|V4_4|V5|v5_1 $protocol): void
120120
{
121121
$randomString = function (int $length) {
122122
$str = '';
@@ -141,7 +141,7 @@ public function testString(AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1 $pr
141141
/**
142142
* @depends testInit
143143
*/
144-
public function testList(AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1 $protocol): void
144+
public function testList(AProtocol|V4_4|V5|v5_1 $protocol): void
145145
{
146146
foreach ([0, 10, 200, 60000, 200000] as $size) {
147147
$arr = $this->randomArray($size);
@@ -168,7 +168,7 @@ private function randomArray(int $size): array
168168
/**
169169
* @depends testInit
170170
*/
171-
public function testDictionary(AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1 $protocol): void
171+
public function testDictionary(AProtocol|V4_4|V5|v5_1 $protocol): void
172172
{
173173
foreach ([0, 10, 200, 60000, 200000] as $size) {
174174
$arr = $this->randomArray($size);
@@ -186,7 +186,7 @@ public function testDictionary(AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1
186186
/**
187187
* @depends testInit
188188
*/
189-
public function testListGenerator(AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1 $protocol): void
189+
public function testListGenerator(AProtocol|V4_4|V5|v5_1 $protocol): void
190190
{
191191
$data = [
192192
'first',
@@ -208,7 +208,7 @@ public function testListGenerator(AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V
208208
/**
209209
* @depends testInit
210210
*/
211-
public function testDictionaryGenerator(AProtocol|V1|V2|V3|V4|V4_1|V4_2|V4_3|V4_4|V5|V5_1 $protocol): void
211+
public function testDictionaryGenerator(AProtocol|V4_4|V5|v5_1 $protocol): void
212212
{
213213
$data = [
214214
'a' => 'first',

0 commit comments

Comments
 (0)