Skip to content

Commit 68a1d51

Browse files
committed
Update tests to use VbcConfig
1 parent 2fe13b8 commit 68a1d51

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

src/Application/Application.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,16 +230,22 @@ public function jsonSerialize()
230230
}
231231

232232
// Handle VBC specifically
233-
if ($this->vbcConfig->isEnabled()) {
233+
if ($this->getVbcConfig()->isEnabled()) {
234234
$capabilities['vbc'] = new \StdClass;
235235
}
236236

237+
// Workaround API bug. It expects an object and throws 500
238+
// if it gets an array
239+
if (!count($capabilities)) {
240+
$capabilities = (object) $capabilities;
241+
}
242+
237243
return [
238244
'name' => $this->getName(),
239245
'keys' => [
240246
'public_key' => $this->getPublicKey()
241247
],
242-
'capabilities' => (object) $capabilities
248+
'capabilities' => $capabilities
243249
];
244250
}
245251

src/Application/Client.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ protected function createFromArrayV1($array) {
236236

237237
// VBC
238238
if (isset($array['vbc']) && $array['vbc']) {
239-
$application->enableVbc();
239+
$application->getVbcConfig()->enable();
240240
}
241241

242242
return $application;
@@ -303,7 +303,7 @@ protected function createFromArrayV2($array) {
303303

304304
// Handle VBC
305305
if (isset($capabilities['vbc'])) {
306-
$application->enableVbc();
306+
$application->getVbcConfig()->enable();
307307
}
308308

309309
return $application;

test/Application/ApplicationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function testResponseSetsRtcConfigs()
105105
public function testResponseSetsVbcConfigs()
106106
{
107107
$this->app->setResponse($this->getResponse());
108-
$this->assertEquals(true, $this->app->isVbcEnabled());
108+
$this->assertEquals(true, $this->app->getVbcConfig()->isEnabled());
109109
}
110110

111111
public function testCanGetDirtyValues()

test/Application/ClientTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ public function createApplication()
463463
$application->getMessagesConfig()->setWebhook(MessagesConfig::INBOUND, 'https://example.com/inbound', 'POST');
464464
$application->getRtcConfig()->setWebhook(RtcConfig::EVENT, 'https://example.com/event', 'POST');
465465
$application->setPublicKey('-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCA\nKOxjsU4pf/sMFi9N0jqcSLcjxu33G\nd/vynKnlw9SENi+UZR44GdjGdmfm1\ntL1eA7IBh2HNnkYXnAwYzKJoa4eO3\n0kYWekeIZawIwe/g9faFgkev+1xsO\nOUNhPx2LhuLmgwWSRS4L5W851Xe3f\nUQIDAQAB\n-----END PUBLIC KEY-----\n');
466-
$application->enableVbc();
466+
$application->getVbcConfig()->enable();
467467

468468
$rawV1 = [
469469
'name' => 'test application',

0 commit comments

Comments
 (0)