Skip to content

Commit 14700c5

Browse files
committed
Implemented updateRecordings
1 parent ca35a2a commit 14700c5

15 files changed

Lines changed: 300 additions & 13 deletions

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ before_script:
2525

2626
script:
2727
- mkdir -p build/logs
28+
- if [ "$TRAVIS_PHP_VERSION" == "5.4" ]; then phpunit; fi
2829
- if [ "$TRAVIS_PHP_VERSION" != "nightly" ]; then phpunit --coverage-clover build/logs/clover.xml; fi
2930
- if [ "$TRAVIS_PHP_VERSION" == "nightly" ]; then phpunit; fi
3031

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
"ext-curl": "*"
2828
},
2929
"require-dev": {
30-
"phpunit/phpunit": "~4.0",
30+
"composer/composer": "1.0.*@dev",
31+
"phpunit/phpunit": "4.1.*",
3132
"fzaninotto/faker": "~1.5.0",
3233
"friendsofphp/php-cs-fixer": "~1.10",
3334
"squizlabs/php_codesniffer": "2.*",

src/BigBlueButton.php

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
use BigBlueButton\Parameters\IsMeetingRunningParameters;
2828
use BigBlueButton\Parameters\JoinMeetingParameters;
2929
use BigBlueButton\Parameters\PublishRecordingsParameters;
30+
use BigBlueButton\Parameters\UpdateRecordingsParameters;
3031
use BigBlueButton\Responses\ApiVersionResponse;
3132
use BigBlueButton\Responses\CreateMeetingResponse;
3233
use BigBlueButton\Responses\DeleteRecordingsResponse;
@@ -38,6 +39,7 @@
3839
use BigBlueButton\Responses\IsMeetingRunningResponse;
3940
use BigBlueButton\Responses\JoinMeetingResponse;
4041
use BigBlueButton\Responses\PublishRecordingsResponse;
42+
use BigBlueButton\Responses\UpdateRecordingsResponse;
4143
use BigBlueButton\Util\UrlBuilder;
4244
use SimpleXMLElement;
4345

@@ -283,23 +285,44 @@ public function publishRecordings($recordingParams)
283285
* @param $recordingParams DeleteRecordingsParameters
284286
* @return string
285287
*/
286-
public function deleteRecordingsUrl($recordingParams)
288+
public function getDeleteRecordingsUrl($recordingParams)
287289
{
288290
return $this->urlBuilder->buildUrl(ApiMethod::DELETE_RECORDINGS, $recordingParams->getHTTPQuery());
289291
}
290292

291293
/**
292-
* @param $recordingParams
294+
* @param $recordingParams DeleteRecordingsParameters
293295
* @return DeleteRecordingsResponse
294296
* @throws \RuntimeException
295297
*/
296298
public function deleteRecordings($recordingParams)
297299
{
298-
$xml = $this->processXmlResponse($this->deleteRecordingsUrl($recordingParams));
300+
$xml = $this->processXmlResponse($this->getDeleteRecordingsUrl($recordingParams));
299301

300302
return new DeleteRecordingsResponse($xml);
301303
}
302304

305+
/**
306+
* @param $recordingParams UpdateRecordingsParameters
307+
* @return string
308+
*/
309+
public function getUpdateRecordingsUrl($recordingParams)
310+
{
311+
return $this->urlBuilder->buildUrl(ApiMethod::UPDATE_RECORDINGS, $recordingParams->getHTTPQuery());
312+
}
313+
314+
/**
315+
* @param $recordingParams UpdateRecordingsParameters
316+
* @return UpdateRecordingsResponse
317+
* @throws \RuntimeException
318+
*/
319+
public function updateRecordings($recordingParams)
320+
{
321+
$xml = $this->processXmlResponse($this->getUpdateRecordingsUrl($recordingParams));
322+
323+
return new UpdateRecordingsResponse($xml);
324+
}
325+
303326
/* ____________________ INTERNAL CLASS METHODS ___________________ */
304327

305328
/**

src/Core/ApiMethod.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,5 @@ abstract class ApiMethod
3434
const GET_RECORDINGS = 'getRecordings';
3535
const PUBLISH_RECORDINGS = 'publishRecordings';
3636
const DELETE_RECORDINGS = 'deleteRecordings';
37+
const UPDATE_RECORDINGS = 'updateRecordings';
3738
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<?php
2+
/**
3+
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/.
4+
*
5+
* Copyright (c) 2016 BigBlueButton Inc. and by respective authors (see below).
6+
*
7+
* This program is free software; you can redistribute it and/or modify it under the
8+
* terms of the GNU Lesser General Public License as published by the Free Software
9+
* Foundation; either version 3.0 of the License, or (at your option) any later
10+
* version.
11+
*
12+
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
13+
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14+
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Lesser General Public License along
17+
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
18+
*/
19+
namespace BigBlueButton\Parameters;
20+
21+
/**
22+
* Class UpdateRecordingsParameters
23+
* @package BigBlueButton\Parameters
24+
*/
25+
class UpdateRecordingsParameters extends MetaParameters
26+
{
27+
/**
28+
* @var string
29+
*/
30+
private $recordingId;
31+
32+
/**
33+
* UpdateRecordingsParameters constructor.
34+
*
35+
* @param $recordingId
36+
* @param $protect
37+
*/
38+
public function __construct($recordingId)
39+
{
40+
$this->recordingId = $recordingId;
41+
}
42+
43+
/**
44+
* @return string
45+
*/
46+
public function getRecordingId()
47+
{
48+
return $this->recordingId;
49+
}
50+
51+
/**
52+
* @param string $recordingId
53+
* @return UpdateRecordingsParameters
54+
*/
55+
public function setRecordingId($recordingId)
56+
{
57+
$this->recordingId = $recordingId;
58+
59+
return $this;
60+
}
61+
62+
/**
63+
* @return string
64+
*/
65+
public function getHTTPQuery()
66+
{
67+
$queries = [
68+
'recordID' => $this->recordingId,
69+
];
70+
71+
$this->buildMeta($queries);
72+
73+
return $this->buildHTTPQuery($queries);
74+
}
75+
}

src/Responses/DeleteRecordingsResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
namespace BigBlueButton\Responses;
2020

2121
/**
22-
* Class PublishRecordingsResponse
22+
* Class DeleteRecordingsResponse
2323
* @package BigBlueButton\Parameters
2424
*/
2525
class DeleteRecordingsResponse extends BaseResponse
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
/**
3+
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/.
4+
*
5+
* Copyright (c) 2016 BigBlueButton Inc. and by respective authors (see below).
6+
*
7+
* This program is free software; you can redistribute it and/or modify it under the
8+
* terms of the GNU Lesser General Public License as published by the Free Software
9+
* Foundation; either version 3.0 of the License, or (at your option) any later
10+
* version.
11+
*
12+
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
13+
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14+
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Lesser General Public License along
17+
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
18+
*/
19+
namespace BigBlueButton\Responses;
20+
21+
/**
22+
* Class UpdateRecordingsResponse
23+
* @package BigBlueButton\Parameters
24+
*/
25+
class UpdateRecordingsResponse extends BaseResponse
26+
{
27+
/**
28+
* @return bool
29+
*/
30+
public function isUpdated()
31+
{
32+
return $this->rawXml->updated->__toString() == 'true';
33+
}
34+
}

tests/BigBlueButtonTest.php

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
use BigBlueButton\Parameters\GetRecordingsParameters;
2626
use BigBlueButton\Parameters\IsMeetingRunningParameters;
2727
use BigBlueButton\Parameters\PublishRecordingsParameters;
28+
use BigBlueButton\Parameters\UpdateRecordingsParameters;
2829

2930
/**
3031
* Class BigBlueButtonTest
@@ -143,7 +144,8 @@ public function testJoinMeeting()
143144
$joinMeetingMock = $this->getJoinMeetingMock($joinMeetingParams);
144145
$joinMeetingMock->setRedirect(false);
145146

146-
$this->setExpectedException(\Exception::class);
147+
$exception = new \Exception;
148+
$this->setExpectedException(get_class($exception));
147149
$this->bbb->joinMeeting($joinMeetingMock);
148150
}
149151

@@ -259,7 +261,7 @@ public function testPublishRecordings()
259261

260262
public function testDeleteRecordingsUrl()
261263
{
262-
$url = $this->bbb->deleteRecordingsUrl(new DeleteRecordingsParameters($this->faker->sha1));
264+
$url = $this->bbb->getDeleteRecordingsUrl(new DeleteRecordingsParameters($this->faker->sha1));
263265
$this->assertContains(ApiMethod::DELETE_RECORDINGS, $url);
264266
}
265267

@@ -268,4 +270,22 @@ public function testDeleteRecordings()
268270
$result = $this->bbb->deleteRecordings(new DeleteRecordingsParameters('non-existing-id-' . $this->faker->sha1));
269271
$this->assertEquals('FAILED', $result->getReturnCode());
270272
}
273+
274+
public function testUpdateRecordingsUrl()
275+
{
276+
$params = $this->generateUpdateRecordingsParams();
277+
$url = $this->bbb->getUpdateRecordingsUrl($this->getUpdateRecordingsParamsMock($params));
278+
foreach ($params as $key => $value) {
279+
$value = !is_bool($value) ? $value : ($value ? 'true' : 'false');
280+
$this->assertContains('=' . urlencode($value), $url);
281+
}
282+
}
283+
284+
public function testUpdateRecordings()
285+
{
286+
$params = $this->generateUpdateRecordingsParams();
287+
$result = $this->bbb->updateRecordings($this->getUpdateRecordingsParamsMock($params));
288+
$this->assertEquals('FAILED', $result->getReturnCode());
289+
}
290+
271291
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
/**
3+
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/.
4+
*
5+
* Copyright (c) 2016 BigBlueButton Inc. and by respective authors (see below).
6+
*
7+
* This program is free software; you can redistribute it and/or modify it under the
8+
* terms of the GNU Lesser General Public License as published by the Free Software
9+
* Foundation; either version 3.0 of the License, or (at your option) any later
10+
* version.
11+
*
12+
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
13+
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14+
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Lesser General Public License along
17+
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
18+
*/
19+
namespace BigBlueButton\Parameters;
20+
21+
use BigBlueButton\TestCase;
22+
23+
class UpdateRecordingsParametersTest extends TestCase
24+
{
25+
public function testUpdateRecordingsParameters()
26+
{
27+
$params = $this->generateUpdateRecordingsParams();
28+
$updateRecordingsParams = $this->getUpdateRecordingsParamsMock($params);
29+
30+
$this->assertEquals($params['recordingId'], $updateRecordingsParams->getRecordingId());
31+
$this->assertEquals($params['meta_presenter'], $updateRecordingsParams->getMeta('presenter'));
32+
33+
// Test setters that are ignored by the constructor
34+
$updateRecordingsParams->setRecordingId($newId = $this->faker->uuid);
35+
$this->assertEquals($newId, $updateRecordingsParams->getRecordingId());
36+
}
37+
}

tests/Responses/DeleteRecordingsResponseTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ public function setUp()
3737
$this->delete = new DeleteRecordingsResponse($xml);
3838
}
3939

40-
public function testIsMeetingRunningResponseContent()
40+
public function testDeleteRecordingsResponseContent()
4141
{
4242
$this->assertEquals('SUCCESS', $this->delete->getReturnCode());
4343
$this->assertEquals(true, $this->delete->isDeleted());
4444
}
4545

46-
public function testIsMeetingRunningResponseTypes()
46+
public function testDeleteRecordingsResponseTypes()
4747
{
4848
$this->assertEachGetterValueIsString($this->delete, ['getReturnCode']);
4949
$this->assertEachGetterValueIsBoolean($this->delete, ['isDeleted']);

0 commit comments

Comments
 (0)