ltsecurityinc安防产品在线商城代码
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\User\Block\Role\Grid;
|
||||
|
||||
/**
|
||||
* @magentoAppArea adminhtml
|
||||
*/
|
||||
class UserTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @var \Magento\User\Block\Role\Grid\User
|
||||
*/
|
||||
protected $_block;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
|
||||
\Magento\Framework\View\LayoutInterface::class
|
||||
);
|
||||
$this->_block = $layout->createBlock(\Magento\User\Block\Role\Grid\User::class);
|
||||
}
|
||||
|
||||
public function testPreparedCollection()
|
||||
{
|
||||
$this->_block->toHtml();
|
||||
$this->assertInstanceOf(
|
||||
\Magento\User\Model\ResourceModel\Role\User\Collection::class,
|
||||
$this->_block->getCollection()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
namespace Magento\User\Block\Role\Tab;
|
||||
|
||||
/**
|
||||
* @magentoAppArea adminhtml
|
||||
*/
|
||||
class EditTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @var \Magento\User\Block\Role\Tab\Edit
|
||||
*/
|
||||
protected $_block;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$roleAdmin = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
|
||||
->create(\Magento\Authorization\Model\Role::class);
|
||||
$roleAdmin->load(\Magento\TestFramework\Bootstrap::ADMIN_ROLE_NAME, 'role_name');
|
||||
\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
|
||||
\Magento\Framework\App\RequestInterface::class
|
||||
)->setParam(
|
||||
'rid',
|
||||
$roleAdmin->getId()
|
||||
);
|
||||
|
||||
$this->_block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
|
||||
\Magento\User\Block\Role\Tab\Edit::class
|
||||
);
|
||||
}
|
||||
|
||||
public function testConstructor()
|
||||
{
|
||||
$this->assertNotEmpty($this->_block->getSelectedResources());
|
||||
$this->assertContains('Magento_Backend::all', $this->_block->getSelectedResources());
|
||||
}
|
||||
|
||||
public function testGetTree()
|
||||
{
|
||||
$encodedTree = $this->_block->getTree();
|
||||
$this->assertNotEmpty($encodedTree);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user