本文整理汇总了PHP中CMTest_TH::createStreamChannel方法的典型用法代码示例。如果您正苦于以下问题:PHP CMTest_TH::createStreamChannel方法的具体用法?PHP CMTest_TH::createStreamChannel怎么用?PHP CMTest_TH::createStreamChannel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMTest_TH
的用法示例。
在下文中一共展示了CMTest_TH::createStreamChannel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testFindByMediaId
public function testFindByMediaId()
{
$this->assertNull(CM_Model_StreamChannelArchive_Media::findByMediaId('foo'));
/** @var CM_Model_StreamChannel_Media $streamChannel */
$streamChannel = $streamChannel = CMTest_TH::createStreamChannel(null, null, 'foo');
$this->assertEquals($streamChannel, CM_Model_StreamChannel_Media::findByMediaId($streamChannel->getMediaId()));
}
示例2: testPaging
public function testPaging()
{
$user = CMTest_TH::createUser();
$streamChannel = CMTest_TH::createStreamChannel();
CMTest_TH::createStreamSubscribe($user, $streamChannel);
$streams = new CM_Paging_StreamSubscribe_User($user);
$this->assertEquals(1, $streams->getCount());
$user->delete();
$streams = new CM_Paging_StreamSubscribe_User($user);
$this->assertEquals(0, $streams->getCount());
}
示例3: testImportInvalidFile
public function testImportInvalidFile()
{
$file = new CM_File('fileDoesNotExist');
/** @var CM_Model_StreamChannel_Media $streamChannel */
$streamChannel = CMTest_TH::createStreamChannel(null, null, 'foobar');
$cli = new CM_MediaStreams_Cli();
$exception = $this->catchException(function () use($cli, $file) {
$cli->importVideoThumbnail('foobar', $file, 1);
});
$this->assertInstanceOf('CM_Exception', $exception);
$this->assertCount(0, $streamChannel->getThumbnails());
}
示例4: testPaging
public function testPaging()
{
$key = 'foo';
$streamChannel1 = CMTest_TH::createStreamChannel();
$streamChannel1->_set('key', $key);
$streamChannel2 = CMTest_TH::createStreamChannel();
$streamChannel2->_set('key', $key);
$this->assertEquals([], new CM_Paging_StreamChannelArchiveMedia_Key($key));
$streamChannelArchive1 = CMTest_TH::createStreamChannelVideoArchive($streamChannel1);
CMTest_TH::timeForward(1);
$streamChannelArchive2 = CMTest_TH::createStreamChannelVideoArchive($streamChannel2);
$this->assertEquals([$streamChannelArchive1, $streamChannelArchive2], new CM_Paging_StreamChannelArchiveMedia_Key($key));
}
示例5: testPaging
public function testPaging()
{
$streamChannel = CMTest_TH::createStreamChannel();
$paging = new CM_Paging_FileUserContent_StreamChannelVideoThumbnails($streamChannel);
$this->assertSame(0, $paging->getCount());
$this->assertSame(array(), $paging->getItems());
/** @var CM_Model_StreamChannel_Video $streamChannel */
$streamChannel = CMTest_TH::createStreamChannel();
CMTest_TH::createStreamPublish(null, $streamChannel);
$streamChannel->setThumbnailCount(4);
$paging = new CM_Paging_FileUserContent_StreamChannelVideoThumbnails($streamChannel);
$this->assertSame(4, $paging->getCount());
$filename = $streamChannel->getId() . '-' . $streamChannel->getHash() . '-thumbs/1.png';
$this->assertEquals(new CM_File_UserContent('streamChannels', $filename, $streamChannel->getId()), $paging->getItem(0));
}
示例6: testPaging
public function testPaging()
{
$usersExpected = array(CMTest_TH::createUser(), CMTest_TH::createUser(), CMTest_TH::createUser());
$streamChannel = CMTest_TH::createStreamChannel();
foreach ($usersExpected as $user) {
CMTest_TH::createStreamSubscribe($user, $streamChannel);
}
CMTest_TH::createStreamSubscribe(null, $streamChannel);
CMTest_TH::createStreamSubscribe(null, $streamChannel);
$usersActual = new CM_Paging_User_StreamChannelSubscriber($streamChannel);
$this->assertEquals(3, $usersActual->getCount());
foreach ($usersExpected as $user) {
$this->assertContains($user, $usersActual);
}
}
示例7: testPaging
public function testPaging()
{
$archive = CMTest_TH::createStreamChannelVideoArchive();
CMTest_TH::createStreamChannelVideoArchive();
CMTest_TH::createStreamChannelVideoArchive();
/** @var CM_Model_StreamChannel_Video $streamChannel */
$streamChannel = CMTest_TH::createStreamChannel();
$streamChannel = $this->getMock('CM_Model_StreamChannel_Video', array('getType'), array($streamChannel->getId()));
$streamChannel->expects($this->any())->method('getType')->will($this->returnValue(3));
CMTest_TH::createStreamChannelVideoArchive($streamChannel);
$paging = new CM_Paging_StreamChannelArchiveVideo_All();
$this->assertSame(4, $paging->getCount());
$archive->delete();
$paging = new CM_Paging_StreamChannelArchiveVideo_All();
$this->assertSame(3, $paging->getCount());
}
示例8: testSynchronizeMissingInPhp
public function testSynchronizeMissingInPhp()
{
/** @var CM_Model_StreamChannel_Video $streamChannel */
$streamChannel = CMTest_TH::createStreamChannel();
$streamPublish = CMTest_TH::createStreamPublish(null, $streamChannel);
$streamSubscribe = CMTest_TH::createStreamSubscribe(null, $streamChannel);
$wowza = $this->getMock('CM_Stream_Adapter_Video_Wowza', array('_stopClient', '_fetchStatus'));
$json = $this->_generateWowzaData(array($streamChannel));
$wowza->expects($this->any())->method('_fetchStatus')->will($this->returnValue($json));
$wowza->expects($this->at(1))->method('_stopClient')->with($streamPublish->getKey(), $streamChannel->getPrivateHost());
$wowza->expects($this->at(2))->method('_stopClient')->with($streamSubscribe->getKey(), $streamChannel->getPrivateHost());
$wowza->expects($this->exactly(2))->method('_stopClient');
/** @var $wowza CM_Stream_Adapter_Video_Wowza */
$wowza->unpublish($streamChannel->getKey());
$wowza->unsubscribe($streamChannel->getKey(), $streamSubscribe->getKey());
$wowza->synchronize();
}
示例9: testPaging
public function testPaging()
{
/** @var CM_Model_StreamChannel_Media $streamChannel */
$streamChannel = CMTest_TH::createStreamChannel();
$archive = CMTest_TH::createStreamChannelVideoArchive($streamChannel);
$this->assertEquals([], $archive->getThumbnails());
$thumbnail1 = CM_StreamChannel_Thumbnail::create($archive->getId(), 2);
$thumbnail2 = CM_StreamChannel_Thumbnail::create($archive->getId(), 1);
$this->assertEquals([$thumbnail2, $thumbnail1], $archive->getThumbnails());
$this->assertEquals([$thumbnail2, $thumbnail1], $streamChannel->getThumbnails());
$thumbnail2->delete();
$this->assertEquals([$thumbnail1], $archive->getThumbnails());
$this->assertEquals([$thumbnail1], $streamChannel->getThumbnails());
$thumbnail1->delete();
$this->assertEquals([], $archive->getThumbnails());
$this->assertEquals([], $streamChannel->getThumbnails());
}
示例10: testPaging
public function testPaging()
{
$archive = CMTest_TH::createStreamChannelVideoArchive();
CMTest_TH::createStreamChannelVideoArchive();
CMTest_TH::createStreamChannelVideoArchive();
/** @var CM_Model_StreamChannel_Media $streamChannel */
$streamChannel = CMTest_TH::createStreamChannel();
$mockBuilder = $this->getMockBuilder('CM_Model_StreamChannel_Media');
$mockBuilder->setMethods(['getType']);
$mockBuilder->setConstructorArgs([$streamChannel->getId()]);
$streamChannelMock = $mockBuilder->getMock();
$streamChannelMock->expects($this->any())->method('getType')->will($this->returnValue(3));
CMTest_TH::createStreamChannelVideoArchive($streamChannelMock);
$paging = new CM_Paging_StreamChannelArchiveMedia_All();
$this->assertSame(4, $paging->getCount());
$archive->delete();
$paging = new CM_Paging_StreamChannelArchiveMedia_All();
$this->assertSame(3, $paging->getCount());
}
示例11: testGetThumbnail
public function testGetThumbnail()
{
/** @var CM_Model_StreamChannel_Video $streamChannel */
$streamChannel = CMTest_TH::createStreamChannel();
CMTest_TH::createStreamPublish(null, $streamChannel);
$thumbnail = $streamChannel->getThumbnail(3);
$this->assertInstanceOf('CM_File_UserContent', $thumbnail);
$this->assertSame('streamChannels/' . $streamChannel->getId() . '/' . $streamChannel->getId() . '-' . $streamChannel->getHash() . '-thumbs/3.png', $thumbnail->getPathRelative());
}
示例12: testFindStreamChannel
public function testFindStreamChannel()
{
$channel = CMTest_TH::createStreamChannel();
$definition = $channel->getDefinition();
$this->assertEquals($channel, $definition->findStreamChannel());
}
示例13: testSynchronizeMissingInPhp
public function testSynchronizeMissingInPhp()
{
$streamChannel = CMTest_TH::createStreamChannel(null, CM_Janus_Service::getTypeStatic());
$streamChannelKey = $streamChannel->getKey();
$streamPublish = CMTest_TH::createStreamPublish(null, $streamChannel);
$streamPublishKey = $streamPublish->getKey();
$streamSubscribe = CMTest_TH::createStreamSubscribe(null, $streamChannel);
$streamSubscribeKey = $streamSubscribe->getKey();
$streamChannel2 = CMTest_TH::createStreamChannel(null, CM_Janus_Service::getTypeStatic());
$streamChannelKey2 = $streamChannel2->getKey();
CMTest_TH::createStreamPublish(null, $streamChannel2);
//to make channel non empty
$location = $this->mockClass('CM_Geo_Point')->newInstanceWithoutConstructor();
$server1 = $this->mockClass('CM_Janus_Server')->newInstance([1, 'key', 'http://mock', 'ws://mock', [], $location]);
/** @var CM_Janus_ServerList|\Mocka\AbstractClassTrait $serverList */
$serverList = $this->mockObject('CM_Janus_ServerList');
$serverList->mockMethod('getAll')->set([$server1]);
$status = [['id' => $streamPublishKey, 'channelName' => $streamChannelKey, 'isPublish' => true], ['id' => $streamSubscribeKey, 'channelName' => $streamChannelKey, 'isPublish' => false], ['id' => 'absentStreamKey', 'channelName' => 'absentChannelKey', 'isPublish' => false], ['id' => 'absentStreamKey2', 'channelName' => $streamChannelKey2, 'isPublish' => true]];
$httpApiClient = $this->mockClass('CM_Janus_HttpApiClient')->newInstanceWithoutConstructor();
$httpApiClient->mockMethod('fetchStatus')->set(function (CM_Janus_Server $passedServer) use($server1, $status) {
$this->assertSame($server1, $passedServer);
return $status;
});
$stopStreamMethod = $httpApiClient->mockMethod('stopStream')->at(0, function ($server, $streamKey) use($streamPublishKey, $server1) {
$this->assertEquals($server1, $server);
$this->assertSame($streamPublishKey, $streamKey);
})->at(1, function ($server, $streamKey) use($streamSubscribeKey, $server1) {
$this->assertEquals($server1, $server);
$this->assertSame($streamSubscribeKey, $streamKey);
})->at(2, function ($server, $streamKey) use($server1) {
$this->assertEquals($server1, $server);
$this->assertSame('absentStreamKey', $streamKey);
})->at(3, function ($server, $streamKey) use($server1) {
$this->assertEquals($server1, $server);
$this->assertSame('absentStreamKey2', $streamKey);
});
/** @var CM_Janus_HttpApiClient $httpApiClient */
$janus = new CM_Janus_Service($serverList, $httpApiClient);
$janus->getStreamRepository()->removeStream($streamPublish);
$janus->getStreamRepository()->removeStream($streamSubscribe);
$janus->synchronize();
$this->assertSame(4, $stopStreamMethod->getCallCount());
}
示例14: testUnsetUser
public function testUnsetUser()
{
$user = CMTest_TH::createUser();
$streamChannel = CMTest_TH::createStreamChannel();
/** @var CM_Model_Stream_Subscribe $streamSubscribe */
$streamSubscribe = CM_Model_Stream_Subscribe::createStatic(array('streamChannel' => $streamChannel, 'user' => $user, 'start' => time(), 'key' => str_repeat('a', 100)));
$this->assertEquals($user, $streamSubscribe->getUser());
$streamSubscribe->unsetUser();
$this->assertNull($streamSubscribe->getUser());
}
示例15: testDeleteWithPublishs
/**
* @expectedException CM_Exception_Invalid
* @expectedExceptionMessage Cannot delete streamChannel with existing streams
*/
public function testDeleteWithPublishs()
{
/** @var CM_Model_StreamChannel_Mock $streamChannel */
$streamChannel = CMTest_TH::createStreamChannel();
CMTest_TH::createStreamPublish(null, $streamChannel);
$streamChannel->delete();
}