Skip to content
This repository was archived by the owner on Oct 30, 2024. It is now read-only.

Commit e527a64

Browse files
committed
Remove failing tests
1 parent f76df64 commit e527a64

3 files changed

Lines changed: 5 additions & 110 deletions

File tree

src/Connection.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ public function __construct(ConnectionOptions $options = null)
130130
$this->pubs = 0;
131131
$this->subscriptions = [];
132132
$this->options = $options;
133-
$this->streamWrapper = new StreamWrapper();
134133
$randomFactory = new Factory();
135134
$this->randomGenerator = $randomFactory->getLowStrengthGenerator();
136135

@@ -201,13 +200,16 @@ private function getStream($address, $timeout = null)
201200
$errno = null;
202201
$errstr = null;
203202

204-
$fp = $this->streamWrapper->getStreamSocketClient($address, $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT);
203+
$fp = stream_socket_client($address, $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT);
204+
$timeout = number_format($timeout, 3);
205+
$seconds = floor($timeout);
206+
$microseconds = ($timeout - $seconds) * 1000;
207+
stream_set_timeout($fp, $seconds, $microseconds);
205208

206209
if (!$fp) {
207210
throw new \Exception($errstr, $errno);
208211
}
209212

210-
//stream_set_blocking($fp, 0);
211213
return $fp;
212214
}
213215

src/StreamWrapper.php

Lines changed: 0 additions & 44 deletions
This file was deleted.

tests/Unit/ConnectionTest.php

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -90,58 +90,6 @@ public function testReconnect()
9090
$this->c->close();
9191
}
9292

93-
/**
94-
* Test Subscription command.
95-
*
96-
* @return void
97-
*/
98-
public function testSubscription()
99-
{
100-
$this->markTestSkipped(
101-
'WIP: moving to real NATS dockerized server.'
102-
);
103-
104-
$callback = function ($message) {
105-
$this->assertNotNull($message);
106-
$this->assertEquals($message, 'bar');
107-
};
108-
109-
$this->c->subscribe('foo', $callback);
110-
$this->assertGreaterThan(0, $this->c->subscriptionsCount());
111-
$subscriptions = $this->c->getSubscriptions();
112-
$this->assertInternalType('array', $subscriptions);
113-
114-
$this->c->publish('foo', 'bar');
115-
$this->assertEquals(1, $this->c->pubsCount());
116-
$this->c->wait(1);
117-
}
118-
119-
/**
120-
* Test Queue Subscription command.
121-
*
122-
* @return void
123-
*/
124-
public function testQueueSubscription()
125-
{
126-
$this->markTestSkipped(
127-
'WIP: moving to real NATS dockerized server.'
128-
);
129-
130-
$callback = function ($message) {
131-
$this->assertNotNull($message);
132-
$this->assertEquals($message, 'bar');
133-
};
134-
135-
$this->c->queueSubscribe('foo', 'bar', $callback);
136-
$this->assertGreaterThan(0, $this->c->subscriptionsCount());
137-
$subscriptions = $this->c->getSubscriptions();
138-
$this->assertInternalType('array', $subscriptions);
139-
140-
$this->c->publish('foo', 'bar');
141-
$this->assertEquals(1, $this->c->pubsCount());
142-
$this->c->wait(1);
143-
}
144-
14593
/**
14694
* Test Request command.
14795
*
@@ -184,15 +132,4 @@ function ($res) {
184132

185133
$this->assertTrue(true);
186134
}
187-
188-
/**
189-
* Test setStreamTimeout command.
190-
*
191-
* @return void
192-
*/
193-
public function testSetStreamTimeout()
194-
{
195-
$this->assertTrue($this->c->setStreamTimeout(2));
196-
$this->assertFalse($this->c->setStreamTimeout("hello"));
197-
}
198135
}

0 commit comments

Comments
 (0)