本文整理汇总了PHP中OCP\Util::getChannel方法的典型用法代码示例。如果您正苦于以下问题:PHP Util::getChannel方法的具体用法?PHP Util::getChannel怎么用?PHP Util::getChannel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OCP\Util
的用法示例。
在下文中一共展示了Util::getChannel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayPanel
/**
* @return TemplateResponse
*/
public function displayPanel()
{
$lastUpdateCheck = $this->dateTimeFormatter->formatDateTime($this->config->getAppValue('core', 'lastupdatedat'));
$channels = ['daily', 'beta', 'stable', 'production'];
$currentChannel = \OCP\Util::getChannel();
// Remove the currently used channel from the channels list
if (($key = array_search($currentChannel, $channels)) !== false) {
unset($channels[$key]);
}
$updateState = $this->updateChecker->getUpdateState();
$params = ['isNewVersionAvailable' => $updateState === [] ? false : true, 'lastChecked' => $lastUpdateCheck, 'currentChannel' => $currentChannel, 'channels' => $channels, 'newVersionString' => $updateState === [] ? '' : $updateState['updateVersion']];
return new TemplateResponse($this->appName, 'admin', $params, '');
}
示例2: testDisplayPanelWithoutUpdate
public function testDisplayPanelWithoutUpdate()
{
$channels = ['daily', 'beta', 'stable', 'production'];
$currentChannel = \OCP\Util::getChannel();
// Remove the currently used channel from the channels list
if (($key = array_search($currentChannel, $channels)) !== false) {
unset($channels[$key]);
}
$this->config->expects($this->exactly(2))->method('getAppValue')->willReturnMap([['core', 'lastupdatedat', '', '12345'], ['updatenotification', 'notify_groups', '["admin"]', '["admin"]']]);
$this->dateTimeFormatter->expects($this->once())->method('formatDateTime')->with('12345')->willReturn('LastCheckedReturnValue');
$this->updateChecker->expects($this->once())->method('getUpdateState')->willReturn([]);
$params = ['isNewVersionAvailable' => false, 'lastChecked' => 'LastCheckedReturnValue', 'currentChannel' => \OCP\Util::getChannel(), 'channels' => $channels, 'newVersionString' => '', 'notify_groups' => 'admin'];
$expected = new TemplateResponse('updatenotification', 'admin', $params, '');
$this->assertEquals($expected, $this->adminController->displayPanel());
}
示例3: testOverrideChannel
/**
* @dataProvider channelProvider
*
* @param string $channel
*/
public function testOverrideChannel($channel)
{
\OCP\Util::setChannel($channel);
$actual = \OCP\Util::getChannel($channel);
$this->assertEquals($channel, $actual);
}
示例4: getCurrentChannel
/**
* Get current value
* @return string
*/
public function getCurrentChannel()
{
return \OCP\Util::getChannel();
}