-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from mouhsinelonly/master
Https endpoint instead of http
- Loading branch information
Showing
16 changed files
with
371 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,6 @@ | |
/vendor/ | ||
phpunit.xml | ||
composer.lock | ||
composer.phar | ||
composer.phar | ||
.phpintel | ||
/.phpintel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
namespace mikemix\Wiziq\API\Request; | ||
|
||
use mikemix\Wiziq\Common\Api\RequestInterface; | ||
use mikemix\Wiziq\Entity\Classroom; | ||
|
||
class AttendanceReport implements RequestInterface | ||
{ | ||
/** @var ClassroomId */ | ||
private $classroomId; | ||
|
||
public function __construct($classroomId) | ||
{ | ||
$this->classroomId = $classroomId; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getMethod() | ||
{ | ||
return 'get_attendance_report'; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getParams() | ||
{ | ||
return ['class_id' => $this->classroomId]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
namespace mikemix\Wiziq\API\Request; | ||
|
||
use mikemix\Wiziq\Common\Api\RequestInterface; | ||
|
||
class Download implements RequestInterface | ||
{ | ||
/** @var int */ | ||
private $classroomId; | ||
|
||
private $recordingFormat; | ||
|
||
public function __construct($classroomId, $recordingFormat) | ||
{ | ||
$this->classroomId = $classroomId; | ||
|
||
$this->recordingFormat = $recordingFormat; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getMethod() | ||
{ | ||
return 'download_recording'; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getParams() | ||
{ | ||
return [ | ||
'class_id' => $this->classroomId, | ||
'recording_format' => $this->recordingFormat | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
namespace mikemix\Wiziq\API\Request; | ||
|
||
use mikemix\Wiziq\Common\Api\RequestInterface; | ||
use mikemix\Wiziq\Entity\Classroom; | ||
|
||
class Modify implements RequestInterface | ||
{ | ||
|
||
/** @var int */ | ||
private $classroomId; | ||
|
||
/** @var Classroom */ | ||
private $classroom; | ||
|
||
public function __construct($classroomId, Classroom $classroom) | ||
{ | ||
$this->classroomId = (int)$classroomId; | ||
$this->classroom = $classroom; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getMethod() | ||
{ | ||
return 'modify'; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getParams() | ||
{ | ||
return array_merge(['class_id' => $this->classroomId], $this->classroom->toArray()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<rsp status="ok" call_id="g7hj8h2dgty4"> | ||
<method>cancel</method> | ||
<cancel status="true"> | ||
</cancel> | ||
</rsp> |
30 changes: 30 additions & 0 deletions
30
tests/.resources/get-attendance-report-success-response.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<rsp status="ok"> | ||
<method>get_attendance_report</method> | ||
<get_attendance_report status="true"> | ||
<class_id>15485</class_id> | ||
<class_duration>20</class_duration> | ||
<attendee_list> | ||
<attendee presenter="true"> | ||
<presenter_id><![CDATA[656]]></presenter_id> | ||
<screen_name><![CDATA[tsb_kid]]></screen_name> | ||
<entry_time><![CDATA[6/22/2011 1:40:59 AM]]></entry_time> | ||
<exit_time><![CDATA[6/22/2011 1:45:59 AM]]></exit_time> | ||
<attended_minutes><![CDATA[6]]></attended_minutes> | ||
</attendee> | ||
<attendee> | ||
<attendee_id><![CDATA[801]]></attendee_id> | ||
<screen_name><![CDATA[shish801]]></screen_name> | ||
<entry_time><![CDATA[6/22/2011 1:41:47 AM]]></entry_time> | ||
<exit_time><![CDATA[6/22/2011 1:45:54 AM]]></exit_time> | ||
<attended_minutes><![CDATA[5]]></attended_minutes> | ||
</attendee> | ||
<attendee> | ||
<attendee_id><![CDATA[102]]></attendee_id> | ||
<screen_name><![CDATA[shishpal]]></screen_name> | ||
<entry_time><![CDATA[6/22/2011 1:42:11 AM]]></entry_time> | ||
<exit_time><![CDATA[6/22/2011 1:46:18 AM]]></exit_time> | ||
<attended_minutes><![CDATA[5]]></attended_minutes> | ||
</attendee> | ||
</attendee_list> | ||
</get_attendance_report> | ||
</rsp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<rsp status="ok" call_id="g7hj8h2dgty4"> | ||
<method>modify</method> | ||
<modify status="true"> | ||
</modify> | ||
</rsp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,6 +53,41 @@ public function testCreateClassroom() | |
], $this->sdk->create($classroom)); | ||
} | ||
|
||
public function testModifyClassroom() | ||
{ | ||
$classroom = Classroom::build('Title', new \DateTime('2015-12-30 12:30:50')); | ||
$classroomId = 12187; | ||
|
||
$this->assertArrayNotHasKey('extend_duration', $classroom->toArray()); | ||
|
||
$this->gateway->expects($this->once()) | ||
->method('sendRequest') | ||
->with($this->equalTo(new Request\Modify($classroomId, $classroom))) | ||
->will($this->returnValue( | ||
simplexml_load_string( | ||
file_get_contents(__DIR__ . '/../.resources/modify-classroom-success-response.txt') | ||
) | ||
)); | ||
|
||
$this->assertTrue($this->sdk->modify($classroomId, $classroom)); | ||
} | ||
|
||
public function testGetAttendanceReport() | ||
{ | ||
$classroomId = 12365; | ||
|
||
$this->gateway->expects($this->once()) | ||
->method('sendRequest') | ||
->with($this->equalTo(new Request\AttendanceReport($classroomId))) | ||
->will($this->returnValue( | ||
simplexml_load_string( | ||
file_get_contents(__DIR__ . '/../.resources/get-attendance-report-success-response.txt') | ||
) | ||
)); | ||
|
||
$this->assertArraySubset([['entry_time'=>"6/22/2011 1:40:59 AM"]], $this->sdk->getAttendanceReport($classroomId)); | ||
} | ||
|
||
public function testCreatePermaClass() | ||
{ | ||
$classroom = PermaClassroom::build('Title', '[email protected]'); | ||
|
@@ -103,8 +138,12 @@ public function testCancel() | |
|
||
$this->gateway->expects($this->once()) | ||
->method('sendRequest') | ||
->with($this->equalTo(new Request\Cancel($classroomId))); | ||
|
||
$this->sdk->cancel($classroomId); | ||
->with($this->equalTo(new Request\Cancel($classroomId))) | ||
->will($this->returnValue( | ||
simplexml_load_string( | ||
file_get_contents(__DIR__ . '/../.resources/cancel-classroom-success-response.txt') | ||
) | ||
)); | ||
$this->assertTrue($this->sdk->cancel($classroomId)); | ||
} | ||
} |
Oops, something went wrong.