-
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.
BC break: allow room based teacher when creating perma class
- Loading branch information
Michal Zukowski
committed
Nov 26, 2015
1 parent
78786ad
commit e980946
Showing
3 changed files
with
45 additions
and
13 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 |
---|---|---|
|
@@ -10,7 +10,9 @@ $gateway = new Wiziq\API\Gateway($auth); | |
$api = new Wiziq\API\ClassroomApi($gateway); | ||
|
||
try { | ||
$classroom = Wiziq\Entity\Classroom::build('Class title', '[email protected]', new \DateTime('now')); | ||
$classroom = Wiziq\Entity\Classroom::build('Class title', new \DateTime('now')) | ||
->withPresenter(100, 'Presenter Name'); | ||
|
||
$response = $api->create($classroom); | ||
|
||
printf('Class %s created: %s', $classroom, var_export($response, true)); | ||
|
@@ -61,7 +63,9 @@ $gateway = new Wiziq\API\Gateway($auth); | |
$api = new Wiziq\API\ClassroomApi($gateway); | ||
|
||
try { | ||
$classroom = Wiziq\Entity\PermaClassroom::build('Class title', '[email protected]'); | ||
$classroom = Wiziq\Entity\PermaClassroom::build('Class title') | ||
->withPresenter(100, 'Presenter Name'); | ||
|
||
$response = $api->createPermaClass($classroom); | ||
|
||
printf('Perma class %s created: %s', $classroom, var_export($response, true)); | ||
|
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 |
---|---|---|
|
@@ -11,26 +11,49 @@ class PermaClassroomTest extends \PHPUnit_Framework_TestCase | |
/** @var array */ | ||
private $expected = [ | ||
'title' => 'Title', | ||
'presenter_email' => '[email protected]', | ||
'attendee_limit' => '', | ||
'presenter_default_controls' => '', | ||
'attendee_default_controls' => '', | ||
'create_recording' => '', | ||
'return_url' => '', | ||
'status_ping_url' => '', | ||
'language_culture_name' => '', | ||
'presenter_id' => '', | ||
'presenter_name' => '', | ||
]; | ||
|
||
public function setUp() | ||
{ | ||
$this->entity = PermaClassroom::build('Title', '[email protected]'); | ||
$this->entity = PermaClassroom::build('Title'); | ||
} | ||
|
||
public function testBuildBasic() | ||
{ | ||
$this->assertEquals($this->expected, $this->entity->toArray()); | ||
} | ||
|
||
public function testBuildWithPresenter() | ||
{ | ||
$this->expected['presenter_id'] = 100; | ||
$this->expected['presenter_name'] = '[email protected]'; | ||
$newEntity = $this->entity->withPresenter($this->expected['presenter_id'], $this->expected['presenter_name']); | ||
|
||
$this->assertEquals($this->expected, $newEntity->toArray()); | ||
$this->assertNotSame($newEntity, $this->entity); | ||
} | ||
|
||
public function testBuildWithPresenterEmail() | ||
{ | ||
unset($this->expected['presenter_id']); | ||
unset($this->expected['presenter_name']); | ||
|
||
$this->expected['presenter_email'] = '[email protected]'; | ||
$newEntity = $this->entity->withPresenterEmail($this->expected['presenter_email']); | ||
|
||
$this->assertEquals($this->expected, $newEntity->toArray()); | ||
$this->assertNotSame($newEntity, $this->entity); | ||
} | ||
|
||
public function testBuildWithLanguageCultureName() | ||
{ | ||
$this->expected['language_culture_name'] = 'en-EN'; | ||
|