/**
  * @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, '');
 }
 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());
 }
 public function testGetUpdateStateWithoutUpdate()
 {
     $this->updater->expects($this->once())->method('check')->willReturn([]);
     $expected = [];
     $this->assertSame($expected, $this->updateChecker->getUpdateState());
 }