Skip to content

Commit

Permalink
Perform same update for SCCPShowLine as for SCCPShowDevices
Browse files Browse the repository at this point in the history
  • Loading branch information
dkgroot committed Apr 27, 2019
1 parent c0b861c commit 99394c2
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion doc/ApiIndex.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ API Index
* [RTPReceiverStatEvent](PAMI-Message-Event-RTPReceiverStatEvent.md)
* [SCCPConfLockEvent](PAMI-Message-Event-SCCPConfLockEvent.md)
* [RequestBadFormatEvent](PAMI-Message-Event-RequestBadFormatEvent.md)
* [SCCPVariableEntryEvent](PAMI-Message-Event-SCCPVariableEntryEvent.md)
* [VgsmSmsRxEvent](PAMI-Message-Event-VgsmSmsRxEvent.md)
* [NewAccountCodeEvent](PAMI-Message-Event-NewAccountCodeEvent.md)
* [SCCPDeviceEntryEvent](PAMI-Message-Event-SCCPDeviceEntryEvent.md)
Expand Down Expand Up @@ -349,7 +350,6 @@ API Index
* [AGIExecEvent](PAMI-Message-Event-AGIExecEvent.md)
* [SCCPDeviceServiceURLEntryEvent](PAMI-Message-Event-SCCPDeviceServiceURLEntryEvent.md)
* [UnParkedCallEvent](PAMI-Message-Event-UnParkedCallEvent.md)
* [SCCPVariableEntryEvent](PAMI-Message-Event-SCCPVariableEntryEvent.md)
* [Message](PAMI-Message-Message.md)
* PAMI\Message\Response
* [SCCPShowGlobalsResponse](PAMI-Message-Response-SCCPShowGlobalsResponse.md)
Expand Down
2 changes: 1 addition & 1 deletion doc/PAMI-Message-Response-SCCPShowLineResponse.md
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ Returns events[] related to AttachedDevices from the tables['AttachedDevices']

### getMailboxes

array<mixed,\PAMI\Message\Response\events> PAMI\Message\Response\SCCPShowLineResponse::getMailboxes()
array<mixed,\PAMI\Message\Response\PAMI\Message\Event\SCCPMailboxEntryEvent> PAMI\Message\Response\SCCPShowLineResponse::getMailboxes()

Returns events[] related to Mailboxes from the tables['Mailboxes']

Expand Down
11 changes: 6 additions & 5 deletions src/PAMI/Message/Response/SCCPShowLineResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -453,40 +453,41 @@ public function getMessageWaitingOld()
* Returns events[] related to AttachedDevices from the tables['AttachedDevices']
*
* @return events[]
* @return PAMI\Message\Event\SCCPAttachedDeviceEntryEvent[]
*/
public function getAttachedDevices()
{
$res = array();
if ($this->hasTable() && array_key_exists('AttachedDevices', $this->tables)) {
$res = $this->tables['AttachedDevices'];
$res = $this->tables['AttachedDevices']['Entries'];
}
return $res;
}

/**
* Returns events[] related to Mailboxes from the tables['Mailboxes']
*
* @return events[]
* @return PAMI\Message\Event\SCCPMailboxEntryEvent[]
*/
public function getMailboxes()
{
$res = array();
if ($this->hasTable() && array_key_exists('Mailboxes', $this->tables)) {
$res = $this->tables['Mailboxes'];
$res = $this->tables['Mailboxes']['Entries'];
}
return $res;
}

/**
* Returns events[] related to Variables from the tables['Variables']
*
* @return events[]
* @return PAMI\Message\Event\SCCPVariableEntryEvent[]
*/
public function getVariables()
{
$res = array();
if ($this->hasTable() && array_key_exists('Variables', $this->tables)) {
$res = $this->tables['Variables'];
$res = $this->tables['Variables']['Entries'];
}
return $res;
}
Expand Down
4 changes: 2 additions & 2 deletions test/resources/phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
</filter>

<testsuites>
<!--
<testsuite name="Client">
<directory suffix=".php">../client</directory>
</testsuite>
Expand All @@ -47,7 +48,7 @@
</testsuite>
<testsuite name="Events">
<directory suffix=".php">../events</directory>
</testsuite>
</testsuite>-->
<testsuite name="SCCP_Actions">
<directory suffix=".php">../sccp_actions</directory>
</testsuite>
Expand All @@ -60,5 +61,4 @@
<log type="coverage-html" target="../../build/coverage-html"/>
<log type="coverage-clover" target="../../build/logs/clover.xml"/>
</logging>

</phpunit>
9 changes: 9 additions & 0 deletions test/sccp_actions/SCCP_Test_Actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1109,9 +1109,18 @@ public function can_get_SCCPShowLine()
$this->assertTrue($result->hasTable());
$this->assertEquals(array('AttachedDevices','Mailboxes','Variables'), $result->getTableNames());
$this->assertTrue(is_array($result->getTableNames()));
$subtablenames=array('AttachedDevices','Mailboxes','Variables');
foreach ($subtablenames as $subtablename) {
$getmethod = 'get' . $subtablename;
$this->assertTrue(is_array($result->$getmethod()));
}
$this->assertTrue(is_array($result->getTableNames()));
$this->assertTrue(is_array($result->getAttachedDevices()));
$this->assertEquals($result->getAttachedDevices()[0]->getDeviceName(), "SEP001B54CA499B");
$this->assertTrue(is_array($result->getMailboxes()));
$this->assertEquals($result->getMailboxes()[0]->getMailbox(), "98011");
$this->assertTrue(is_array($result->getVariables()));
$this->assertEquals($result->getVariables()[1]->getValue(), "myval2");
}


Expand Down

0 comments on commit 99394c2

Please sign in to comment.