Commit 6710d967 authored by Ghazi Triki's avatar Ghazi Triki
Browse files

Move userdata property to JoinMeetingParameters

parent f461e1ad
......@@ -55,6 +55,16 @@ class Attendee
*/
private $hasVideo;
/**
* @var array
*/
private $customData;
/**
* @var string
*/
private $clientType;
/**
* Attendee constructor.
* @param $xml \SimpleXMLElement
......@@ -68,6 +78,11 @@ class Attendee
$this->isListeningOnly = $xml->isListeningOnly->__toString() === 'true';
$this->hasJoinedVoice = $xml->hasJoinedVoice->__toString() === 'true';
$this->hasVideo = $xml->hasVideo->__toString() === 'true';
$this->clientType = $xml->clientType->__toString();
foreach ($xml->customdata->children() as $data) {
$this->customData[$data->getName()] = $data->__toString();
}
}
/**
......@@ -125,4 +140,20 @@ class Attendee
{
return $this->hasVideo;
}
/**
* @return string
*/
public function getClientType()
{
return $this->clientType;
}
/**
* @return array
*/
public function getCustomData()
{
return $this->customData;
}
}
......@@ -21,7 +21,7 @@ namespace BigBlueButton\Parameters;
/**
* Class CreateMeetingParameters.
*/
class CreateMeetingParameters extends UserDataParameters
class CreateMeetingParameters extends MetaParameters
{
/**
* @var string
......@@ -713,7 +713,6 @@ class CreateMeetingParameters extends UserDataParameters
}
$this->buildMeta($queries);
$this->buildUserData($queries);
return $this->buildHTTPQuery($queries);
}
......
......@@ -21,7 +21,7 @@ namespace BigBlueButton\Parameters;
/**
* Class JoinMeetingParametersTest.
*/
class JoinMeetingParameters extends BaseParameters
class JoinMeetingParameters extends UserDataParameters
{
/**
* @var string
......@@ -312,20 +312,21 @@ class JoinMeetingParameters extends BaseParameters
*/
public function getHTTPQuery()
{
return $this->buildHTTPQuery(
[
'meetingID' => $this->meetingId,
'fullName' => $this->username,
'password' => $this->password,
'userID' => $this->userId,
'webVoiceConf' => $this->webVoiceConf,
'createTime' => $this->creationTime,
'configToken' => $this->configToken,
'avatarURL' => $this->avatarURL,
'redirect' => $this->redirect ? 'true' : 'false',
'joinViaHtml5' => $this->joinViaHtml5 ? 'true' : 'false',
'clientURL' => $this->clientURL
]
);
$queries = [
'meetingID' => $this->meetingId,
'fullName' => $this->username,
'password' => $this->password,
'userID' => $this->userId,
'webVoiceConf' => $this->webVoiceConf,
'createTime' => $this->creationTime,
'configToken' => $this->configToken,
'avatarURL' => $this->avatarURL,
'redirect' => $this->redirect ? 'true' : 'false',
'joinViaHtml5' => $this->joinViaHtml5 ? 'true' : 'false',
'clientURL' => $this->clientURL
];
$this->buildUserData($queries);
return $this->buildHTTPQuery($queries);
}
}
......@@ -15,14 +15,14 @@
*
* You should have received a copy of the GNU Lesser General Public License along
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
*/
*/
namespace BigBlueButton\Parameters;
/**
* Class UserDataParameters
* @package BigBlueButton\Parameters
*/
abstract class UserDataParameters extends MetaParameters
abstract class UserDataParameters extends BaseParameters
{
/**
* @var array
......
......@@ -52,7 +52,6 @@ class CreateMeetingParametersTest extends TestCase
$this->assertEquals($params['muteOnStart'], $createMeetingParams->isMuteOnStart());
$this->assertEquals($params['meta_presenter'], $createMeetingParams->getMeta('presenter'));
$this->assertEquals($params['meta_endCallbackUrl'], $createMeetingParams->getMeta('endCallbackUrl'));
$this->assertEquals($params['userdata_countrycode'], $createMeetingParams->getUserData('countrycode'));
// Check values are empty of this is not a breakout room
$this->assertNull($createMeetingParams->isBreakout());
......
......@@ -33,6 +33,7 @@ class JoinMeetingParametersTest extends TestCase
$this->assertEquals($params['userId'], $joinMeetingParams->getUserId());
$this->assertEquals($params['webVoiceConf'], $joinMeetingParams->getWebVoiceConf());
$this->assertEquals($params['creationTime'], $joinMeetingParams->getCreationTime());
$this->assertEquals($params['userdata_countrycode'], $joinMeetingParams->getUserData('countrycode'));
// Test setters that are ignored by the constructor
$joinMeetingParams->setMeetingId($newId = $this->faker->uuid);
......
......@@ -76,7 +76,14 @@ class GetMeetingInfoResponseTest extends \BigBlueButton\TestCase
$this->assertEquals(false, $anAttendee->isListeningOnly());
$this->assertEquals(true, $anAttendee->hasJoinedVoice());
$this->assertEquals(false, $anAttendee->hasVideo());
$this->assertEquals('FLASH', $anAttendee->getClientType());
$this->assertCount(2, $this->meetingInfo->getAttendees());
$customData = $anAttendee->getCustomData();
$this->assertEquals(3, sizeof($customData));
$this->assertEquals('true', $customData['skipCheck']);
$this->assertEquals('#FF0033', $customData['backgroundColor']);
$this->assertEquals('a:focus{color:#0181eb}', $customData['customStyle']);
}
public function testGetMeetingInfoResponseTypes()
......@@ -95,7 +102,7 @@ class GetMeetingInfoResponseTest extends \BigBlueButton\TestCase
$anAttendee = $this->meetingInfo->getAttendees()[1];
$this->assertEachGetterValueIsString($anAttendee, ['getUserId', 'getFullName', 'getRole']);
$this->assertEachGetterValueIsString($anAttendee, ['getUserId', 'getFullName', 'getRole', 'getClientType']);
$this->assertEachGetterValueIsBoolean($anAttendee, ['isPresenter', 'isListeningOnly', 'hasJoinedVoice', 'hasVideo']);
}
......
......@@ -87,8 +87,7 @@ class TestCase extends \PHPUnit\Framework\TestCase
'copyright' => $this->faker->text,
'muteOnStart' => $this->faker->boolean(50),
'meta_presenter' => $this->faker->name,
'meta_endCallbackUrl' => $this->faker->url,
'userdata_countrycode' => $this->faker->countryCode
'meta_endCallbackUrl' => $this->faker->url
];
}
......@@ -121,8 +120,7 @@ class TestCase extends \PHPUnit\Framework\TestCase
->setDuration($params['duration'])->setWelcomeMessage($params['welcomeMessage'])->setAutoStartRecording($params['autoStartRecording'])
->setAllowStartStopRecording($params['allowStartStopRecording'])->setModeratorOnlyMessage($params['moderatorOnlyMessage'])
->setWebcamsOnlyForModerator($params['webcamsOnlyForModerator'])->setLogo($params['logo'])->setCopyright($params['copyright'])
->setEndCallbackUrl($params['meta_endCallbackUrl'])->setMuteOnStart($params['muteOnStart'])->addMeta('presenter', $params['meta_presenter'])
->addUserData('countrycode', $params['userdata_countrycode']);
->setEndCallbackUrl($params['meta_endCallbackUrl'])->setMuteOnStart($params['muteOnStart'])->addMeta('presenter', $params['meta_presenter']);
}
/**
......@@ -143,12 +141,14 @@ class TestCase extends \PHPUnit\Framework\TestCase
*/
protected function generateJoinMeetingParams()
{
return ['meetingId' => $this->faker->uuid,
'userName' => $this->faker->name,
'password' => $this->faker->password,
'userId' => $this->faker->numberBetween(1, 1000),
'webVoiceConf' => $this->faker->word,
'creationTime' => $this->faker->unixTime];
return ['meetingId' => $this->faker->uuid,
'userName' => $this->faker->name,
'password' => $this->faker->password,
'userId' => $this->faker->numberBetween(1, 1000),
'webVoiceConf' => $this->faker->word,
'creationTime' => $this->faker->unixTime,
'userdata_countrycode' => $this->faker->countryCode
];
}
/**
......@@ -160,7 +160,8 @@ class TestCase extends \PHPUnit\Framework\TestCase
{
$joinMeetingParams = new JoinMeetingParameters($params['meetingId'], $params['userName'], $params['password']);
return $joinMeetingParams->setUserId($params['userId'])->setWebVoiceConf($params['webVoiceConf'])->setCreationTime($params['creationTime']);
return $joinMeetingParams->setUserId($params['userId'])->setWebVoiceConf($params['webVoiceConf'])
->setCreationTime($params['creationTime'])->addUserData('countrycode', $params['userdata_countrycode']);
}
/**
......
......@@ -32,6 +32,7 @@
<isListeningOnly>false</isListeningOnly>
<hasJoinedVoice>true</hasJoinedVoice>
<hasVideo>true</hasVideo>
<clientType>HTML5</clientType>
<customdata></customdata>
</attendee>
<attendee>
......@@ -42,7 +43,12 @@
<isListeningOnly>false</isListeningOnly>
<hasJoinedVoice>true</hasJoinedVoice>
<hasVideo>false</hasVideo>
<customdata></customdata>
<clientType>FLASH</clientType>
<customdata>
<skipCheck>true</skipCheck>
<backgroundColor>#FF0033</backgroundColor>
<customStyle>a:focus{color:#0181eb}</customStyle>
</customdata>
</attendee>
</attendees>
<isBreakout>true</isBreakout>
......@@ -52,7 +58,7 @@
<bbb-context>Best BBB Developers Club</bbb-context>
<bn-origin>Moodle</bn-origin>
<bn-recording-ready-url>
http://bigbluebutton.org/moodle/mod/bigbluebuttonbn/bbb_broker.php?action=recording_ready
http://bigbluebutton.org/moodle/mod/bigbluebuttonbn/bbb_broker.php?action=recording_ready
</bn-recording-ready-url>
<bbb-origin-tag>moodle-mod_bigbluebuttonbn (2015080609)</bbb-origin-tag>
<bbb-origin-version>3.0.2 (Build: 20160111)</bbb-origin-version>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment