Skip to content

Commit 2ae78c4

Browse files
author
Dale Sikkema
committed
MAGETWO-38935: Add Integration Tests for changes in CE
1 parent 0132912 commit 2ae78c4

File tree

18 files changed

+319
-0
lines changed

18 files changed

+319
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
/***
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\AdminNotification\Controller\Adminhtml\Notification;
7+
8+
class MarkAsReadTest extends \Magento\Backend\Utility\BackendAclAbstractTest
9+
{
10+
public function setUp()
11+
{
12+
$this->resource = 'Magento_AdminNotification::mark_as_read';
13+
$this->uri = 'backend/admin/notification/markasread';
14+
parent::setUp();
15+
}
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
/***
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\AdminNotification\Controller\Adminhtml\Notification;
7+
8+
class MassMarkAsReadTest extends \Magento\Backend\Utility\BackendAclAbstractTest
9+
{
10+
public function setUp()
11+
{
12+
$this->resource = 'Magento_AdminNotification::mark_as_read';
13+
$this->uri = 'backend/admin/notification/massmarkasread';
14+
parent::setUp();
15+
}
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
/***
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\AdminNotification\Controller\Adminhtml\Notification;
7+
8+
class MassRemoveTest extends \Magento\Backend\Utility\BackendAclAbstractTest
9+
{
10+
public function setUp()
11+
{
12+
$this->resource = 'Magento_AdminNotification::adminnotification_remove';
13+
$this->uri = 'backend/admin/notification/massremove';
14+
parent::setUp();
15+
}
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
/***
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\AdminNotification\Controller\Adminhtml\Notification;
7+
8+
class RemoveTest extends \Magento\Backend\Utility\BackendAclAbstractTest
9+
{
10+
public function setUp()
11+
{
12+
$this->resource = 'Magento_AdminNotification::adminnotification_remove';
13+
$this->uri = 'backend/admin/notification/remove';
14+
parent::setUp();
15+
}
16+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
/***
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Backend\Utility;
8+
9+
/**
10+
* Contains logic for testing authorization mechanism of controllers
11+
*/
12+
class BackendAclAbstractTest extends \Magento\Backend\Utility\Controller
13+
{
14+
/**
15+
* The resource used to authorize action
16+
*
17+
* @var string
18+
*/
19+
protected $resource;
20+
21+
/**
22+
* The uri at which to access the controller
23+
*
24+
* @var string
25+
*/
26+
protected $uri;
27+
28+
public function testAclHasAccess()
29+
{
30+
\Magento\TestFramework\Helper\Bootstrap::getObjectManager()
31+
->get('Magento\Framework\Acl\Builder')
32+
->getAcl()
33+
->allow(null, $this->resource);;
34+
$this->dispatch($this->uri);
35+
$this->assertNotSame(403, $this->getResponse()->getHttpResponseCode());
36+
}
37+
38+
public function testAclNoAccess()
39+
{
40+
\Magento\TestFramework\Helper\Bootstrap::getObjectManager()
41+
->get('Magento\Framework\Acl\Builder')
42+
->getAcl()
43+
->deny(null, $this->resource);;
44+
$this->dispatch($this->uri);
45+
$this->assertSame(403, $this->getResponse()->getHttpResponseCode());
46+
}
47+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
/***
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Sales\Controller\Adminhtml\Order;
7+
8+
class AddCommentTest extends \Magento\Backend\Utility\BackendAclAbstractTest
9+
{
10+
public function setUp()
11+
{
12+
$this->resource = 'Magento_Sales::comment';
13+
$this->uri = 'backend/sales/order/addcomment';
14+
parent::setUp();
15+
}
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
/***
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Sales\Controller\Adminhtml\Order;
7+
8+
class AddressSaveTest extends \Magento\Backend\Utility\BackendAclAbstractTest
9+
{
10+
public function setUp()
11+
{
12+
$this->resource = 'Magento_Sales::actions_edit';
13+
$this->uri = 'backend/sales/order/addresssave';
14+
parent::setUp();
15+
}
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
/***
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Sales\Controller\Adminhtml\Order;
7+
8+
class AddressTest extends \Magento\Backend\Utility\BackendAclAbstractTest
9+
{
10+
public function setUp()
11+
{
12+
$this->resource = 'Magento_Sales::actions_edit';
13+
$this->uri = 'backend/sales/order/address';
14+
parent::setUp();
15+
}
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
/***
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Sales\Controller\Adminhtml\Order;
7+
8+
class CancelTest extends \Magento\Backend\Utility\BackendAclAbstractTest
9+
{
10+
public function setUp()
11+
{
12+
$this->resource = 'Magento_Sales::cancel';
13+
$this->uri = 'backend/sales/order/cancel';
14+
parent::setUp();
15+
}
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
/***
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Sales\Controller\Adminhtml\Order;
7+
8+
class EmailTest extends \Magento\Backend\Utility\BackendAclAbstractTest
9+
{
10+
public function setUp()
11+
{
12+
$this->resource = 'Magento_Sales::email';
13+
$this->uri = 'backend/sales/order/email';
14+
parent::setUp();
15+
}
16+
}

0 commit comments

Comments
 (0)