本文整理汇总了PHP中CMTest_TH::createSession方法的典型用法代码示例。如果您正苦于以下问题:PHP CMTest_TH::createSession方法的具体用法?PHP CMTest_TH::createSession怎么用?PHP CMTest_TH::createSession使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMTest_TH
的用法示例。
在下文中一共展示了CMTest_TH::createSession方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCreate
public function testCreate()
{
new CM_Splittest_Fixture(new CM_Http_Request_Post('/foo/null'));
new CM_Splittest_Fixture(CMTest_TH::createUser());
try {
new CM_Splittest_Fixture(CMTest_TH::createSession());
$this->fail('Should not be able to create a fixture from a session');
} catch (CM_Exception_Invalid $e) {
$this->assertContains('Invalid fixture type', $e->getMessage());
}
}
示例2: _generateWowzaData
private function _generateWowzaData(array $streamChannels)
{
$jsonData = array();
/** @var CM_Model_StreamChannel_Video $streamChannel */
foreach ($streamChannels as $streamChannel) {
$subscribes = array();
/** @var CM_Model_Stream_Publish $streamPublish */
$streamPublish = $streamChannel->getStreamPublish();
/** @var CM_Model_Stream_Subscribe $streamSubscribe */
foreach ($streamChannel->getStreamSubscribes() as $streamSubscribe) {
$session = CMTest_TH::createSession($streamSubscribe->getUser());
$subscribes[$streamSubscribe->getKey()] = array('startTimeStamp' => $streamSubscribe->getStart(), 'clientId' => $streamSubscribe->getKey(), 'data' => json_encode(array('sessionId' => $session->getId())));
}
$session = CMTest_TH::createSession($streamPublish->getUser());
$jsonData[$streamChannel->getKey()] = array('startTimeStamp' => $streamPublish->getStart(), 'clientId' => $streamPublish->getKey(), 'data' => json_encode(array('sessionId' => $session->getId(), 'streamChannelType' => $streamChannel->getType())), 'subscribers' => $subscribes, 'thumbnailCount' => 2, 'width' => 480, 'height' => 720, 'wowzaIp' => ip2long('192.168.0.1'));
}
return json_encode($jsonData);
}
示例3: testGetSession
public function testGetSession()
{
$session1 = CMTest_TH::createSession();
$sessionId1 = $session1->getId();
$session2 = CMTest_TH::createSession();
$sessionId2 = $session2->getId();
$params = new CM_Params(['foo' => $sessionId1, 'bar' => 'baz', 'baz' => $session2, 'quux' => 5]);
$session1 = $params->getSession('foo');
$this->assertInstanceOf('CM_Session', $session1);
$this->assertSame($sessionId1, $session1->getId());
$exception = $this->catchException(function () use($params) {
$params->getSession('bar');
});
$this->assertInstanceOf('CM_Exception_InvalidParam', $exception);
$this->assertSame('Session is not found', $exception->getMessage());
$session2 = $params->getSession('baz');
$this->assertInstanceOf('CM_Session', $session2);
$this->assertSame($sessionId2, $session2->getId());
$exception = $this->catchException(function () use($params) {
$params->getSession('quux');
});
$this->assertInstanceOf('CM_Exception_InvalidParam', $exception);
$this->assertSame('Invalid param type for session', $exception->getMessage());
}