From ccbd05401ed380214ff960275fd8da3c64fe4e5f Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Tue, 9 Feb 2016 11:04:14 +0200 Subject: [PATCH] AriClient onClose test added --- .../Tests/Functional/Api/AriClientTest.php | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/wormling/phparia/Tests/Functional/Api/AriClientTest.php b/src/wormling/phparia/Tests/Functional/Api/AriClientTest.php index a9158ef..3ad2438 100644 --- a/src/wormling/phparia/Tests/Functional/Api/AriClientTest.php +++ b/src/wormling/phparia/Tests/Functional/Api/AriClientTest.php @@ -70,5 +70,26 @@ public function canCallOnRequest() $this->client->run(); $this->assertTrue($success); } + + /** + * @test + */ + public function canCallOnClose() + { + $success = false; + $this->client->onStasisStart(function (StasisStart $event) { + $event->getChannel()->answer(); + $this->client->stop(); + }); + $this->client->getAriClient()->onClose(function () use (&$success) { + $success = true; + }); + $this->client->getAriClient()->onConnect(function () { + $this->client->channels()->createChannel($this->dialString, null, null, null, null, + $this->client->getStasisApplicationName()); + }); + $this->client->run(); + $this->assertTrue($success); + } } } \ No newline at end of file