Skip to content

Commit 2598994

Browse files
committed
magento2/pull/26939: Fixed static test.
1 parent 744b0f7 commit 2598994

File tree

8 files changed

+69
-24
lines changed

8 files changed

+69
-24
lines changed

app/code/Magento/AdminNotification/Block/System/Messages.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
use Magento\Framework\Notification\MessageInterface;
1313
use Magento\Framework\Serialize\Serializer\Json as JsonSerializer;
1414

15+
/**
16+
* AdminNotification Messages class
17+
*/
1518
class Messages extends Template
1619
{
1720
/**

app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/AjaxMarkAsRead.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?php
22
/**
3-
*
43
* Copyright © Magento, Inc. All rights reserved.
54
* See COPYING.txt for license details.
65
*/
@@ -9,9 +8,13 @@
98
use Magento\AdminNotification\Controller\Adminhtml\Notification;
109
use Magento\AdminNotification\Model\NotificationService;
1110
use Magento\Backend\App\Action;
11+
use Magento\Framework\App\Action\HttpPostActionInterface;
1212
use Magento\Framework\Controller\ResultFactory;
1313

14-
class AjaxMarkAsRead extends Notification
14+
/**
15+
* AdminNotification AjaxMarkAsRead controller
16+
*/
17+
class AjaxMarkAsRead extends Notification implements HttpPostActionInterface
1518
{
1619
/**
1720
* @var NotificationService

app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/MarkAsRead.php

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?php
22
/**
3-
*
43
* Copyright © Magento, Inc. All rights reserved.
54
* See COPYING.txt for license details.
65
*/
@@ -9,9 +8,13 @@
98
use Magento\AdminNotification\Controller\Adminhtml\Notification;
109
use Magento\AdminNotification\Model\NotificationService;
1110
use Magento\Backend\App\Action;
11+
use Magento\Framework\App\Action\HttpGetActionInterface;
1212
use Magento\Framework\Exception\LocalizedException;
1313

14-
class MarkAsRead extends Notification
14+
/**
15+
* AdminNotification MarkAsRead controller
16+
*/
17+
class MarkAsRead extends Notification implements HttpGetActionInterface
1518
{
1619
/**
1720
* Authorization level of a basic admin session
@@ -25,14 +28,20 @@ class MarkAsRead extends Notification
2528
*/
2629
private $notificationService;
2730

31+
/**
32+
* @param Action\Context $context
33+
* @param NotificationService $notificationService
34+
*/
2835
public function __construct(Action\Context $context, NotificationService $notificationService)
2936
{
3037
parent::__construct($context);
3138
$this->notificationService = $notificationService;
3239
}
3340

3441
/**
35-
* @return void
42+
* @inheritdoc
43+
*
44+
* @return \Magento\Framework\App\ResponseInterface|\Magento\Framework\Controller\ResultInterface
3645
*/
3746
public function execute()
3847
{
@@ -50,9 +59,8 @@ public function execute()
5059
);
5160
}
5261

53-
$this->getResponse()->setRedirect($this->_redirect->getRedirectUrl($this->getUrl('*')));
54-
return;
62+
return $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl($this->getUrl('*')));
5563
}
56-
$this->_redirect('adminhtml/*/');
64+
return $this->_redirect('adminhtml/*/');
5765
}
5866
}

app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/MassMarkAsRead.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?php
22
/**
3-
*
43
* Copyright © Magento, Inc. All rights reserved.
54
* See COPYING.txt for license details.
65
*/
@@ -9,8 +8,12 @@
98
use Magento\AdminNotification\Controller\Adminhtml\Notification;
109
use Magento\AdminNotification\Model\InboxFactory as InboxModelFactory;
1110
use Magento\Backend\App\Action;
11+
use Magento\Framework\App\Action\HttpPostActionInterface;
1212

13-
class MassMarkAsRead extends Notification
13+
/**
14+
* AdminNotification MassMarkAsRead controller
15+
*/
16+
class MassMarkAsRead extends Notification implements HttpPostActionInterface
1417
{
1518
/**
1619
* Authorization level of a basic admin session
@@ -24,14 +27,20 @@ class MassMarkAsRead extends Notification
2427
*/
2528
private $inboxModelFactory;
2629

30+
/**
31+
* @param Action\Context $context
32+
* @param InboxModelFactory $inboxModelFactory
33+
*/
2734
public function __construct(Action\Context $context, InboxModelFactory $inboxModelFactory)
2835
{
2936
parent::__construct($context);
3037
$this->inboxModelFactory = $inboxModelFactory;
3138
}
3239

3340
/**
34-
* @return void
41+
* @inheritdoc
42+
*
43+
* @return \Magento\Framework\App\ResponseInterface|\Magento\Framework\Controller\ResultInterface
3544
*/
3645
public function execute()
3746
{
@@ -58,6 +67,6 @@ public function execute()
5867
);
5968
}
6069
}
61-
$this->_redirect('adminhtml/*/');
70+
return $this->_redirect('adminhtml/*/');
6271
}
6372
}

app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/MassRemove.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?php
22
/**
3-
*
43
* Copyright © Magento, Inc. All rights reserved.
54
* See COPYING.txt for license details.
65
*/
@@ -9,8 +8,12 @@
98
use Magento\AdminNotification\Controller\Adminhtml\Notification;
109
use Magento\AdminNotification\Model\InboxFactory as InboxModelFactory;
1110
use Magento\Backend\App\Action;
11+
use Magento\Framework\App\Action\HttpPostActionInterface;
1212

13-
class MassRemove extends Notification
13+
/**
14+
* AdminNotification MassRemove controller
15+
*/
16+
class MassRemove extends Notification implements HttpPostActionInterface
1417
{
1518

1619
/**
@@ -24,14 +27,20 @@ class MassRemove extends Notification
2427
*/
2528
private $inboxModelFactory;
2629

30+
/**
31+
* @param Action\Context $context
32+
* @param InboxModelFactory $inboxModelFactory
33+
*/
2734
public function __construct(Action\Context $context, InboxModelFactory $inboxModelFactory)
2835
{
2936
parent::__construct($context);
3037
$this->inboxModelFactory = $inboxModelFactory;
3138
}
3239

3340
/**
34-
* @return void
41+
* @inheritdoc
42+
*
43+
* @return \Magento\Framework\App\ResponseInterface|\Magento\Framework\Controller\ResultInterface
3544
*/
3645
public function execute()
3746
{
@@ -56,6 +65,6 @@ public function execute()
5665
);
5766
}
5867
}
59-
$this->_redirect('adminhtml/*/');
68+
return $this->_redirect('adminhtml/*/');
6069
}
6170
}

app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/Remove.php

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?php
22
/**
3-
*
43
* Copyright © Magento, Inc. All rights reserved.
54
* See COPYING.txt for license details.
65
*/
@@ -9,8 +8,12 @@
98
use Magento\AdminNotification\Controller\Adminhtml\Notification;
109
use Magento\AdminNotification\Model\InboxFactory as InboxModelFactory;
1110
use Magento\Backend\App\Action;
11+
use Magento\Framework\App\Action\HttpGetActionInterface;
1212

13-
class Remove extends Notification
13+
/**
14+
* AdminNotification Remove controller
15+
*/
16+
class Remove extends Notification implements HttpGetActionInterface
1417
{
1518
/**
1619
* Authorization level of a basic admin session
@@ -24,23 +27,28 @@ class Remove extends Notification
2427
*/
2528
private $inboxModelFactory;
2629

30+
/**
31+
* @param Action\Context $context
32+
* @param InboxModelFactory $inboxModelFactory
33+
*/
2734
public function __construct(Action\Context $context, InboxModelFactory $inboxModelFactory)
2835
{
2936
parent::__construct($context);
3037
$this->inboxModelFactory = $inboxModelFactory;
3138
}
3239

3340
/**
34-
* @return void
41+
* @inheritdoc
42+
*
43+
* @return \Magento\Framework\App\ResponseInterface|\Magento\Framework\Controller\ResultInterface
3544
*/
3645
public function execute()
3746
{
3847
if ($id = $this->getRequest()->getParam('id')) {
3948
$model = $this->inboxModelFactory->create()->load($id);
4049

4150
if (!$model->getId()) {
42-
$this->_redirect('adminhtml/*/');
43-
return;
51+
return $this->_redirect('adminhtml/*/');
4452
}
4553

4654
try {
@@ -55,9 +63,8 @@ public function execute()
5563
);
5664
}
5765

58-
$this->_redirect('adminhtml/*/');
59-
return;
66+
return $this->_redirect('adminhtml/*/');
6067
}
61-
$this->_redirect('adminhtml/*/');
68+
return $this->_redirect('adminhtml/*/');
6269
}
6370
}

dev/tests/integration/testsuite/Magento/AdminNotification/Controller/Adminhtml/Notification/MassMarkAsReadTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@
55
*/
66
namespace Magento\AdminNotification\Controller\Adminhtml\Notification;
77

8+
use Magento\Framework\App\Request\Http as HttpRequest;
9+
810
class MassMarkAsReadTest extends \Magento\TestFramework\TestCase\AbstractBackendController
911
{
1012
public function setUp()
1113
{
1214
$this->resource = 'Magento_AdminNotification::mark_as_read';
1315
$this->uri = 'backend/admin/notification/massmarkasread';
16+
$this->httpMethod = HttpRequest::METHOD_POST;
1417
parent::setUp();
1518
}
1619
}

dev/tests/integration/testsuite/Magento/AdminNotification/Controller/Adminhtml/Notification/MassRemoveTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@
55
*/
66
namespace Magento\AdminNotification\Controller\Adminhtml\Notification;
77

8+
use Magento\Framework\App\Request\Http as HttpRequest;
9+
810
class MassRemoveTest extends \Magento\TestFramework\TestCase\AbstractBackendController
911
{
1012
public function setUp()
1113
{
1214
$this->resource = 'Magento_AdminNotification::adminnotification_remove';
1315
$this->uri = 'backend/admin/notification/massremove';
16+
$this->httpMethod = HttpRequest::METHOD_POST;
1417
parent::setUp();
1518
}
1619
}

0 commit comments

Comments
 (0)