本文整理汇总了PHP中CMTest_TH::createStreamChannelVideoArchive方法的典型用法代码示例。如果您正苦于以下问题:PHP CMTest_TH::createStreamChannelVideoArchive方法的具体用法?PHP CMTest_TH::createStreamChannelVideoArchive怎么用?PHP CMTest_TH::createStreamChannelVideoArchive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMTest_TH
的用法示例。
在下文中一共展示了CMTest_TH::createStreamChannelVideoArchive方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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));
}
示例2: testPaging
public function testPaging()
{
$user = CMTest_TH::createUser();
CMTest_TH::createStreamChannelVideoArchive(null, $user);
CMTest_TH::createStreamChannelVideoArchive(null, $user);
CMTest_TH::timeForward(1);
$streamChannel3 = CMTest_TH::createStreamChannelVideoArchive(null, $user);
CMTest_TH::createStreamChannelVideoArchive();
CMTest_TH::createStreamChannelVideoArchive();
$paging = new CM_Paging_StreamChannelArchiveVideo_User($user);
$this->assertSame(3, $paging->getCount());
$this->assertEquals($streamChannel3, $paging->getItem(0));
}
示例3: testPaging
public function testPaging()
{
$archive = CMTest_TH::createStreamChannelVideoArchive();
$paging = new CM_Paging_FileUserContent_StreamChannelArchiveVideoThumbnails($archive);
$this->assertSame(0, $paging->getCount());
$this->assertSame(array(), $paging->getItems());
/** @var CM_Model_StreamChannel_Video $streamChannel */
$streamChannel = CMTest_TH::createStreamChannel();
$streamChannel->setThumbnailCount(4);
$archive = CMTest_TH::createStreamChannelVideoArchive($streamChannel);
$paging = new CM_Paging_FileUserContent_StreamChannelArchiveVideoThumbnails($archive);
$this->assertSame(4, $paging->getCount());
$filename = $archive->getId() . '-' . $archive->getHash() . '-thumbs/1.png';
$this->assertEquals(new CM_File_UserContent('streamChannels', $filename, $streamChannel->getId()), $paging->getItem(0));
}
示例4: 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());
}
示例5: 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());
}
示例6: 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());
}
示例7: testDeleteOlder
public function testDeleteOlder()
{
$time = time();
/** @var CM_Model_StreamChannel_Video $streamChannel */
$streamChannelsDeleted = array();
$archivesDeleted = array();
/** @var $filesDeleted CM_File[] */
$filesDeleted = array();
for ($i = 0; $i < 2; $i++) {
$streamChannel = CMTest_TH::createStreamChannel();
$streamChannel->setThumbnailCount(4);
$streamChannelsDeleted[] = $streamChannel;
$archive = CMTest_TH::createStreamChannelVideoArchive($streamChannel);
$archivesDeleted[] = $archive;
$filesDeleted = array_merge($filesDeleted, $this->_createArchiveFiles($archive));
}
$streamChannelsNotDeleted = array();
$archivesNotDeleted = array();
/** @var $filesNotDeleted CM_File[] */
$filesNotDeleted = array();
$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));
$streamChannelsNotDeleted[] = $streamChannel;
$archive = CMTest_TH::createStreamChannelVideoArchive($streamChannel);
$archivesNotDeleted[] = $archive;
$filesNotDeleted = array_merge($filesNotDeleted, $this->_createArchiveFiles($archive));
CMTest_TH::timeForward(20);
for ($i = 0; $i < 3; $i++) {
$streamChannel = CMTest_TH::createStreamChannel();
$streamChannel->setThumbnailCount(4);
$streamChannelsNotDeleted[] = $streamChannel;
$archive = CMTest_TH::createStreamChannelVideoArchive($streamChannel);
$archivesNotDeleted[] = $archive;
$filesNotDeleted = array_merge($filesNotDeleted, $this->_createArchiveFiles($archive));
}
foreach ($filesNotDeleted as $file) {
$this->assertTrue($file->exists());
}
foreach ($filesDeleted as $file) {
$this->assertTrue($file->exists());
}
CM_Model_StreamChannelArchive_Video::deleteOlder(10, CM_Model_StreamChannel_Video::getTypeStatic());
foreach ($filesNotDeleted as $file) {
$this->assertTrue($file->exists());
}
foreach ($filesDeleted as $file) {
$this->assertFalse($file->exists());
}
foreach ($archivesNotDeleted as $archive) {
try {
CMTest_TH::reinstantiateModel($archive);
$this->assertTrue(true);
} catch (CM_Exception_Nonexistent $ex) {
$this->fail('Young streamchannelArchive deleted');
}
}
foreach ($archivesDeleted as $archive) {
try {
CMTest_TH::reinstantiateModel($archive);
$this->fail('Old streamchannelArchive not deleted');
} catch (CM_Exception_Nonexistent $ex) {
$this->assertTrue(true);
}
}
}
示例8: testDeleteOlder
public function testDeleteOlder()
{
$archivesDeleted = [];
$archivesNotDeleted = [];
for ($i = 0; $i < 2; $i++) {
$archive = CMTest_TH::createStreamChannelVideoArchive();
$archivesDeleted[] = $archive;
}
$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));
$archive = CMTest_TH::createStreamChannelVideoArchive($streamChannelMock);
$archivesNotDeleted[] = $archive;
CMTest_TH::timeForward(20);
for ($i = 0; $i < 3; $i++) {
$archive = CMTest_TH::createStreamChannelVideoArchive();
$archivesNotDeleted[] = $archive;
}
$this->assertCount(6, new CM_Paging_StreamChannelArchiveMedia_All());
CM_Model_StreamChannelArchive_Media::deleteOlder(10, CM_Model_StreamChannel_Media::getTypeStatic());
$this->assertCount(4, new CM_Paging_StreamChannelArchiveMedia_All());
foreach ($archivesNotDeleted as $archive) {
$exception = $this->catchException(function () use($archive) {
CMTest_TH::reinstantiateModel($archive);
});
$this->assertNull($exception, 'Deleted archive that was too young or the wrong type');
}
foreach ($archivesDeleted as $archive) {
$exception = $this->catchException(function () use($archive) {
CMTest_TH::reinstantiateModel($archive);
});
$this->assertInstanceOf('CM_Exception_Nonexistent', $exception, 'Didn\'t delete old archive');
}
}