Skip to content

Commit e6ddcb1

Browse files
committed
TASK: Add test for queueSubscribe method
1 parent faf6f2d commit e6ddcb1

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

tests/Unit/ConnectionTest.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,33 @@ public function testSubscription()
157157
$this->c->wait(1);
158158
}
159159

160+
/**
161+
* Test Queue Subscription command.
162+
*
163+
* @return void
164+
*/
165+
public function testQueueSubscription()
166+
{
167+
$callback = function ($message) {
168+
$this->assertNotNull($message);
169+
$this->assertEquals($message, 'bar');
170+
};
171+
172+
$this->c->queueSubscribe('foo', 'bar', $callback);
173+
$this->assertGreaterThan(0, $this->c->subscriptionsCount());
174+
$subscriptions = $this->c->getSubscriptions();
175+
$this->assertInternalType('array', $subscriptions);
176+
177+
$this->c->publish('foo', 'bar');
178+
$this->assertEquals(1, $this->c->pubsCount());
179+
/*
180+
$process = new BackgroundProcess('/usr/bin/php ./tests/Util/ClientServerStub.php ');
181+
$process->run();
182+
*/
183+
// time_nanosleep(1, 0);
184+
$this->c->wait(1);
185+
}
186+
160187
/**
161188
* Test Request command.
162189
*

0 commit comments

Comments
 (0)