Skip to content

Commit 832b46f

Browse files
author
Joan He
committed
MAGETWO-37981: fixed integration tests
1 parent a936ac4 commit 832b46f

File tree

78 files changed

+126
-128
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+126
-128
lines changed

dev/tests/integration/testsuite/Magento/Backend/Utility/Controller.php renamed to dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractBackendController.php

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
* Copyright © 2015 Magento. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
namespace Magento\Backend\Utility;
6+
namespace Magento\TestFramework\TestCase;
77

88
/**
99
* A parent class for backend controllers - contains directives for admin user creation and authentication
1010
* @SuppressWarnings(PHPMD.NumberOfChildren)
1111
* @SuppressWarnings(PHPMD.numberOfChildren)
1212
*/
13-
class Controller extends \Magento\TestFramework\TestCase\AbstractController
13+
abstract class AbstractBackendController extends \Magento\TestFramework\TestCase\AbstractController
1414
{
1515
/**
1616
* @var \Magento\Backend\Model\Auth\Session
@@ -22,6 +22,20 @@ class Controller extends \Magento\TestFramework\TestCase\AbstractController
2222
*/
2323
protected $_auth;
2424

25+
/**
26+
* The resource used to authorize action
27+
*
28+
* @var string
29+
*/
30+
protected $resource = null;
31+
32+
/**
33+
* The uri at which to access the controller
34+
*
35+
* @var string
36+
*/
37+
protected $uri;
38+
2539
protected function setUp()
2640
{
2741
parent::setUp();
@@ -70,4 +84,29 @@ public function assertSessionMessages(
7084
) {
7185
parent::assertSessionMessages($constraint, $messageType, $messageManagerClass);
7286
}
87+
88+
89+
public function testAclHasAccess()
90+
{
91+
if ($this->resource === null) {
92+
$this->markTestIncomplete('Acl test is not complete');
93+
}
94+
$this->_objectManager->get('Magento\Framework\Acl\Builder')
95+
->getAcl()
96+
->allow(null, $this->resource);
97+
$this->dispatch($this->uri);
98+
$this->assertNotSame(403, $this->getResponse()->getHttpResponseCode());
99+
}
100+
101+
public function testAclNoAccess()
102+
{
103+
if ($this->resource === null) {
104+
$this->markTestIncomplete('Acl test is not complete');
105+
}
106+
$this->_objectManager->get('Magento\Framework\Acl\Builder')
107+
->getAcl()
108+
->deny(null, $this->resource);
109+
$this->dispatch($this->uri);
110+
$this->assertSame(403, $this->getResponse()->getHttpResponseCode());
111+
}
73112
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
namespace Magento\AdminNotification\Controller\Adminhtml\Notification;
77

8-
class MarkAsReadTest extends \Magento\Backend\Utility\BackendAclAbstractTest
8+
class MarkAsReadTest extends \Magento\TestFramework\TestCase\AbstractBackendController
99
{
1010
public function setUp()
1111
{

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
namespace Magento\AdminNotification\Controller\Adminhtml\Notification;
77

8-
class MassMarkAsReadTest extends \Magento\Backend\Utility\BackendAclAbstractTest
8+
class MassMarkAsReadTest extends \Magento\TestFramework\TestCase\AbstractBackendController
99
{
1010
public function setUp()
1111
{

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
namespace Magento\AdminNotification\Controller\Adminhtml\Notification;
77

8-
class MassRemoveTest extends \Magento\Backend\Utility\BackendAclAbstractTest
8+
class MassRemoveTest extends \Magento\TestFramework\TestCase\AbstractBackendController
99
{
1010
public function setUp()
1111
{

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
namespace Magento\AdminNotification\Controller\Adminhtml\Notification;
77

8-
class RemoveTest extends \Magento\Backend\Utility\BackendAclAbstractTest
8+
class RemoveTest extends \Magento\TestFramework\TestCase\AbstractBackendController
99
{
1010
public function setUp()
1111
{

dev/tests/integration/testsuite/Magento/Backend/App/AbstractActionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Test class for \Magento\Backend\Controller\AbstractAction.
1010
* @magentoAppArea adminhtml
1111
*/
12-
class AbstractActionTest extends \Magento\Backend\Utility\Controller
12+
class AbstractActionTest extends \Magento\TestFramework\TestCase\AbstractBackendController
1313
{
1414
/**
1515
* Check redirection to startup page for logged user

dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/Cache/MassActionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use Magento\Framework\Config\File\ConfigFilePool;
1212
use Magento\Framework\App\Filesystem\DirectoryList;
1313

14-
class MassActionTest extends \Magento\Backend\Utility\Controller
14+
class MassActionTest extends \Magento\TestFramework\TestCase\AbstractBackendController
1515
{
1616
/**
1717
* Configuration of cache types

dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/CacheTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/**
99
* @magentoAppArea adminhtml
1010
*/
11-
class CacheTest extends \Magento\Backend\Utility\Controller
11+
class CacheTest extends \Magento\TestFramework\TestCase\AbstractBackendController
1212
{
1313
/**
1414
* @magentoDataFixture Magento/Backend/controllers/_files/cache/application_cache.php

dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/Dashboard/ProductsViewedTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
namespace Magento\Backend\Controller\Adminhtml\Dashboard;
88

9-
class ProductsViewedTest extends \Magento\Backend\Utility\Controller
9+
class ProductsViewedTest extends \Magento\TestFramework\TestCase\AbstractBackendController
1010
{
1111
/**
1212
* @magentoDataFixture Magento/Reports/_files/viewed_products.php

dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/DashboardTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/**
99
* @magentoAppArea adminhtml
1010
*/
11-
class DashboardTest extends \Magento\Backend\Utility\Controller
11+
class DashboardTest extends \Magento\TestFramework\TestCase\AbstractBackendController
1212
{
1313
public function testAjaxBlockAction()
1414
{

0 commit comments

Comments
 (0)