Skip to content

Commit 700d332

Browse files
committed
fixed unit tests using bolt 7.0
1 parent b802e51 commit 700d332

File tree

4 files changed

+16
-11
lines changed

4 files changed

+16
-11
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"psr/http-factory": "^1.0",
2929
"psr/http-client": "^1.0",
3030
"php-http/message": "^1.0",
31-
"stefanak-michal/bolt": "^6.0",
31+
"stefanak-michal/bolt": "^7.0",
3232
"symfony/polyfill-php80": "^1.2",
3333
"psr/simple-cache": ">=2.0",
3434
"ext-json": "*",

src/Bolt/BoltConnection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
namespace Laudis\Neo4j\Bolt;
1515

1616
use Bolt\protocol\Response;
17-
use Bolt\protocol\ServerState;
17+
use Bolt\enum\ServerState;
1818
use Bolt\protocol\V4_4;
1919
use Bolt\protocol\V5;
2020
use Laudis\Neo4j\Common\ConnectionConfiguration;
@@ -282,7 +282,7 @@ public function pull(?int $qid, ?int $fetchSize): array
282282

283283
public function __destruct()
284284
{
285-
if (!$this->protocol()->serverState->is(ServerState::FAILED) && $this->isOpen()) {
285+
if (!$this->protocol()->serverState === ServerState::FAILED && $this->isOpen()) {
286286
if ($this->protocol()->serverState->is(ServerState::STREAMING, ServerState::TX_STREAMING)) {
287287
$this->consumeResults();
288288
}

tests/Unit/BoltFactoryTest.php

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414
namespace Laudis\Neo4j\Tests\Unit;
1515

1616
use Bolt\connection\IConnection;
17-
use Bolt\packstream\v1\Packer;
18-
use Bolt\packstream\v1\Unpacker;
19-
use Bolt\protocol\ServerState;
17+
use Bolt\enum\ServerState;
2018
use Bolt\protocol\V5;
2119
use Laudis\Neo4j\Authentication\Authenticate;
2220
use Laudis\Neo4j\Bolt\BoltConnection;
@@ -41,12 +39,19 @@ protected function setUp(): void
4139
$basicConnectionFactory = $this->createMock(BasicConnectionFactoryInterface::class);
4240
$basicConnectionFactory->method('create')
4341
->willReturn(new Connection($this->createMock(IConnection::class), ''));
42+
43+
4444
$protocolFactory = $this->createMock(ProtocolFactory::class);
4545
$protocolFactory->method('createProtocol')
46-
->willReturnCallback(static fn (IConnection $connection) => [
47-
new V5(new Packer(), new Unpacker(), $connection, new ServerState()),
48-
['server' => 'abc', 'connection_id' => 'i'],
49-
]);
46+
->willReturnCallback(static function (IConnection $connection) {
47+
$protocol = new V5(1, $connection);
48+
$protocol->serverState = ServerState::READY;
49+
50+
return [
51+
$protocol,
52+
['server' => 'abc', 'connection_id' => 'i'],
53+
];
54+
});
5055

5156
$this->factory = new BoltFactory(
5257
$basicConnectionFactory,

tests/Unit/ParameterHelperTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public function testDateTime(): void
162162
$date = ParameterHelper::asParameter(new DateTime('now', new DateTimeZone('Europe/Brussels')), ConnectionProtocol::BOLT_V44());
163163

164164
self::assertInstanceOf(DateTimeZoneId::class, $date);
165-
self::assertEquals('Europe/Brussels', $date->tz_id());
165+
self::assertEquals('Europe/Brussels', $date->tz_id);
166166
}
167167

168168
public function testDateTime5(): void

0 commit comments

Comments
 (0)