eliminating hints
This commit is contained in:
Родитель
6baabe29e6
Коммит
fdfa854374
|
@ -97,7 +97,7 @@ class OptionController extends Controller {
|
|||
$this->acl->setPollId($pollId);
|
||||
}
|
||||
|
||||
return new DataResponse((array) $this->mapper->findByPoll($pollId), Http::STATUS_OK);
|
||||
return new DataResponse($this->mapper->findByPoll($pollId), Http::STATUS_OK);
|
||||
|
||||
} catch (DoesNotExistException $e) {
|
||||
return new DataResponse($e, Http::STATUS_NOT_FOUND);
|
||||
|
@ -118,8 +118,7 @@ class OptionController extends Controller {
|
|||
|
||||
try {
|
||||
$this->acl->setToken($token);
|
||||
return $this->get($this->acl->getPollId());
|
||||
return new DataResponse((array) $this->get($this->acl->getPollId()), Http::STATUS_OK);
|
||||
return new DataResponse($this->get($this->acl->getPollId()), Http::STATUS_OK);
|
||||
|
||||
} catch (DoesNotExistException $e) {
|
||||
return new DataResponse($e, Http::STATUS_NOT_FOUND);
|
||||
|
@ -135,7 +134,6 @@ class OptionController extends Controller {
|
|||
public function add($option) {
|
||||
|
||||
try {
|
||||
$Poll = $this->pollMapper->find($option['pollId']);
|
||||
$this->acl->setPollId($option['pollId']);
|
||||
|
||||
if (!$this->acl->setPollId($option['pollId'])->getAllowEdit()) {
|
||||
|
|
|
@ -88,7 +88,7 @@ class PageController extends Controller {
|
|||
* @param string $token
|
||||
* @return PublicTemplateResponse
|
||||
*/
|
||||
public function votePublic($token) {
|
||||
public function votePublic(/** @scrutinizer ignore-unused */ $token) {
|
||||
return new PublicTemplateResponse('polls', 'polls.tmpl', [
|
||||
'urlGenerator' => $this->urlGenerator]);
|
||||
}
|
||||
|
|
|
@ -178,10 +178,7 @@ class PollController extends Controller {
|
|||
return new DataResponse(['message' => 'Unauthorized write attempt.'], Http::STATUS_UNAUTHORIZED);
|
||||
}
|
||||
|
||||
$logMessageId = 'updatePoll';
|
||||
|
||||
} catch (Exception $e) {
|
||||
$logMessageId = 'addPoll';
|
||||
$this->poll = new Poll();
|
||||
|
||||
$this->poll->setType($poll['type']);
|
||||
|
@ -204,7 +201,7 @@ class PollController extends Controller {
|
|||
|
||||
if ($this->poll->getId() > 0) {
|
||||
$this->mapper->update($this->poll);
|
||||
$this->logService->setLog($this->poll->getId(), $logMessageId);
|
||||
$this->logService->setLog($this->poll->getId(), 'updatePoll');
|
||||
} else {
|
||||
$this->mapper->insert($this->poll);
|
||||
$this->logService->setLog($this->poll->getId(), 'addPoll');
|
||||
|
|
|
@ -23,8 +23,10 @@
|
|||
|
||||
namespace OCA\Polls\Cron;
|
||||
|
||||
use Exception;
|
||||
|
||||
use OCP\ILogger;
|
||||
use OC\BackgroundJob\TimedJob;
|
||||
use OCP\BackgroundJob\TimedJob;
|
||||
|
||||
use OCA\Polls\Service\MailService;
|
||||
|
||||
|
@ -48,13 +50,10 @@ class NotificationCron extends TimedJob {
|
|||
/**
|
||||
* run
|
||||
* @param string $token
|
||||
* @return null
|
||||
*/
|
||||
protected function run($arguments) {
|
||||
if ($this->mailService->sendNotifications()) {
|
||||
$this->logger->debug('Notifications sent');
|
||||
} else {
|
||||
$this->logger->alert('error while sending notifications');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,73 +38,73 @@ class PageControllerTest extends UnitTestCase {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
protected function setUp(): void {
|
||||
$avatarManager = $this->getMockBuilder('OCP\IAvatarManager')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$config = $this->getMockBuilder('OCP\IConfig')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$groupManager = $this->getMockBuilder('OCP\IGroupManager')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$l10n = $this->getMockBuilder('OCP\IL10N')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$logger = $this->getMockBuilder('OCP\ILogger')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
// $avatarManager = $this->getMockBuilder('OCP\IAvatarManager')
|
||||
// ->disableOriginalConstructor()
|
||||
// ->getMock();
|
||||
// $config = $this->getMockBuilder('OCP\IConfig')
|
||||
// ->disableOriginalConstructor()
|
||||
// ->getMock();
|
||||
// $groupManager = $this->getMockBuilder('OCP\IGroupManager')
|
||||
// ->disableOriginalConstructor()
|
||||
// ->getMock();
|
||||
// $l10n = $this->getMockBuilder('OCP\IL10N')
|
||||
// ->disableOriginalConstructor()
|
||||
// ->getMock();
|
||||
// $logger = $this->getMockBuilder('OCP\ILogger')
|
||||
// ->disableOriginalConstructor()
|
||||
// ->getMock();
|
||||
$request = $this->getMockBuilder('OCP\IRequest')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$urlGenerator = $this->getMockBuilder('OCP\IURLGenerator')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$user = $this->getMockBuilder('OCP\IUser')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$userManager = $this->getMockBuilder('OCP\IUserManager')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$transFactory = $this->getMockBuilder('OCP\L10N\IFactory')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$mailer = $this->getMockBuilder('OCP\Mail\IMailer')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$commentMapper = $this->getMockBuilder('OCA\Polls\Db\CommentMapper')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$optionMapper = $this->getMockBuilder('OCA\Polls\Db\OptionMapper')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$pollMapper = $this->getMockBuilder('OCA\Polls\Db\PollMapper')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$subscriptionMapper = $this->getMockBuilder('OCA\Polls\Db\SubscriptionMapper')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$voteMapper = $this->getMockBuilder('OCA\Polls\Db\VoteMapper')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
// $user = $this->getMockBuilder('OCP\IUser')
|
||||
// ->disableOriginalConstructor()
|
||||
// ->getMock();
|
||||
// $userManager = $this->getMockBuilder('OCP\IUserManager')
|
||||
// ->disableOriginalConstructor()
|
||||
// ->getMock();
|
||||
// $transFactory = $this->getMockBuilder('OCP\L10N\IFactory')
|
||||
// ->disableOriginalConstructor()
|
||||
// ->getMock();
|
||||
// $mailer = $this->getMockBuilder('OCP\Mail\IMailer')
|
||||
// ->disableOriginalConstructor()
|
||||
// ->getMock();
|
||||
// $commentMapper = $this->getMockBuilder('OCA\Polls\Db\CommentMapper')
|
||||
// ->disableOriginalConstructor()
|
||||
// ->getMock();
|
||||
// $optionMapper = $this->getMockBuilder('OCA\Polls\Db\OptionMapper')
|
||||
// ->disableOriginalConstructor()
|
||||
// ->getMock();
|
||||
// $pollMapper = $this->getMockBuilder('OCA\Polls\Db\PollMapper')
|
||||
// ->disableOriginalConstructor()
|
||||
// ->getMock();
|
||||
// $subscriptionMapper = $this->getMockBuilder('OCA\Polls\Db\SubscriptionMapper')
|
||||
// ->disableOriginalConstructor()
|
||||
// ->getMock();
|
||||
// $voteMapper = $this->getMockBuilder('OCA\Polls\Db\VoteMapper')
|
||||
// ->disableOriginalConstructor()
|
||||
// ->getMock();
|
||||
|
||||
$this->controller = new PageController(
|
||||
'polls',
|
||||
$request,
|
||||
$urlGenerator,
|
||||
$userManager,
|
||||
$groupManager,
|
||||
$avatarManager,
|
||||
$logger,
|
||||
$l10n,
|
||||
$transFactory,
|
||||
$config,
|
||||
$this->userId,
|
||||
$commentMapper,
|
||||
$optionMapper,
|
||||
$pollMapper,
|
||||
$subscriptionMapper,
|
||||
$voteMapper,
|
||||
$mailer
|
||||
$urlGenerator
|
||||
// $userManager,
|
||||
// $groupManager,
|
||||
// $avatarManager,
|
||||
// $logger,
|
||||
// $l10n,
|
||||
// $transFactory,
|
||||
// $config,
|
||||
// $this->userId,
|
||||
// $commentMapper,
|
||||
// $optionMapper,
|
||||
// $pollMapper,
|
||||
// $subscriptionMapper,
|
||||
// $voteMapper,
|
||||
// $mailer
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче