本文整理汇总了PHP中CMTest_TH::createStreamPublish方法的典型用法代码示例。如果您正苦于以下问题:PHP CMTest_TH::createStreamPublish方法的具体用法?PHP CMTest_TH::createStreamPublish怎么用?PHP CMTest_TH::createStreamPublish使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMTest_TH
的用法示例。
在下文中一共展示了CMTest_TH::createStreamPublish方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testHasStreamPublish
public function testHasStreamPublish()
{
/** @var CM_Model_StreamChannel_Media $streamChannel */
$streamChannel = CMTest_TH::createStreamChannel();
$this->assertFalse($streamChannel->hasStreamPublish());
CMTest_TH::createStreamPublish(null, $streamChannel);
$this->assertTrue($streamChannel->hasStreamPublish());
}
示例2: testPaging
public function testPaging()
{
$user = CMTest_TH::createUser();
$streamChannel = CMTest_TH::createStreamChannel();
CMTest_TH::createStreamPublish($user, $streamChannel);
$streams = new CM_Paging_StreamPublish_User($user);
$this->assertEquals(1, $streams->getCount());
$user->delete();
$streams = new CM_Paging_StreamPublish_User($user);
$this->assertEquals(0, $streams->getCount());
}
示例3: 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));
}
示例4: 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();
}
示例5: 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());
}
示例6: 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();
}
示例7: testGetChannel
public function testGetChannel()
{
$streamChannel = CMTest_TH::createStreamChannel();
$streamPublish = CMTest_TH::createStreamPublish(null, $streamChannel);
$this->assertEquals($streamChannel, $streamPublish->getStreamChannel());
}
示例8: 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());
}
示例9: testFindById
public function testFindById()
{
$streamChannel = $streamChannel = CMTest_TH::createStreamChannel();
$this->assertNull(CM_Model_StreamChannelArchive_Video::findById($streamChannel->getId()));
CMTest_TH::createStreamPublish(null, $streamChannel);
CM_Model_StreamChannelArchive_Video::createStatic(array('streamChannel' => $streamChannel));
$this->assertInstanceOf('CM_Model_StreamChannelArchive_Video', CM_Model_StreamChannelArchive_Video::findById($streamChannel->getId()));
}