Skip to content

Commit b366638

Browse files
extended tests
1 parent 75b20f2 commit b366638

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Bolt
22
Bolt protocol library over TCP socket. Bolt protocol is primary used for communication with [Neo4j](https://neo4j.com/) Graph database. The documentation is available at [https://7687.org/](https://7687.org/).
33

4-
![](https://img.shields.io/badge/phpunit-passed-success) ![](https://img.shields.io/badge/coverage-74%25-yellowgreen) ![](https://img.shields.io/github/stars/stefanak-michal/Bolt) ![](https://img.shields.io/packagist/dt/stefanak-michal/bolt) ![](https://img.shields.io/github/v/release/stefanak-michal/bolt) ![](https://img.shields.io/github/commits-since/stefanak-michal/bolt/latest)
4+
![](https://img.shields.io/badge/phpunit-passed-success) ![](https://img.shields.io/badge/coverage-77%25-green) ![](https://img.shields.io/github/stars/stefanak-michal/Bolt) ![](https://img.shields.io/packagist/dt/stefanak-michal/bolt) ![](https://img.shields.io/github/v/release/stefanak-michal/bolt) ![](https://img.shields.io/github/commits-since/stefanak-michal/bolt/latest)
55

66
## Version support
77
Bolt <= 4.1

src/connection/StreamSocket.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66
use Bolt\Bolt;
77
use Exception;
88

9+
/**
10+
* Stream socket class
11+
*
12+
* @author Michal Stefanak
13+
* @link https://github.com/stefanak-michal/Bolt
14+
* @package Bolt\connection
15+
*/
916
class StreamSocket implements IConnection
1017
{
1118

tests/ATest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ protected function mockConnection()
4040
$mockBuilder = $this
4141
->getMockBuilder(IConnection::class)
4242
->disableOriginalConstructor();
43-
call_user_func([$mockBuilder, method_exists($mockBuilder, 'onlyMethods') ? 'onlyMethods' : 'setMethods'], ['write', 'read', 'connect', 'disconnect']);
43+
call_user_func([$mockBuilder, method_exists($mockBuilder, 'onlyMethods') ? 'onlyMethods' : 'setMethods'], ['__construct', 'write', 'read', 'connect', 'disconnect']);
4444
/** @var IConnection $connection */
4545
$connection = $mockBuilder->getMock();
4646

tests/BoltTest.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
*
1313
* @covers \Bolt\Bolt
1414
* @covers \Bolt\connection\Socket
15+
* @covers \Bolt\connection\StreamSocket
1516
* @covers \Bolt\PackStream\v1\Packer
1617
* @covers \Bolt\PackStream\v1\Unpacker
1718
*
@@ -28,10 +29,22 @@ class BoltTest extends \Bolt\tests\ATest
2829
*/
2930
public function testHello(): ?Bolt
3031
{
32+
Bolt::$debug = true;
33+
3134
try {
32-
$bolt = new Bolt($GLOBALS['NEO_HOST'] ?? '127.0.0.1', $GLOBALS['NEO_PORT'] ?? 7687);
35+
$conn = new \Bolt\connection\StreamSocket($GLOBALS['NEO_HOST'] ?? '127.0.0.1', $GLOBALS['NEO_PORT'] ?? 7687);
36+
$this->assertInstanceOf(\Bolt\connection\StreamSocket::class, $conn);
37+
$bolt = new Bolt($conn);
3338
$this->assertInstanceOf(Bolt::class, $bolt);
3439
$this->assertTrue($bolt->hello('Test/1.0', $GLOBALS['NEO_USER'], $GLOBALS['NEO_PASS']));
40+
unset($bolt);
41+
42+
$conn = new \Bolt\connection\Socket($GLOBALS['NEO_HOST'] ?? '127.0.0.1', $GLOBALS['NEO_PORT'] ?? 7687);
43+
$this->assertInstanceOf(\Bolt\connection\Socket::class, $conn);
44+
$bolt = new Bolt($conn);
45+
$this->assertInstanceOf(Bolt::class, $bolt);
46+
$this->assertTrue($bolt->hello('Test/1.0', $GLOBALS['NEO_USER'], $GLOBALS['NEO_PASS']));
47+
3548
return $bolt;
3649
} catch (\Exception $e) {
3750
$this->markTestSkipped($e->getMessage());

0 commit comments

Comments
 (0)