ltsecurityinc安防产品在线商城代码
This commit is contained in:
+24
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/***
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\AdminNotification\Controller\Adminhtml\Notification;
|
||||
|
||||
/**
|
||||
* Testing markAsRead controller.
|
||||
*
|
||||
* @magentoAppArea adminhtml
|
||||
*/
|
||||
class MarkAsReadTest extends \Magento\TestFramework\TestCase\AbstractBackendController
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->resource = 'Magento_AdminNotification::mark_as_read';
|
||||
$this->uri = 'backend/admin/notification/markasread';
|
||||
parent::setUp();
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/***
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\AdminNotification\Controller\Adminhtml\Notification;
|
||||
|
||||
use Magento\Framework\App\Request\Http as HttpRequest;
|
||||
|
||||
class MassMarkAsReadTest extends \Magento\TestFramework\TestCase\AbstractBackendController
|
||||
{
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->resource = 'Magento_AdminNotification::mark_as_read';
|
||||
$this->uri = 'backend/admin/notification/massmarkasread';
|
||||
$this->httpMethod = HttpRequest::METHOD_POST;
|
||||
parent::setUp();
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/***
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\AdminNotification\Controller\Adminhtml\Notification;
|
||||
|
||||
use Magento\Framework\App\Request\Http as HttpRequest;
|
||||
|
||||
class MassRemoveTest extends \Magento\TestFramework\TestCase\AbstractBackendController
|
||||
{
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->resource = 'Magento_AdminNotification::adminnotification_remove';
|
||||
$this->uri = 'backend/admin/notification/massremove';
|
||||
$this->httpMethod = HttpRequest::METHOD_POST;
|
||||
parent::setUp();
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
/***
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\AdminNotification\Controller\Adminhtml\Notification;
|
||||
|
||||
class RemoveTest extends \Magento\TestFramework\TestCase\AbstractBackendController
|
||||
{
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->resource = 'Magento_AdminNotification::adminnotification_remove';
|
||||
$this->uri = 'backend/admin/notification/remove';
|
||||
parent::setUp();
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\AdminNotification\Model\ResourceModel\Inbox\Collection;
|
||||
|
||||
class CriticalTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @var \Magento\AdminNotification\Model\ResourceModel\Inbox\Collection\Critical
|
||||
*/
|
||||
protected $_model;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
|
||||
\Magento\AdminNotification\Model\ResourceModel\Inbox\Collection\Critical::class
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @magentoDataFixture Magento/AdminNotification/_files/notifications.php
|
||||
*/
|
||||
public function testCollectionContainsLastUnreadCriticalItem()
|
||||
{
|
||||
$items = array_values($this->_model->getItems());
|
||||
$this->assertEquals('Unread Critical 3', $items[0]->getTitle());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Magento\AdminNotification\Model\Inbox;
|
||||
use Magento\AdminNotification\Model\ResourceModel\Inbox as InboxResource;
|
||||
use Magento\Framework\Notification\MessageInterface;
|
||||
use Magento\Framework\ObjectManagerInterface;
|
||||
use Magento\TestFramework\Helper\Bootstrap;
|
||||
|
||||
/** @var ObjectManagerInterface $objectManager */
|
||||
$objectManager = Bootstrap::getObjectManager();
|
||||
|
||||
/**
|
||||
* @var Inbox $message
|
||||
* @var InboxResource $messageResource
|
||||
*/
|
||||
$message = $objectManager->create(Inbox::class);
|
||||
$messageResource = $objectManager->create(InboxResource::class);
|
||||
|
||||
$message->setSeverity(MessageInterface::SEVERITY_CRITICAL)->setTitle('Unread Critical 1');
|
||||
$messageResource->save($message);
|
||||
|
||||
$message = $objectManager->create(Inbox::class);
|
||||
$message->setSeverity(MessageInterface::SEVERITY_MAJOR)->setTitle('Unread Major 1');
|
||||
$messageResource->save($message);
|
||||
|
||||
$message = $objectManager->create(Inbox::class);
|
||||
$message->setSeverity(MessageInterface::SEVERITY_CRITICAL)->setTitle('Unread Critical 2');
|
||||
$messageResource->save($message);
|
||||
|
||||
$message = $objectManager->create(Inbox::class);
|
||||
$message->setSeverity(MessageInterface::SEVERITY_CRITICAL)->setTitle('Unread Critical 3');
|
||||
$messageResource->save($message);
|
||||
|
||||
$message = $objectManager->create(Inbox::class);
|
||||
$message->setSeverity(MessageInterface::SEVERITY_CRITICAL)->setTitle('Read Critical 1')->setIsRead(1);
|
||||
$messageResource->save($message);
|
||||
|
||||
$message = $objectManager->create(Inbox::class);
|
||||
$message->setSeverity(MessageInterface::SEVERITY_MAJOR)->setTitle('Unread Major 2');
|
||||
$messageResource->save($message);
|
||||
|
||||
$message = $objectManager->create(Inbox::class);
|
||||
$message->setSeverity(MessageInterface::SEVERITY_CRITICAL)->setTitle('Removed Critical 1')->setIsRemove(1);
|
||||
$messageResource->save($message);
|
||||
Reference in New Issue
Block a user